Commit Graph

166 Commits

Author SHA1 Message Date
Mark Olesen
0ed0856593 COMP: avoid Istream/List operator() ambiguity (gcc-4.8.5)
- introduced UList<bool>::operator()(label) as part of bf0b3d8872
  but with gcc-4.8.5 this participates in operator resolution even
  for non-bool lists!!
  Partial revert until this predicate handling is really required.
2022-05-11 08:57:05 +02:00
Mark Olesen
ba8d6bddcc ENH: use singleton method for accessing runtime selection
STYLE: use alias to mark partialFaceAreaWeightAMI deprecation after v2012
2021-11-05 17:21:27 +01:00
Mark Olesen
7c494a6b64 ENH: accept quoted surface names in surfaceFeatureExtract (#2071)
- allows use of surface names starting with a digit
  (by quoting the name).

  User is responsible for not generating bad names for output files.
  Eg "bad.**.name", since these will be difficult to handle from the
  shell
2021-04-23 11:40:29 +02:00
Mark Olesen
12c91b9472 STYLE: check autoPtr as plain bool instead of valid()
- cleaner code, more similarity with unique_ptr

  Now
      if (ptr)
      if (!ptr)

  instead
      if (ptr.valid())
      if (!ptr.valid())
2020-07-16 11:39:24 +02:00
Mark Olesen
9af3f85cf9 STYLE: simplify short-circuit involving autoPtr (#1775)
- with '&&' conditions, often better to check for non-null autoPtr
  first (it is cheap)

- check as bool instead of valid() method for cleaner code, especially
  when the wrapped item itself has a valid/empty or good.
  Also when handling multiple checks.

  Now
      if (ptr && ptr->valid())
      if (ptr1 || ptr2)

  instead
      if (ptr.valid() && ptr->valid())
      if (ptr1.valid() || ptr2.valid())
2020-07-16 10:17:25 +02:00
Mark Olesen
3e43edf056 ENH: unify use of dictionary method names
- previously introduced `getOrDefault` as a dictionary _get_ method,
  now complete the transition and use it everywhere instead of
  `lookupOrDefault`. This avoids mixed usage of the two methods that
  are identical in behaviour, makes for shorter names, and promotes
  the distinction between "lookup" access (ie, return a token stream,
  locate and return an entry) and "get" access (ie, the above with
  conversion to concrete types such as scalar, label etc).
2020-06-02 17:26:03 +02:00
Mark Olesen
f721b5344f ENH: report dictionary name actually used (for -dict option) 2020-06-02 14:29:36 +02:00
Mark Olesen
bb53e8adb3 ENH: adjustments to Switch
- align Switch more with Enum.
  Now have find(), found() static methods.
  Constructors with failsafe option.

  The find() method makes for clearer coding:

  OLD

     Switch sw(some_string, true); // NB: true = allowBad

     if (sw.valid()) ...

  NOW

     Switch sw = Switch::find(some_string);

     if (sw.good()) ...

  or

     if (Switch::found(some_string)) ...

- improve construct from dictionary to handle all valid token types.
  Previously just read in a word.

- Remove asText() method - replaced by c_str() and str() several
  versions ago.
2020-02-18 21:51:35 +01:00
Mark Olesen
98467036b3 STYLE: regularize quoting and exit on failed 'cd' 2019-11-13 13:19:16 +01:00
Mark Olesen
ec7e3c88e4 ENH: test for WM_PROJECT_DIR being set/unset in scripts 2019-11-06 09:18:51 +01:00
Andrew Heather
fdf8d10ab4 Merge commit 'e9219558d7' into develop-v1906 2019-12-05 11:47:19 +00:00
OpenFOAM bot
e9219558d7 GIT: Header file updates 2019-10-31 14:48:44 +00:00
Mark Olesen
fb09f56aba ENH: use FatalErrorInLookup macros (#1362) 2019-07-12 18:00:00 +02:00
Mark Olesen
beefee48d4 COMP: adjust compilation order with updated interdependencies
- Eg, with surface writers now in surfMesh, there are fewer libraries
  depending on conversion and sampling.

COMP: regularize linkage ordering and avoid some implicit linkage (#1238)
2019-04-28 14:44:33 +02:00
OpenFOAM bot
154029ddd0 BOT: Cleaned up header files 2019-02-06 12:28:23 +00:00
Mark Olesen
3b91160027 STYLE: centralize example dictionaries under etc/ (issue #1074)
- as well as being more convenient to find, this is necessary when the
  OpenFOAM installation is without sources or tutorials
2019-01-26 17:46:08 +01: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
Andrew Heather
9231534efa STYLE: Updating version to v1812 2018-12-19 18:07:52 +00:00
Mark Olesen
455c8ef540 ENH: simplify use of case-relative paths
- provide relativePath() for argList and for Time.
  These are relative to the case globalPath().
  Eg,

     Info<< "output: " << runTime.relativePath(outputFile) << nl;
2018-12-15 13:26:55 +01:00
Mark Olesen
0d29257a6d STYLE: use vtk::surfaceWriter instead of sampleSurface version 2018-10-16 14:49:56 +02:00
Mark Olesen
91cfe4c271 ENH: add wordRes::matching() method
- returns indices of matching entries.
2018-11-09 21:21:15 +01:00
Mark Olesen
a7a346b206 STYLE: indentation for FatalIOErrorInFunction calls 2018-11-06 09:49:22 +01:00
Mark Olesen
07dafe7b0b STYLE: use range-for when looping dictionary entries.
- as part of the cleanup of dictionary access methods (c6520033c9)
  made the dictionary class single inheritance from IDLList<entry>.

  This eliminates any ambiguities for iterators and allows
  for simple use of range-for looping.

  Eg,
      for (const entry& e : topDict))
      {
          Info<< "entry:" << e.keyword() << " is dict:" << e.isDict() << nl;
      }

   vs

      forAllConstIter(dictionary, topDict, iter))
      {
          Info<< "entry:" << iter().keyword()
              << " is dict:" << iter().isDict() << nl;
      }
2018-10-19 13:08:24 +02:00
Mark Olesen
4e04c1966f ENH: use dictionary::get<word>() instead of lookup() in a few places 2018-10-19 09:11:31 +02:00
Mark Olesen
13778f7647 ENH: use dictionary::readEntry for detection of input errors (#762, #1033)
- instead of   dict.lookup(name) >> val;
  can use      dict.readEntry(name, val);

  for checking of input token sizes.
  This helps catch certain types of input errors:

  {

      key1 ;                // <- Missing value
      key2 1234             // <- Missing ';' terminator
      key3 val;
  }

STYLE: readIfPresent() instead of 'if found ...' in a few more places.
2018-10-05 10:15:13 +02:00
Mark Olesen
e0f83938ee ENH: ignore -noFunctionObjects option when disabled
- With argList::noFunctionObjects() we use the logic added in
  4b93333292 (issue #352)

  By removing the '-noFunctionObjects' option, we automatically
  suppress the creation of function-objects via Time (with argList
  as a parameter).
  There is generally no need in these cases for an additional

      runTime.functionObjects().off()  statement

  Use the argList::noFunctionObjects() for more direct configuration
  and reduce unnecessary clutter in the -help information.

  In previous versions, the -noFunctionObjects would have been redundant
  anyhow, so we can also just ignore it now instead.
2018-08-08 09:44:28 +02:00
Mark Olesen
de2eed3e7d ENH: additional methods and improvements to plane
- signedDistance() method is like distance() but retains
  the positive/negative sign for the side of the plane.

- the sign() method returns the sign as -1,0,+1 integer for
  classification purposes where it is important to distinguish between
  a zero value and a positive value (eg, for cutting). Optional
  tolerance can be supplied to round for zero.

- refactor and inlined simple and frequently used methods.

- add boundBox faceCentre() method, which can be useful for creating
  clipping planes from a bounding box.
  Relocated treeBoundBox faceNormals to boundBox since they apply
  equally there - the meaning of the faces (x-min, x-max, etc)
  is the same, even if the point addressing for the faces differs.
2018-08-03 23:17:49 +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
a592ebc073 STYLE: avoid unrestricted dictionary lookup in conversion, sampling, surfMesh
- aids with detection of excess tokens (issue #762)

- deprecated dictionary::operator[] in favour of the lookup() method
  which offers more flexibilty and clarity of purpose.
  Additionally, the read<> and get<> forms should generally be used
  instead anyhow.
2018-07-18 13:33:00 +02:00
Andrew Heather
6e35bcda70 ENH: Updated config for release v1806 2018-06-28 12:56:00 +01:00
mattijs
d469bbae4b COMP: Allwmake: feed through 'objects' targer for wmakeCollect 2018-05-17 08:39:57 +01:00
Mark Olesen
dd8341f659 ENH: make format of ExecutionTime = ... output configurable (issue #788)
- controlled by the the 'printExecutionFormat' InfoSwitch in
  etc/controlDict

      // Style for "ExecutionTime = " output
      // - 0 = seconds (with trailing 's')
      // - 1 = day-hh:mm:ss

   ExecutionTime = 112135.2 s  ClockTime = 113017 s

   ExecutionTime = 1-07:08:55.20  ClockTime = 1-07:23:37

- Callable via the new Time::printExecutionTime() method,
  which also helps to reduce clutter in the applications.
  Eg,

     runTime.printExecutionTime(Info);

  vs

     Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
         << "  ClockTime = " << runTime.elapsedClockTime() << " s"
         << nl << endl;

--

ENH: return elapsedClockTime() and clockTimeIncrement as double

- previously returned as time_t, which is less portable.
2018-04-27 15:00:34 +02:00
Mark Olesen
b4d38ab468 ENH: improve handling of ThirdParty packages
- generalize some of the library extensions (.so vs .dylib).
  Provide as wmake 'sysFunctions'

- added note about unsupported/incomplete system support

- centralize detection of ThirdParty packages into wmake/ subdirectory
  by providing a series of scripts in the spirit of GNU autoconfig.
  For example,

      have_boost, have_readline, have_scotch, ...

  Each of the `have_<package>` scripts will generally provide the
  following type of functions:

      have_<package>          # detection
      no_<package>            # reset
      echo_<package>          # echoing

  and the following type of variables:

      HAVE_<package>          # unset or 'true'
      <package>_ARCH_PATH     # root for <package>
      <package>_INC_DIR       # include directory for <package>
      <package>_LIB_DIR       # library directory for <package>

  This simplifies the calling scripts:

      if have_metis
      then
          wmake metisDecomp
      fi

  As well as reducing clutter in the corresponding Make/options:

      EXE_INC = \
          -I$(METIS_INC_DIR) \
          -I../decompositionMethods/lnInclude

      LIB_LIBS = \
          -L$(METIS_LIB_DIR) -lmetis

  Any additional modifications (platform-specific or for an external build
  system) can now be made centrally.
2018-04-24 14:51:19 +02:00
Mark Olesen
36719bf55b STYLE: consistent lookupOrDefault template parameters
- in many cases can just use lookupOrDefault("key", bool) instead of
  lookupOrDefault<bool> or lookupOrDefault<Switch> since reading a
  bool from an Istream uses the Switch(Istream&) anyhow

STYLE: relocated Switch string names into file-local scope
2018-03-26 09:09:09 +02:00
Mark Olesen
57291e8692 STYLE: use autoPtr::New and tmp::New for simple return types 2018-02-26 14:00:30 +01:00
Mark Olesen
53ab527b45 ENH: added constexpr, noexcept for bool, Switch
- rationalized some method naming.
  Eg, c_str() instead of asText()
2018-03-03 20:32:49 +01:00
Mark Olesen
f76552f7f9 STYLE: rebase edge on labelPair, additional methods in Pair
- use FixedList first/last in Pair first/second

- consistent first/second access for line
2017-10-06 20:10:49 +02:00
Mark Olesen
139edb2468 ENH: add input surface scaling (issue #514)
- surfaceFeatureExtract
  * dictionary "scale" entry

- triSurface
- triSurfaceLoader
  * optional scaleFactor on reading

- surfaceAdd
- surfaceBooleanFeatures
- surfaceClean
- surfaceCoarsen
  * scale option

- surfaceTransformPoints, transformPoints
  * scale option as scalar or vector quantity
2017-08-14 09:18:15 +02:00
Mark Olesen
b5f091e74f BUG: incorrect indexing for surface baffles (fixes #497) 2017-06-16 09:37:43 +02:00
Mark Olesen
a4b826aa1e STYLE: fix comments 2017-06-01 16:38:48 +02:00
Mark Olesen
b312f0ba40 ENH: documentation and input simplification for surfaceFeatureExtract 2017-06-01 15:46:42 +02:00
Mark Olesen
dfafe6075a ENH: region-wise self intersection for surfaceFeatureExtract (issue #450) 2017-05-29 18:57:25 +02:00
Mark Olesen
034ddfa78f ENH: make coeffs dictionaries optional for surfaceFeatureExtract 2017-05-10 14:11:28 +02:00
Mark Olesen
0e7630feca ENH: improved handling of 'unresolved' surface intersections (issue #450)
- the heuristic for matching unresolved intersections is a relatively
  simple matching scheme that seems to be more robust than attempting to walk
  the geometry or the cuts.

- avoid false positives for self intersection
2017-05-08 14:57:47 +02:00
Mark Olesen
da8ea0f21a ENH: refactor code from surfaceFeatureExtract to triSurfaceTools (issue #450) 2017-04-28 09:12:33 +02:00
Mark Olesen
11c5456628 ENH: improvements for surfaceIntersection (issue #450)
- adjust for updates in 'develop'

- change surfaceIntersection constructor to take a dictionary of
  options.

        tolerance      | Edge-length tolerance          | scalar | 1e-3
        allowEdgeHits  | Edge-end cuts another edge     | bool   | true
        avoidDuplicates | Reduce the number of duplicate points    | bool | true
        warnDegenerate | Number of warnings about degenerate edges | label | 0
2017-04-28 08:49:45 +02:00
Mark Olesen
cd5ca147a7 ENH: multiple surfaces, self-intersection in surfaceFeatureExtract (issue #450)
- If the dictionary is named 'surfaces', a 'surfaces' entry is mandatory.
  This is a list of wordRe, which is used to load multiple surfaces from
  constant/triSurface directory.

- Other dictionaries may contain a 'surfaces' entry.
  In which case the behaviour is as above (loading multiple surfaces).
  The dictionary name will *NOT* be taken as a surface name itself.

- Regardless of how the surfaces are loaded or features extracted,
  an additional selfIntersection test may be used.

  Eg,

    surfaces
    {
        extractionMethod    extractFromSurface;

        surfaces            (surface1.stl surface2.nas);

        // Generate features from self-intersect
        selfIntersection    true;

        // Base output name (optiona)
        output              surfaces;

        // Tolerance for self-intersect
        planarTolerance     1e-3;

        extractFromSurfaceCoeffs
        {
            includedAngle   120;

            // Do not mark region edges
            geometricTestOnly       yes;
        }
    }
2017-04-11 11:46:00 +02:00
Mark Olesen
3814762785 ENH: relocate triSurface classes into surfMesh library (issue #294)
- simplifies organization, includes, linkage etc.
2017-05-18 10:42:05 +02:00
Andrew Heather
2e9bead519 MRG: merged develop line back into integration branch 2017-05-18 11:11:12 +01:00
Andrew Heather
91b90da4f3 Integrated Foundation code to commit 104aac5 2017-05-17 16:35:18 +01:00