-
Notifications
You must be signed in to change notification settings - Fork 93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Start to use more forward declarations #1464
base: next
Are you sure you want to change the base?
Changes from all commits
ebe17f5
1b6dbef
45aa4b8
7699551
9c170f7
50457d0
28f3d27
f0c4ecf
a6133a2
4c579dd
5cfd5c7
e5b16fa
041bf0d
13472ee
593198c
6a31166
7ff486e
868d9bc
15dcf5f
c5d37d4
52e72e2
13964c2
8415871
cd6929c
05fdac5
4135a74
469c711
3f61984
baedb7f
f5c6b38
9b33e46
88936fe
0968e10
7f7118d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,44 +38,35 @@ | |
* | ||
**************************************************************************/ | ||
|
||
class Mesh; | ||
|
||
#ifndef __MESH_H__ | ||
#define __MESH_H__ | ||
class Mesh; | ||
|
||
#include "mpi.h" | ||
|
||
#include <bout/deprecated.hxx> | ||
#include <bout/deriv_store.hxx> | ||
#include <bout/index_derivs_interface.hxx> | ||
// The following is relatively expensive to include because it includes mpi.h | ||
#include <boutcomm.hxx> | ||
|
||
#include "field_data.hxx" | ||
#include "bout_types.hxx" | ||
#include "field2d.hxx" | ||
#include "field3d.hxx" | ||
#include "datafile.hxx" | ||
#include "options.hxx" | ||
|
||
#include "fieldgroup.hxx" | ||
|
||
#include "boundary_region.hxx" | ||
#include "parallel_boundary_region.hxx" | ||
|
||
#include "sys/range.hxx" // RangeIterator | ||
|
||
#include <bout/griddata.hxx> | ||
|
||
#include "coordinates.hxx" // Coordinates class | ||
|
||
#include "paralleltransform.hxx" // ParallelTransform class | ||
|
||
#include "unused.hxx" | ||
#include <bout/deprecated.hxx> | ||
#include <bout/index_derivs_interface.hxx> | ||
#include <bout/paralleltransform.hxx> | ||
|
||
class Field3D; | ||
class Field2D; | ||
class RangeIterator; | ||
class Coordinates; | ||
class GridDataSource; | ||
class FieldData; | ||
class Datafile; | ||
class Options; | ||
class BoundaryRegion; | ||
class BoundaryRegionPar; | ||
template <typename T> | ||
class Region; | ||
|
||
#include <bout/region.hxx> | ||
|
||
#include <list> | ||
#include <memory> | ||
#include <map> | ||
#include <string> | ||
|
||
/// Type used to return pointers to handles | ||
typedef void* comm_handle; | ||
|
@@ -451,57 +442,15 @@ class Mesh { | |
|
||
/// Returns the non-CELL_CENTRE location | ||
/// allowed as a staggered location | ||
CELL_LOC getAllowedStaggerLoc(DIRECTION direction) const { | ||
AUTO_TRACE(); | ||
switch (direction) { | ||
case (DIRECTION::X): | ||
return CELL_XLOW; | ||
case (DIRECTION::Y): | ||
case (DIRECTION::YOrthogonal): | ||
case (DIRECTION::YAligned): | ||
return CELL_YLOW; | ||
case (DIRECTION::Z): | ||
return CELL_ZLOW; | ||
default: | ||
throw BoutException("Unhandled direction encountered in getAllowedStaggerLoc"); | ||
} | ||
}; | ||
CELL_LOC getAllowedStaggerLoc(DIRECTION direction) const; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These three functions now can't be inlined -- but it doesn't look like they're used in any tight loops so presumably this isn't that bad There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, this is one of the reasons I think this PR might be more for discussion/experimentation to decide on a policy. I'd prefer runtime performance over compilation performance but there may be places we can get both. |
||
|
||
/// Returns the number of grid points in the | ||
/// particular direction | ||
int getNpoints(DIRECTION direction) const { | ||
AUTO_TRACE(); | ||
switch (direction) { | ||
case (DIRECTION::X): | ||
return LocalNx; | ||
case (DIRECTION::Y): | ||
case (DIRECTION::YOrthogonal): | ||
case (DIRECTION::YAligned): | ||
return LocalNy; | ||
case (DIRECTION::Z): | ||
return LocalNz; | ||
default: | ||
throw BoutException("Unhandled direction encountered in getNpoints"); | ||
} | ||
}; | ||
int getNpoints(DIRECTION direction) const; | ||
|
||
/// Returns the number of guard points in the | ||
/// particular direction | ||
int getNguard(DIRECTION direction) const { | ||
AUTO_TRACE(); | ||
switch (direction) { | ||
case (DIRECTION::X): | ||
return xstart; | ||
case (DIRECTION::Y): | ||
case (DIRECTION::YOrthogonal): | ||
case (DIRECTION::YAligned): | ||
return ystart; | ||
case (DIRECTION::Z): | ||
return 2; | ||
default: | ||
throw BoutException("Unhandled direction encountered in getNguard"); | ||
} | ||
}; | ||
int getNguard(DIRECTION direction) const; | ||
|
||
/////////////////////////////////////////////////////////// | ||
// INDEX DERIVATIVE OPERATORS | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm confused about this... should we use
<>
for system headers and""
for BOUT++ headers?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tend to view
<>
as being something provided by a library (includingbout
) and""
for local files. Or in other words<>
for things in an include path and""
for things that aren't. This is just my interpretation though. I think""
can search more places, but if this is an advantage or a disadvantage may be a matter of opinion.( I should add
""
falls back to<>
if the first (implementation defined) search fails -- in practice I think that means most of our uses of""
fall back to<>
anyway ).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In practice, there is not much difference. The C standard says both are implementation defined, which the exception that
""
explicitly looks for a file and<>
for a header, which might not be a file.For
""
, gcc searches the current directory first, then paths specified with-iquote
, then "a standard list of system paths" which includes those in-I
.For
<>
, gcc searches the system paths only (including those in-I
and-isystem
).I don't think we use
-I.
, so private headers do really need to be""
, while the public ones can be<>
. Beyond that, I think it is a matter of opinion -- but it would be nice to be consistent! As a note, the gcc docs below say to use""
for "your own program" and<>
for "system headers".https://gcc.gnu.org/onlinedocs/cpp/Search-Path.html
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One reason to prefer
""
for all BOUT++ headers: clang-format and include-what-you-use can group headers together, and it might be nice to separate the system headers from ours.