Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
2909334
AX_LIB_HDF5: fix order of flags
ZedThree Mar 23, 2018
8389878
Merge pull request #962 from boutproject/bugfix-961
ZedThree Mar 23, 2018
a9fcbf9
add simple test for squashoutput
dschwoerer Oct 8, 2018
f7d5117
Fix append mode
dschwoerer Oct 8, 2018
de6ffad
Fix for Field2D
dschwoerer Oct 8, 2018
25cfad4
Fix: glob not correctly imported
dschwoerer Oct 8, 2018
5006006
add dump_on_restart=false sub test
dschwoerer Oct 8, 2018
a555391
Fix formatting
dschwoerer Oct 8, 2018
f02880b
Bump version number to 4.2.0
ZedThree Oct 3, 2018
8d68443
Include caveats on OpenMP parallelisation in documentation
ZedThree Oct 3, 2018
a5ce343
Merge branch 'master' into v4.2-rc
ZedThree Oct 9, 2018
e9e0008
Remove mixed field-aligned/non-field-aligned derivatives
johnomotani May 14, 2018
90648ba
Add missing fromFieldAligned calls
johnomotani May 14, 2018
54494d4
Fix f->f_fa
johnomotani Jul 3, 2018
1342d87
Set location of result as soon as it is declared in index_derivs.cxx
johnomotani Jul 3, 2018
feb65a4
Merge branch 'next' into v4.2-rc
ZedThree Oct 9, 2018
fce307d
Improvements after feedback
dschwoerer Oct 10, 2018
2c863fa
Clear up language about parallelisation directions
ZedThree Oct 10, 2018
23930d1
Merge pull request #1306 from boutproject/bugfixes-from-shiftedmetric…
ZedThree Oct 11, 2018
cbe4688
Use launch_safe in order set nproc and mthread
ZedThree Oct 11, 2018
627179a
Use minimal number of timesteps
ZedThree Oct 11, 2018
ef396a1
Add docstrings, simplify error message handling
ZedThree Oct 11, 2018
3c7f806
Throw error messages for non-python collect routines
ZedThree Oct 11, 2018
002d30c
Merge pull request #1303 from boutproject/squash-test
ZedThree Oct 11, 2018
d5a9f21
Add some text on setting the openmp schedule
ZedThree Oct 11, 2018
1493312
Fix some sphinx whitespace/code blocks
ZedThree Oct 11, 2018
cbd4da3
Merge pull request #1307 from boutproject/openmp-docs
ZedThree Oct 12, 2018
836abfb
Provide `getRegion` method on Fields to return the requested Region f…
d7919 Oct 11, 2018
00dfc5f
Add const(_iterator) overload of Region::begin/end
d7919 Oct 12, 2018
a1b8dee
Make mesh::getRegion?? const
d7919 Oct 12, 2018
cba520f
Remove unnecessary interp_to in Grad2_par2
johnomotani Oct 6, 2018
b54aef9
Tidying up more location setting in derivatives
johnomotani Oct 11, 2018
3be5334
Remove bracket_location() function, replace with ASSERT1
johnomotani Oct 12, 2018
ac984b8
Remove const on arguments passed by value
johnomotani Oct 11, 2018
2bef4ec
Add method argument to Grad2_par2
johnomotani Oct 3, 2018
89e4110
Merge pull request #1312 from boutproject/fix-issue-394
ZedThree Oct 12, 2018
8bb7ce6
Merge pull request #1316 from boutproject/field_get_region
ZedThree Oct 12, 2018
49247a3
Use curly braces with if statements
johnomotani Oct 12, 2018
cb88437
Verify location of dx/dy in MMS/derivatives3
johnomotani Oct 3, 2018
4b9f68a
Fix derivatives3 MMS test for nonuniform=true
johnomotani Oct 10, 2018
2ed941a
Add outloc, method arguments in Field2D Grad_par, Vpar_Grad_par
johnomotani Oct 8, 2018
ef81ee7
Add method argument to Div_par_K_Grad_par
johnomotani Oct 4, 2018
d0c7c4f
Add outloc and method arguments to Div_par(Field2D)
johnomotani Oct 4, 2018
198352a
Make Field2D Vpar_Grad_par consistent with Field3D version
johnomotani Oct 5, 2018
4c4f31e
Add Field2D version of Div_par_flux
johnomotani Oct 5, 2018
87f3c1a
Add outloc arguments for Laplace and Delp2 in boutcore
johnomotani Oct 3, 2018
c83d8c5
Add more differential operators to boutcore
johnomotani Oct 3, 2018
2a3515a
Don't load Coordinates.IntShiftTorsion in boutcore
johnomotani Oct 4, 2018
c20c166
Enable getting coordinates at different locations in boutcore
johnomotani Oct 4, 2018
1c1dd5d
boutcore: allow difops to raise Python exceptions
johnomotani Oct 4, 2018
bb9d53d
Add Field2D support to many boutcore functions
johnomotani Oct 5, 2018
5d9e007
Don't use backticks in boutcore *.in files
johnomotani Oct 5, 2018
c8f0634
Tidy up Field*D type checking in boutcore
johnomotani Oct 5, 2018
8b08308
Fix boutcore.bracket to allow Field2D arguments
johnomotani Oct 5, 2018
c97fc25
Add D4D*4, D2DXDY, D2DXDZ, D2DYDZ to boutcore
johnomotani Oct 5, 2018
c333bf7
Allow communication of Field2D in boutcore
johnomotani Oct 8, 2018
e77e297
Add bout_CHECK variable to boutcore, holding the value of 'CHECK'
johnomotani Oct 9, 2018
f88a55c
Add Mesh.getXProcIndex() and Mesh.getYProcIndex() to boutcore
johnomotani Oct 9, 2018
7477d4a
Alternative python module with utility functions/classes for MMS
johnomotani Oct 3, 2018
634a930
MMS test for differential operators
johnomotani Oct 3, 2018
b516d5b
fudge expected order of bracket BRACKET_STD in difops MMS test
johnomotani Oct 6, 2018
90e8a9e
Make short version of difops MMS test to use in standard test_suite
johnomotani Oct 7, 2018
1172d4e
Add sympy in travis when boutcore is available
johnomotani Oct 11, 2018
771887a
Use astype('int') method instead of dtype=int argument
johnomotani Oct 11, 2018
e131832
Add method to check if a GridDataSource includes y-guard cells
johnomotani Oct 3, 2018
b9b9de4
Don't (necessarily) communicate quantities read from mesh
johnomotani Oct 3, 2018
81fa0ea
Bugfix: extrapolate geometric quantities into guard cells
johnomotani Oct 4, 2018
c5ab79b
Fix extrapolation of metric when there are not enough grid cells
johnomotani Oct 7, 2018
e02885e
interpolateAndExtrapolate: don't communicate original field
johnomotani Oct 7, 2018
fa1ca3f
Handle CELL_ZLOW case in boundary_standard.cxx
johnomotani Oct 11, 2018
f72611c
Remove uses of global mesh from boundary conditions
johnomotani Oct 11, 2018
f94d28c
Merge remote-tracking branch 'origin/v4.2-rc' into test-difops
johnomotani Oct 12, 2018
72d293e
Merge branch 'boundary-conditions-fixes' into test-difops
johnomotani Oct 12, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ matrix:
- *default_env
- CONFIGURE_OPTIONS='--enable-shared'
- SCRIPT_FLAGS="-uim -t python -t shared"
- PIP_PACKAGES='netcdf4 cython'
- PIP_PACKAGES='netcdf4 cython sympy'
- env:
- *default_env
- CONFIGURE_OPTIONS='--enable-openmp'
Expand Down
6 changes: 3 additions & 3 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,11 @@ authors:

- family-names: Wang
given-names: Zhanhui
version: 4.1.2
date-released: 2017-12-01
version: 4.2.0
date-released: TBC
repository-code: https://github.com/boutproject/BOUT-dev
url: http://boutproject.github.io/
doi: 10.5281/zenodo.1423213
doi: TBC
license: 'LGPL-3.0-or-later'
references:
- type: article
Expand Down
31 changes: 18 additions & 13 deletions bin/bout-squashoutput
Original file line number Diff line number Diff line change
Expand Up @@ -9,37 +9,42 @@ from sys import exit
try:
import argcomplete
except ImportError:
argcomplete=None
argcomplete = None
import boutdata.squashoutput as squash

# Parse command line arguments
parser = argparse.ArgumentParser(squash.__doc__+"\n\n"+squash.squashoutput.__doc__)
parser = argparse.ArgumentParser(
squash.__doc__ + "\n\n" + squash.squashoutput.__doc__)


def str_to_bool(string):
return string.lower()=="true" or string.lower()=="t"
return string.lower() == "true" or string.lower() == "t"


def int_or_none(string):
try:
return int(string)
except ValueError:
if string.lower()=='none' or string.lower()=='n':
if string.lower() == 'none' or string.lower() == 'n':
return None
else:
raise

parser.add_argument("datadir", nargs='?', default=".")
parser.add_argument("--outputname",default="BOUT.dmp.nc")
parser.add_argument("--outputname", default="BOUT.dmp.nc")
parser.add_argument("--tind", type=int_or_none, nargs='*', default=[None])
parser.add_argument("--xind", type=int_or_none, nargs='*', default=[None])
parser.add_argument("--yind", type=int_or_none, nargs='*', default=[None])
parser.add_argument("--zind", type=int_or_none, nargs='*', default=[None])
parser.add_argument("-s","--singleprecision", action="store_true", default=False)
parser.add_argument("-c","--compress", action="store_true", default=False)
parser.add_argument("-l","--complevel", type=int_or_none, default=None)
parser.add_argument("-i","--least-significant-digit", type=int_or_none, default=None)
parser.add_argument("-q","--quiet", action="store_true", default=False)
parser.add_argument("-a","--append", action="store_true", default=False)
parser.add_argument("-d","--delete", action="store_true", default=False)
parser.add_argument("-s", "--singleprecision",
action="store_true", default=False)
parser.add_argument("-c", "--compress", action="store_true", default=False)
parser.add_argument("-l", "--complevel", type=int_or_none, default=None)
parser.add_argument("-i", "--least-significant-digit",
type=int_or_none, default=None)
parser.add_argument("-q", "--quiet", action="store_true", default=False)
parser.add_argument("-a", "--append", action="store_true", default=False)
parser.add_argument("-d", "--delete", action="store_true", default=False)

