Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
84 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
bdd81a1
Use input field/vector location for CELL_DEFAULT in vecops
ZedThree Oct 3, 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
291b9f6
Ensure CELL_DEFAULT and CELL_VSHIFT are forbidden in calls to
d7919 Oct 9, 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
791ebc7
Add ASSERTs for checking requested location is unambigous/consistent.
d7919 Oct 9, 2018
5a079d4
Ensure Vector copy and assignment copies the location
d7919 Oct 9, 2018
2f39306
Expand unit tests to check that vector copy/assignment copies location
d7919 Oct 10, 2018
b3b756e
Handle CELL_DEFAULT in vector setLocation
d7919 Oct 10, 2018
04f0eca
Add unit tests for vector setLocation
d7919 Oct 10, 2018
96dc8ab
Fix for vector non-staggered setLocation unit tests
d7919 Oct 10, 2018
ba80a08
Add staggered flag check in vector setLocation
d7919 Oct 10, 2018
546ca78
Remove duplicated ASSERT
d7919 Oct 10, 2018
8c571e9
Remove setLocation calls that are not required
d7919 Oct 10, 2018
fce307d
Improvements after feedback
dschwoerer Oct 10, 2018
1c4f9b9
Adding support for CELL_VSHIFT to Grad(Field2D)
d7919 Oct 10, 2018
83d6b82
Deprecating three arg version of Grad(Field3D)
d7919 Oct 10, 2018
993968c
Ensure Grad_perp only works at location of input field
d7919 Oct 10, 2018
93330d0
Updating treatment of location in Curl. Forbid use of CELL_VSHIFT
d7919 Oct 10, 2018
0669941
Attempt to fix asserts in V_dot_grad
d7919 Oct 10, 2018
db34fd6
Move depecrated into header
d7919 Oct 10, 2018
2c863fa
Clear up language about parallelisation directions
ZedThree Oct 10, 2018
f9ea8ba
Rename Mesh::coordinates -> Mesh::getCoordinates; deprecate old name
ZedThree Oct 10, 2018
a11951c
Adding some Doxygen comments to mention allowed locations
d7919 Oct 10, 2018
23930d1
Merge pull request #1306 from boutproject/bugfixes-from-shiftedmetric…
ZedThree Oct 11, 2018
573b1aa
Remove output location argument from V_dot_Grad
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
7fd82e9
Remove support for CELL_VSHIFT in V_dot_Grad
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
77dd5bb
Merge pull request #1308 from boutproject/vecops-consistent-cell-defa…
d7919 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
8757d9c
Use std::map::emplace to avoid naming complicated type with insert
ZedThree Oct 12, 2018
fce8979
Fix V_dot_Grad documentation
ZedThree Oct 12, 2018
49247a3
Use curly braces with if statements
johnomotani Oct 12, 2018
6ef003f
Set yup/ydown fields for Div_par_flux()
johnomotani Oct 11, 2018
c9acb64
Fix locations of Jacobian in Div
ZedThree Oct 15, 2018
afe353c
Deprecate Curl overloads that take a location
ZedThree Oct 15, 2018
df49dd1
Fix whitespace in vecops header
ZedThree Oct 15, 2018
64e24b7
Remove output location from Curl properly
ZedThree Oct 15, 2018
b34d0cc
Merge pull request #1317 from boutproject/fix-coordsmap-emplace-type
ZedThree Oct 15, 2018
c7014c2
Merge pull request #1293 from boutproject/vecops-consistent-cell-default
ZedThree Oct 15, 2018
20a4cc1
Check TwistShift==true in ShiftedMetric
johnomotani Oct 14, 2018
0d57cb7
Make test-yupdown work with new test for TwistShift=true
johnomotani Oct 15, 2018
0575997
Invert conditional in Div_par and Div_par_flux
johnomotani Oct 15, 2018
f586fbd
Merge pull request #1318 from boutproject/derivatives-more-tidyup
ZedThree Oct 16, 2018
c353ef9
Merge pull request #1323 from boutproject/shiftedmetric-test-twistshi…
ZedThree Oct 16, 2018
69b9455
Merge branch 'v4.2-rc' into rename-mesh-coordinates
ZedThree Oct 16, 2018
7516b23
Merge pull request #1310 from boutproject/rename-mesh-coordinates
ZedThree Oct 16, 2018
3fe02cb
Handle CELL_ZLOW case in boundary_standard.cxx
johnomotani Oct 11, 2018
3657ce8
Remove uses of global mesh from boundary conditions
johnomotani Oct 11, 2018
bfcf30f
Tidy up location checking in boundary_standard.cxx
johnomotani Oct 15, 2018
ea613e1
Make FieldData() backward compatible, no virtual on getDataMesh()
johnomotani Oct 15, 2018
38f4161
Move FieldData::fielddatamesh init into init list
ZedThree Oct 16, 2018
2de6e1d
Check Mesh*'s are the same in Field3D operator=(Field2D)
johnomotani Oct 16, 2018
2f36229
Copy or check fielddatamesh in Field3D/Field2D operator=
johnomotani Oct 16, 2018
df110a0
Check consistency of fieldmesh and fielddatamesh
johnomotani Oct 16, 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
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 examples/bout_runners_example/diffusion_3D.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ int physics_init(bool restarting) {
// The boundary lies (1/2)*dx away from the last point As there
// are 2 boundaries there will effectively add one more line
// segment in the domain. Hence
mesh->coordinates()->dx = Lx/(internal_x_points);
mesh->coordinates()->dy = Ly/(internal_y_points);
mesh->getCoordinates()->dx = Lx/(internal_x_points);
mesh->getCoordinates()->dy = Ly/(internal_y_points);
}
// ************************************************************************

