Commit Graph

59 Commits

Author SHA1 Message Date
Vaggelis Papoutsis
47575aabf2 COMP: compilation with clang (c++17) and older flex files (fixes #3337)
- The register keyword has been removed from c++17 but old flex
  versions (version < 2.6.0) produce code including it, leading to
  compilation errors when using clang (despite disabling the diagnostic).
  gcc compiles but issues warnings.

- use '#define register' as empty as a workaround
2025-03-17 09:58:20 +01:00
Mark Olesen
b98f53ceca ENH: make ITstream positioning methods noexcept
ENH: add rank() method for compound tokens

ENH: add IOstream::minPrecision(unsigned)

- reduced typing, more expressive, no namespace ambiguity with max()

    new: IOstream::minPrecision(10);
    old: IOstream::defaultPrecision(max(10u, IOstream::defaultPrecision()));

STYLE: namespace qualify min/max for some buffer sizing [clang/hipp]
2024-03-06 11:01:57 +01:00
Mark Olesen
f2d634c49f ENH: cellShape::reset() - simplifies modification of existing shapes 2021-05-30 21:02:59 +02:00
Mark Olesen
b060378dca ENH: improve consistency of fileName handling windows/non-windows (#2057)
- wrap command-line retrieval of fileName with an implicit validate.

  Instead of this:
      fileName input(args[1]);
      fileName other(args["someopt"]);

  Now use this:
      auto input = args.get<fileName>(1);
      auto other = args.get<fileName>("someopt");

  which adds a fileName::validate on the inputs

  Because of how it is implemented, it will automatically also apply
  to argList getOrDefault<fileName>, readIfPresent<fileName> etc.

- adjust fileName::validate and clean to handle backslash conversion.
  This makes it easier to ensure that path names arising from MS-Windows
  are consistently handled internally.

- dictionarySearch: now check for initial '/' directly instead of
  relying on fileName isAbsolute(), which now does more things

BREAKING: remove fileName::clean() const method

- relying on const/non-const to control the behaviour (inplace change
  or return a copy) is too fragile and the const version was
  almost never used.

  Replace:
      fileName sanitized = constPath.clean();

  With:
      fileName sanitized(constPath);
      sanitized.clean());

STYLE: test empty() instead of comparing with fileName::null
2021-04-19 16:33:42 +00:00
Mark Olesen
31b172217c ENH: support predicate checks for argList (similar to dictionary methods)
- Favour use of argList methods that are more similar to dictionary
  method names with the aim of reducing the cognitive load.

  * Silently deprecate two-parameter get() method in favour of the
    more familiar getOrDefault.
  * Silently deprecate opt() method in favour of get()

  These may be verbosely deprecated in future versions.
2020-06-02 13:51:18 +02:00
Mark Olesen
f0be8679f6 ENH: provide defaultName() static method for patches, zones
- consistent way of writing "patch" + Foam::name(id) etc.
2020-01-16 13:24:23 +01:00
Mark Olesen
1310e85225 ENH: support 'get()' for retrieving argList options
- previously only had 'opt<..>()' for options, but 'get<..>()'
  provides more similarity with dictionary methods.
  The 'opt<..>()' method is retained.
2019-11-26 21:07:11 +01:00
OpenFOAM bot
e9219558d7 GIT: Header file updates 2019-10-31 14:48:44 +00:00
OpenFOAM bot
154029ddd0 BOT: Cleaned up header files 2019-02-06 12:28:23 +00:00
Mark Olesen
14a404170b ENH: for-range, forAllIters() ... in applications/utilities
- reduced clutter when iterating over containers
2019-01-07 09:20:51 +01:00
Mark Olesen
74d9dc3f50 BUG: polyMesh constructor AUTO_WRITE flag, ignored readOpt (#1147)
- fixed some more places with an explicit AUTO_WRITE.

BUG: revert handling of the readOption. It should not be NO_READ.

  In cases where the user a IOobject without specifying read/write, it
  defaults to NO_READ anyhow. However, the move constructor can also
  be called with empty lists and a read option. This has the same
  signature, but obviously will not work with NO_READ.
2019-01-07 22:23:19 +01:00
Mark Olesen
1d85fecf4d ENH: use Zero when zero-initializing types
- makes the intent clearer and avoids the need for additional
  constructor casting. Eg,

      labelList(10, Zero)    vs.  labelList(10, 0)
      scalarField(10, Zero)  vs.  scalarField(10, scalar(0))
      vectorField(10, Zero)  vs.  vectorField(10, vector::zero)
2018-12-11 23:50:15 +01:00
Mark Olesen
29a5793b5b STYLE: argList::opt method instead of the longer argList::lookupOrDefault
- also replaced a few instances of readIfPresent with opt<> for
  constant values.
2018-12-12 12:10:39 +01:00
Mark Olesen
68ec561df8 STYLE: add usage notes to more utilities and solvers 2018-12-11 15:25:27 +01:00
Mark Olesen
ae36f5f504 ENH: change argList get<> and getList<> from read<>, readList<>
- more consistent with dictionary method naming. The get<> or
  getList<> returns a value, doesn't read into a existing location.
2018-08-09 11:27:36 +02:00
Mark Olesen
cb919a6c41 ENH: tag some options as 'advanced' (only shown with -help-full)
General:
    * -roots, -hostRoots, -fileHandler

Specific:
    * -to <coordinateSystem> -from <coordinateSystem>

- Display -help-compat when compatibility or ignored options are available

STYLE: capitalization of options text
2018-07-31 11:54:15 +02:00
Mark Olesen
3d608bf06a ENH: remove reliance on the Xfer class (issue #639)
This class is largely a pre-C++11 holdover. It is now possible to
simply use move construct/assignment directly.

In a few rare cases (eg, polyMesh::resetPrimitives) it has been
replaced by an autoPtr.
2018-03-05 13:28:53 +01:00
Mark Olesen
1b9aec2a3d CONP: suppress register warnings for clang only 2018-01-30 06:49:32 +01:00
Mark Olesen
e13f8a38a9 COMP: suppress warning about deprecated register keyword (Flex) 2018-01-29 09:13:28 +01:00
Mark Olesen
345a2a42f1 ENH: simplify method names for reading argList options and arguments
- use succincter method names that more closely resemble dictionary
  and HashTable method names. This improves method name consistency
  between classes and also requires less typing effort:

    args.found(optName)        vs.  args.optionFound(optName)
    args.readIfPresent(..)     vs.  args.optionReadIfPresent(..)
    ...
    args.opt<scalar>(optName)  vs.  args.optionRead<scalar>(optName)
    args.read<scalar>(index)   vs.  args.argRead<scalar>(index)

- the older method names forms have been retained for code compatibility,
  but are now deprecated
2018-01-08 15:35:18 +01:00
Mark Olesen
16db44b67d STYLE: add flex major version in '#if' conditional 2017-12-17 16:22:39 +01:00
Mark Olesen
f2ba618c19 STYLE: consistency in using argList::addArgument, argList::addOption 2017-11-22 12:54:28 +01:00
Mark Olesen
a59c87d5ac ENH: improved zone constructors
- constructor for empty cell/face/point Zones, with contents to be
  transferred in later.

- ZoneMesh::operator(const word&) to return existing zone or a new empty one.
2017-11-10 02:09:37 +01:00
Mark Olesen
8730a7622a ENH: enumerations for known cell models in cellModel, ptr/ref lookups
- this provides a better typesafe means of locating predefined cell
  models than relying on strings. The lookup is now ptr() or ref()
  directly. The lookup functions behave like on-demand singletons when
  loading "etc/cellModels".

  Functionality is now located entirely in cellModel but a forwarding
  version of cellModeller is provided for API (but not ABI) compatibility
  with older existing user code.

STYLE: use constexpr for cellMatcher constants
2017-11-18 11:05:05 +01:00
Mark Olesen
86ef9e86dc ENH: make treatment of stream allocators more uniform (issue #532)
- use allocator class to wrap the stream pointers instead of passing
  them into ISstream, OSstream and using a dynamic cast to delete
  then. This is especially important if we will have a bidirectional
  stream (can't delete twice!).

STYLE:

- file stream constructors with std::string (C++11)

- for rewind, explicit about in|out direction. This is not currently
  important, but avoids surprises with any future bidirectional access.

- combined string streams in StringStream.H header.
  Similar to <sstream> include that has both input and output string
  streams.
2017-07-17 15:14:38 +02:00
Mark Olesen
a32a915d2e BUG: polyMesh removeFiles side-effect for blockMesh viewer (issue #346)
- polyMesh constructor from cell shapes invoked 'removeFiles'.
  This may or may not be what the caller wants or expects.
  With the ParaView blockMesh viewer, this behaviour causes deletion of
  all mesh data (points, faces, etc) when the viewer is refreshed.

  Triggered even when just building the blockMesh topology.

- only a few places that construct a polyMesh from cell shapes
  (mostly mesh conversion utilities).
  Ensure that the file removal (if any) occurs in the application
  and *not* as a side-effect of calling the polyMesh constructor.

--

  blockMesh (application)
    - The placement of the removeFiles seems to also remove freshly
      generated sets (Bug or feature to remove sets?)

  +-----------------------+---------------+------------------+
  | Application           | Constructor   | removeFiles      |
  |                       | (patch info)  | new / existing   |
  +-----------------------+---------------+------------------+
  | blockMesh             | dictionary    | existing         |
  | ansysToFoam           | names         | new              |
  | cfx4ToFoam            | dictionary    | new              |
  | fluentMeshToFoam      | names         | new              |
  | gambitToFoam          | dictionary    | new              |
  | gmshToFoam            | names         | new              |
  | ideasUnvToFoam        | names         | new              |
  | kivaToFoam            | dictionary    | new              |
  | mshToFoam             | names         | new              |
  | netgenNeutralToFoam   | names         | new              |
  | plot3dToFoam          | names         | new              |
  | tetgenToFoam          | names         | new              |
  | vtkUnstructuredToFoam | names         | new              |
  +-----------------------+---------------+------------------+
2016-12-15 19:07:05 +01:00
Andrew Heather
9fbd612672 GIT: Initial state after latest Foundation merge 2016-09-20 14:49:08 +01:00
Henry Weller
b16756115a Remove/replace deprecated functions and classes 2016-06-20 09:39:02 +01:00
Henry Weller
43beb06018 Standardized cell, patch and face loop index names 2016-04-25 10:28:32 +01:00
Henry Weller
2d5ff31649 boundaryField() -> boundaryFieldRef() 2016-04-24 22:07:37 +01:00
Andrew Heather
efb39a8790 ENH: (further) Doxygen documentation updates for module support 2016-06-27 20:34:19 +01:00
Henry Weller
1896599d8b Add support for flex-2.6
Resolves bug-report http://www.openfoam.org/mantisbt/view.php?id=1974
2016-01-18 19:44:38 +00:00
Henry Weller
56fa7c0906 Update code to use the simpler C++11 template syntax removing spaces between closing ">"s 2016-01-10 22:41:16 +00:00
Henry Weller
e2ef006b91 applications: Update ...ErrorIn -> ...ErrorInFunction
Avoids the clutter and maintenance effort associated with providing the
function signature string.
2015-11-10 17:53:31 +00:00
Henry
c778346c96 Formatting: Rationalized the indentation of #include 2015-02-10 20:35:50 +00:00
mattijs
41650787b1 ENH: mesh tools: max write precision 2013-10-29 09:59:21 +00:00
Henry
c2dd153a14 Copyright transfered to the OpenFOAM Foundation 2011-08-14 12:17:30 +01:00
andy
eaef8d482b STYLE: Updated 1991 start copyright year to 2004 2011-01-14 16:08:00 +00:00
andy
099cc39e2e Revert "STYLE: 2011 copyright date."
This reverts commit b18f6cc1ce.
2011-01-05 18:24:29 +00:00
graham
b18f6cc1ce STYLE: 2011 copyright date. 2011-01-05 11:14:26 +00:00
mattijs
d820925462 ENH: preservePatchTypes preserves whole patch dictionary, not just type. 2010-10-13 11:05:29 +01:00
mattijs
8859694c9e BUG: tet numbering. 2010-10-11 11:15:05 +01:00
mattijs
4e8f36a98a ENH: allow cell zone and face zone definition 2010-09-16 17:13:53 +01:00
Mark Olesen
147fa2a75d STYLE: add notes to some (most) command-line options
- mapFields and splitMeshRegions need more clarification
2010-04-27 10:50:15 +02:00
Mark Olesen
a50f01b079 STYLE: use forAllIter, forAllConstIter instead of long-hand version
STYLE: use 'forAll(' NOT 'forAll (', as per coding guide
2010-04-12 11:18:38 +02:00
Mark Olesen
d29c438657 STYLE: use url for FSF license instead of postal address, switch to GPL v3 2010-03-29 14:07:56 +02:00
Mark Olesen
f2f2f60cf5 STYLE: remove unused cruft from flex-based lexers 2010-02-25 16:18:34 +01:00
Mark Olesen
d857d671ac STYLE: use new argList argRead() method and operator[] for cleaner code.
- deprecate argList::additionalArgs() method and remove uses of it
2010-02-16 17:57:49 +01:00
Mark Olesen
58b7e64185 Use argList::addOption, argList::addBoolOption (almost) everywhere
- ensure that the standard options (eg, from timeSelector) also have
  some usage information
2009-12-03 13:32:12 +01:00
Mark Olesen
909e6b27e4 Apply coding style recommendations:
- space between keyword and bracket in 'for(..)', 'if(..)', 'while(..)'
2009-11-30 08:55:03 +01:00