if argcomplete:
argcomplete.autocomplete(parser)
Expand All @@ -49,7 +54,7 @@ args = parser.parse_args()
# Late imports to not slow down bash completion

for ind in "txyz":
args.__dict__[ind+"ind"]=slice(*args.__dict__[ind+"ind"])
args.__dict__[ind + "ind"] = slice(*args.__dict__[ind + "ind"])
# Call the function, using command line arguments
squash.squashoutput(**args.__dict__)

Expand Down
22 changes: 11 additions & 11 deletions configure
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for BOUT++ 4.1.2.
# Generated by GNU Autoconf 2.69 for BOUT++ 4.2.0.
#
# Report bugs to <bd512@york.ac.uk>.
#
Expand Down Expand Up @@ -580,8 +580,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='BOUT++'
PACKAGE_TARNAME='bout--'
PACKAGE_VERSION='4.1.2'
PACKAGE_STRING='BOUT++ 4.1.2'
PACKAGE_VERSION='4.2.0'
PACKAGE_STRING='BOUT++ 4.2.0'
PACKAGE_BUGREPORT='bd512@york.ac.uk'
PACKAGE_URL=''

Expand Down Expand Up @@ -1359,7 +1359,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures BOUT++ 4.1.2 to adapt to many kinds of systems.
\`configure' configures BOUT++ 4.2.0 to adapt to many kinds of systems.

Usage: $0 [OPTION]... [VAR=VALUE]...

Expand Down Expand Up @@ -1421,7 +1421,7 @@ fi

if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of BOUT++ 4.1.2:";;
short | recursive ) echo "Configuration of BOUT++ 4.2.0:";;
esac
cat <<\_ACEOF

Expand Down Expand Up @@ -1550,7 +1550,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
BOUT++ configure 4.1.2
BOUT++ configure 4.2.0
generated by GNU Autoconf 2.69

Copyright (C) 2012 Free Software Foundation, Inc.
Expand Down Expand Up @@ -2131,7 +2131,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.

It was created by BOUT++ $as_me 4.1.2, which was
It was created by BOUT++ $as_me 4.2.0, which was
generated by GNU Autoconf 2.69. Invocation command line was

$ $0 $@
Expand Down Expand Up @@ -12705,7 +12705,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by BOUT++ $as_me 4.1.2, which was
This file was extended by BOUT++ $as_me 4.2.0, which was
generated by GNU Autoconf 2.69. Invocation command line was

CONFIG_FILES = $CONFIG_FILES
Expand Down Expand Up @@ -12758,7 +12758,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
BOUT++ config.status 4.1.2
BOUT++ config.status 4.2.0
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"

Expand Down Expand Up @@ -13933,7 +13933,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by BOUT++ $as_me 4.1.2, which was
This file was extended by BOUT++ $as_me 4.2.0, which was
generated by GNU Autoconf 2.69. Invocation command line was

CONFIG_FILES = $CONFIG_FILES
Expand Down Expand Up @@ -13986,7 +13986,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
BOUT++ config.status 4.1.2
BOUT++ config.status 4.2.0
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"

Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#

AC_PREREQ([2.69])
AC_INIT([BOUT++],[4.1.2],[bd512@york.ac.uk])
AC_INIT([BOUT++],[4.2.0],[bd512@york.ac.uk])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIR([m4])

Expand Down
4 changes: 2 additions & 2 deletions include/bout/coordinates.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ public:
const Field3D Div_par(const Field3D &f, CELL_LOC outloc=CELL_DEFAULT, DIFF_METHOD method=DIFF_DEFAULT);

// Second derivative along magnetic field
const Field2D Grad2_par2(const Field2D &f, CELL_LOC outloc=CELL_DEFAULT);
const Field3D Grad2_par2(const Field3D &f, CELL_LOC outloc=CELL_DEFAULT);
const Field2D Grad2_par2(const Field2D &f, CELL_LOC outloc=CELL_DEFAULT, DIFF_METHOD method=DIFF_DEFAULT);
const Field3D Grad2_par2(const Field3D &f, CELL_LOC outloc=CELL_DEFAULT, DIFF_METHOD method=DIFF_DEFAULT);

// Perpendicular Laplacian operator, using only X-Z derivatives
// NOTE: This might be better bundled with the Laplacian inversion code
Expand Down
12 changes: 12 additions & 0 deletions include/bout/griddata.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ public:
Direction dir = GridDataSource::X) = 0;
virtual bool get(Mesh *m, vector<BoutReal> &var, const string &name, int len,
int offset = 0, Direction dir = GridDataSource::X) = 0;

/// Test if grid data source includes y-boundary guard cells.
/// Older grid files may not: this then requires some special handling.
virtual bool hasYGuards() { return true; }
};

/// Interface to grid data in a file
Expand All @@ -89,6 +93,14 @@ public:
bool get(Mesh *m, vector<BoutReal> &var, const string &name, int len, int offset = 0,
GridDataSource::Direction dir = GridDataSource::X) override;

// Grid files from hypnotoad don't have y-guard cells at all. But even if
// they did, they don't have guard cells for the y-boundaries of the core
// region because the grid structure means the grid cells adjacent to the
// first/last core cells in the input arrays in the file store data for the
// PF region. So until a GridFile supports input with different domains, it
// cannot contain *all* y-guard cells
bool hasYGuards() override { return false; }

private:
std::unique_ptr<DataFormat> file;
string filename;
Expand Down
14 changes: 7 additions & 7 deletions include/bout/mesh.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,10 @@ class Mesh {
/// @param[out] var This will be set to the value. Will be allocated if needed
/// @param[in] name Name of the variable to read
/// @param[in] def The default value if not found
/// @param[in] communicate Should the field be communicated to fill guard cells?
///
/// @param[in] allow_communicate Allow the field to be communicated if
/// necessary to fill guard cells
/// @returns zero if successful, non-zero on failure
int get(Field3D &var, const string &name, BoutReal def=0.0, bool communicate=true);
int get(Field3D &var, const string &name, BoutReal def=0.0, bool allow_communicate=true);

/// Get a Vector2D from the input source.
/// If \p var is covariant then this gets three
Expand Down Expand Up @@ -650,12 +650,12 @@ class Mesh {
/// Get the named region from the region_map for the data iterator
///
/// Throws if region_name not found
Region<> &getRegion(const std::string &region_name){
const Region<> &getRegion(const std::string &region_name) const{
return getRegion3D(region_name);
}
Region<Ind3D> &getRegion3D(const std::string &region_name);
Region<Ind2D> &getRegion2D(const std::string &region_name);
Region<IndPerp> &getRegionPerp(const std::string &region_name);
const Region<Ind3D> &getRegion3D(const std::string &region_name) const;
const Region<Ind2D> &getRegion2D(const std::string &region_name) const;
const Region<IndPerp> &getRegionPerp(const std::string &region_name) const;

/// Add a new region to the region_map for the data iterator
///
Expand Down
2 changes: 2 additions & 0 deletions include/bout/region.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -483,8 +483,10 @@ public:
/// Note that if the indices are altered using these iterators, the
/// blocks may become out of sync and will need to manually updated
typename RegionIndices::iterator begin() { return std::begin(indices); };
typename RegionIndices::const_iterator begin() const { return std::begin(indices); };
typename RegionIndices::const_iterator cbegin() const { return indices.cbegin(); };
typename RegionIndices::iterator end() { return std::end(indices); };
typename RegionIndices::const_iterator end() const { return std::end(indices); };
typename RegionIndices::const_iterator cend() const { return indices.cend(); };

const ContiguousBlocks &getBlocks() const { return blocks; };
Expand Down
22 changes: 14 additions & 8 deletions include/difops.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ const Field3D Grad_parP(const Field3D &apar, const Field3D &f);
* @param[in] f The scalar field to be differentiated
*
*/
const Field2D Vpar_Grad_par(const Field2D &v, const Field2D &f);
const Field2D Vpar_Grad_par(const Field2D &v, const Field2D &f,
CELL_LOC outloc=CELL_DEFAULT, DIFF_METHOD method=DIFF_DEFAULT);

/*!
* vpar times parallel derivative along unperturbed B-field (upwinding)
Expand Down Expand Up @@ -121,9 +122,12 @@ const Field3D Vpar_Grad_par(const Field3D &v, const Field3D &f, DIFF_METHOD meth
* \f]
*
* @param[in] f The component of a vector along the magnetic field
* @param[in] outloc The cell location for the result. By default the same as \p f
* @param[in] method The numerical method to use
*
*/
const Field2D Div_par(const Field2D &f);
const Field2D Div_par(const Field2D &f,
CELL_LOC outloc=CELL_DEFAULT, DIFF_METHOD method=DIFF_DEFAULT);

/*!
* parallel divergence operator
Expand Down Expand Up @@ -158,6 +162,8 @@ const Field3D Div_par(const Field3D &f, DIFF_METHOD method, CELL_LOC outloc = CE
const Field3D Div_par_flux(const Field3D &v, const Field3D &f,
CELL_LOC outloc=CELL_DEFAULT, DIFF_METHOD method=DIFF_DEFAULT);
const Field3D Div_par_flux(const Field3D &v, const Field3D &f, DIFF_METHOD method, CELL_LOC outloc = CELL_DEFAULT);
const Field2D Div_par_flux(const Field2D &v, const Field2D &f,
CELL_LOC outloc=CELL_DEFAULT, DIFF_METHOD method=DIFF_DEFAULT);

// Divergence of a parallel flow: Div(f*v)
// Both f and v are interpolated onto cell boundaries
Expand All @@ -173,7 +179,7 @@ const Field3D Div_par(const Field3D &f, const Field3D &v);
*
* Note: For parallel Laplacian use LaplacePar
*/
const Field2D Grad2_par2(const Field2D &f, CELL_LOC outloc=CELL_DEFAULT);
const Field2D Grad2_par2(const Field2D &f, CELL_LOC outloc=CELL_DEFAULT, DIFF_METHOD method=DIFF_DEFAULT);

/*!
* second parallel derivative
Expand All @@ -186,7 +192,7 @@ const Field2D Grad2_par2(const Field2D &f, CELL_LOC outloc=CELL_DEFAULT);
* @param[in] f The field to be differentiated
* @param[in] outloc The cell location of the result
*/
const Field3D Grad2_par2(const Field3D &f, CELL_LOC outloc=CELL_DEFAULT);
const Field3D Grad2_par2(const Field3D &f, CELL_LOC outloc=CELL_DEFAULT, DIFF_METHOD method=DIFF_DEFAULT);

/*!
* Parallel derivatives, converting between cell-centred and lower cell boundary
Expand Down Expand Up @@ -214,10 +220,10 @@ const Field2D Div_par_CtoL(const Field2D &var);
*/
const Field2D Div_par_K_Grad_par(BoutReal kY, const Field2D &f, CELL_LOC outloc=CELL_DEFAULT);
const Field3D Div_par_K_Grad_par(BoutReal kY, const Field3D &f, CELL_LOC outloc=CELL_DEFAULT);
const Field2D Div_par_K_Grad_par(const Field2D &kY, const Field2D &f, CELL_LOC outloc=CELL_DEFAULT);
const Field3D Div_par_K_Grad_par(const Field2D &kY, const Field3D &f, CELL_LOC outloc=CELL_DEFAULT);
const Field3D Div_par_K_Grad_par(const Field3D &kY, const Field2D &f, CELL_LOC outloc=CELL_DEFAULT);
const Field3D Div_par_K_Grad_par(const Field3D &kY, const Field3D &f, CELL_LOC outloc=CELL_DEFAULT);
const Field2D Div_par_K_Grad_par(const Field2D &kY, const Field2D &f, CELL_LOC outloc=CELL_DEFAULT, DIFF_METHOD method=DIFF_DEFAULT);
const Field3D Div_par_K_Grad_par(const Field2D &kY, const Field3D &f, CELL_LOC outloc=CELL_DEFAULT, DIFF_METHOD method=DIFF_DEFAULT);
const Field3D Div_par_K_Grad_par(const Field3D &kY, const Field2D &f, CELL_LOC outloc=CELL_DEFAULT, DIFF_METHOD method=DIFF_DEFAULT);
const Field3D Div_par_K_Grad_par(const Field3D &kY, const Field3D &f, CELL_LOC outloc=CELL_DEFAULT, DIFF_METHOD method=DIFF_DEFAULT);

/*!
* Perpendicular Laplacian operator
Expand Down
4 changes: 4 additions & 0 deletions include/field2d.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,10 @@ class Field2D : public Field, public FieldData {
*/
const IndexRange DEPRECATED(region(REGION rgn)) const override;

/// Return a Region<Ind2D> reference to use to iterate over this field
const Region<Ind2D>& getRegion(REGION region) const;
const Region<Ind2D>& getRegion(const std::string &region_name) const;

BoutReal& operator[](const Ind2D &d) {
return data[d.ind];
}
Expand Down
4 changes: 4 additions & 0 deletions include/field3d.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,10 @@ class Field3D : public Field, public FieldData {
*/
const IndexRange DEPRECATED(region2D(REGION rgn)) const;

/// Return a Region<Ind3D> reference to use to iterate over this field
const Region<Ind3D>& getRegion(REGION region) const;
const Region<Ind3D>& getRegion(const std::string &region_name) const;

/*!
* Direct data access using DataIterator object.
* This uses operator(x,y,z) so checks will only be
Expand Down
11 changes: 10 additions & 1 deletion include/field_data.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,20 @@ class FieldVisitor;
*/
class FieldData {
public:
FieldData();
FieldData(Mesh* m);
virtual ~FieldData();

// Visitor pattern support
virtual void accept(FieldVisitor &v) = 0;

virtual Mesh * getDataMesh() const{
if (fielddatamesh){
return fielddatamesh;
} else {
return mesh;
}
}

// Defines interface which must be implemented
virtual bool isReal() const = 0; ///< Returns true if field consists of BoutReal values
virtual bool is3D() const = 0; ///< True if variable is 3D
Expand All @@ -92,6 +100,7 @@ public:
FieldGeneratorPtr getBndryGenerator(BndryLoc location);

protected:
Mesh* fielddatamesh;
vector<BoundaryOp *> bndry_op; ///< Boundary conditions
bool boundaryIsCopy; ///< True if bndry_op is a copy
bool boundaryIsSet; ///< Set to true when setBoundary called
Expand Down
4 changes: 4 additions & 0 deletions include/fieldperp.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@ class FieldPerp : public Field {

const IndexRange DEPRECATED(region(REGION rgn)) const override;

/// Return a Region<IndPerp> reference to use to iterate over this field
const Region<IndPerp>& getRegion(REGION region) const;
const Region<IndPerp>& getRegion(const std::string &region_name) const;

/*!
* Direct data access using DataIterator indexing
*/
Expand Down
Loading