Expand Down
2 changes: 1 addition & 1 deletion examples/laplacexy/alfven-wave/alfven.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ class Alfven : public PhysicsModel {
Field2D Rxy, Bpxy, Btxy, hthe, sinty;
GRID_LOAD5(Rxy, Bpxy, Btxy, hthe, sinty); // Load metrics

Coordinates *coord = mesh->coordinates(); // Metric tensor
Coordinates *coord = mesh->getCoordinates(); // Metric tensor

// Checking for dpsi and qinty used in BOUT grids
Field2D dx;
Expand Down
2 changes: 1 addition & 1 deletion examples/laplacexy/laplace_perp/test.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ int main(int argc, char** argv) {
mesh->get(hthe, "hthe"); // m
mesh->get(I, "sinty");// m^-2 T^-1

Coordinates *coord = mesh->coordinates();
Coordinates *coord = mesh->getCoordinates();

// Calculate metrics
coord->g11 = SQ(Rxy * Bpxy);
Expand Down
2 changes: 1 addition & 1 deletion examples/orszag-tang/mhd.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class MHD : public PhysicsModel {
B.covariant = false; // evolve contravariant components
bout_solve(B, "B");

Coordinates *coord = mesh->coordinates();
Coordinates *coord = mesh->getCoordinates();
output.write("dx[0,0] = %e, dy[0,0] = %e, dz = %e\n", coord->dx(0, 0),
coord->dy(0, 0), coord->dz);

Expand Down
2 changes: 1 addition & 1 deletion examples/tokamak-2fluid/2fluid.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ class TwoFluid : public PhysicsModel {
Field2D I; // Shear factor

// Get the coordinate system
coord = mesh->coordinates();
coord = mesh->getCoordinates();

output.write("Solving 6-variable 2-fluid equations\n");

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
21 changes: 13 additions & 8 deletions include/bout/mesh.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -430,20 +430,25 @@ class Mesh {
bool IncIntShear; ///< Include integrated shear (if shifting X)

/// Coordinate system
Coordinates *coordinates(const CELL_LOC location = CELL_CENTRE) {
Coordinates *getCoordinates(const CELL_LOC location = CELL_CENTRE) {
ASSERT1(location != CELL_DEFAULT);
ASSERT1(location != CELL_VSHIFT);

if (coords_map.count(location)) { // True branch most common, returns immediately
return coords_map[location].get();
} else if (location == CELL_DEFAULT) {
throw BoutException("Ambiguous location 'CELL_DEFAULT' passed to mesh::coordinates");
} else {
// No coordinate system set. Create default
// Note that this can't be allocated here due to incomplete type
// (circular dependency between Mesh and Coordinates)
coords_map.insert(std::pair<CELL_LOC, std::shared_ptr<Coordinates> >(location, createDefaultCoordinates(location)));
coords_map.emplace(location, createDefaultCoordinates(location));
return coords_map[location].get();
}
}

Coordinates *DEPRECATED(coordinates(const CELL_LOC location = CELL_CENTRE)) {
return getCoordinates(location);
}

// First derivatives in index space
// Implemented in src/mesh/index_derivs.hxx

Expand Down Expand Up @@ -650,12 +655,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
4 changes: 2 additions & 2 deletions include/difops.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,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 +186,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
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
16 changes: 14 additions & 2 deletions include/field_data.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,23 @@ class FieldVisitor;
*/
class FieldData {
public:
FieldData();
FieldData(Mesh *datamesh = nullptr)
: fielddatamesh(datamesh != nullptr ? datamesh : mesh), boundaryIsCopy(false),
boundaryIsSet(true) {}

virtual ~FieldData();

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


Mesh *getDataMesh() const {
if (fielddatamesh != nullptr) {
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 +103,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