Commit Graph

842 Commits

Author SHA1 Message Date
Mark Olesen
cc5f30f25e ENH: several improvements for linked-lists
- support move construct/assignment for linked-lists themselves
  and when moving into a 'normal' list

- better consistency with begin/end signatures and the various
  iterators.

- for indirect linked-lists, provide iterator access to the underlying
  data element address:   iter.get()  vs  &(iter())

- add standard '->' indirection for iterators (as per normal STL
  definitions)
2017-11-27 14:11:25 +01:00
Mark Olesen
ec38e7a408 ENH: prevent conversion of string to regExp in stringListOps (closes #739)
* For most cases, this conversion would be largely unintentional
  and also less efficient. If the regex is desirable, the caller
  should invoke it explicitly.
  For example,

      findStrings(regExp(str), listOfStrings);

  Or use one of the keyType, wordRe, wordRes variants instead.
  If string is to be used as a plain (non-regex) matcher,
  this can be directly invoked

      findMatchingStrings(str, listOfStrings);

  or using the ListOps instead:

      findIndices(listOfStrings, str);

* provide function interfaces for keyType.
2018-02-22 09:28:03 +01:00
Mark Olesen
f959927910 ENH: improve consistency of ListOps and stringListOps
- subsetList, inplaceSubsetList with optional inverted logic.

- use moveable elements where possible.

- allow optional starting offset for the identity global function.
  Eg,  'identity(10, start)' vs 'identity(10) + start'
2018-02-21 12:58:00 +01:00
Mark Olesen
c126464d1c ENH: change wordRes to be a List of wordRe instead of a wrapper (issue #259)
- this permits direct storage of a list with additional matcher
  capabilities

- provide wordRes::matcher class for similar behaviour as previously
2018-02-21 10:05:30 +01:00
Mark Olesen
03b287ed24 COMP: adjust tests to compile with current code base 2018-02-20 17:24:08 +01:00
Mark Olesen
09a6e94073 BUG: incorrect HashTable / HashSet instances
- Eg instead of using labelHashSet, used HashSet<label> which uses
  the string::hash for hashing. Other places inadvertently using the
  string::hash instead of Hash<label> for hashing.

STYLE: use Map<..> instead of HashTable<.., label, Hash<label>>

- reduces clutter
2018-02-09 09:30:02 +01:00
Mark Olesen
806b668418 STYLE: two-parameter Foam::name replaced by word::printf (issue #724)
- reduces some ambiguity and clarifies the expected output and
  behaviour.

STYLE: reduce some automatic conversions of char to string
2018-02-08 12:00:54 +01:00
Mark Olesen
e42c228155 ENH: cleanup List constructors (issue #725)
- add copy construct from UList

- remove copy construct from dissimilar types.

  This templated constructor was too generous in what it accepted.
  For the special cases where a copy constructor is required with
  a change in the data type, now use the createList factory method,
  which accepts a unary operator. Eg,

      auto scalars = scalarList::createList
      (
          labels,
          [](const label& val){ return 1.5*val; }
      );
2018-02-08 08:53:14 +01:00
Mark Olesen
9bd7ea593e ENH: added fileName::relative() method
- this currently just strips off the leading parent directory name

     "/this/path/and/subdirs/name"

     relative("/this/path")  -> "and/subdirs/name"
     relative("/this")       -> "path/and/subdirs/name"
2018-01-23 18:25:55 +01:00
Mark Olesen
39ee5d5079 ENH: add HashTable += operation (combines HashTables)
- adjust return values of HashSet operators.
2018-01-23 16:35:43 +01:00
Mark Olesen
23c9dd716d ENH: coding cleanup for memory streams
- simplify structure.
- protect against nullptr when resetting memory streams
- make UIListStream swappable
- add uiliststream as an example of using a plain std::istream
2018-01-22 09:42:06 +01:00
Mark Olesen
0a5e4cf1b0 ENH: define stdFoam::min(), stdFoam::max() as constexpr as per C++14 2018-01-19 17:13:03 +01:00
Mark Olesen
12aa2d3c30 ENH: SubStrings::str(int) method for similarity with std::smatch
- define regExp::results_type using SubStrings container for handling
  groups. This makes a later shift to std::smatch easier, but changes
  the regExp API for matching with groups. Previously had list element
  0 for regex group 1, now list element 0 is the entire match and list
  element 1 is regex group 1.

  Old:
      List<std::string> mat;
      if (re.match(text, mat))  Info<< "group 1: " << mat[0] << nl;

  New:
      regExp::results_type mat;
      if (re.match(text, mat))  Info<< "group 1: " << mat.str(1) << nl;
2018-01-17 00:15:36 +01:00
Mark Olesen
adbbd0e678 ENH: add argList option ignoring for compatibility upgrades
- can be used to handle when options become redundant, but it is
  undesirable to treat its presence as an error. Can now tag it as
  being ignored.

     argList::ignoreOptionCompat({"oldOption", 1706}, true);
     argList::ignoreOptionCompat({"oldBoolOpttion", 1706}, false);

     command  -oldOption xyz -oldBoolOpttion
2018-01-08 16:25:27 +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
2feb11dbeb ENH: add testing for directory lister class 2018-01-10 15:01:12 +01:00
Mark Olesen
199dc3376c STYLE: missing comma in Test-decomposePar 2018-01-08 11:57:54 +01:00
Mark Olesen
f55a42a835 ENH: improve robustness of scalarRanges from string (fixes #673)
- now avoid Istream and token mechanism in favour of a simpler string
  parser. This makes the code clearer, smaller, robuster.

- provide convenience ge/gt/le/lt static constructors for scalarRange
  for using bounds directly with specifying via a string parameter.

- scalarRange, scalarRanges now follow the unary predicate pattern
  (using an operator() for testing). This allows their reuse in
  other contexts. Eg, for filtering operations:

      myHash.filterValues(scalarRange::ge(100));

- remove unused scalarRanges methods that were specific to handling
  lists of time values. These were superseded by timeSelector methods
  several versions ago.
2018-01-08 09:59:04 +01:00
Mark Olesen
85eb441bea STYLE: add constexpr to PackedList methods 2018-01-04 19:16:15 +01:00
Mark Olesen
995c55b60e CONFIG: add clang third-party lib to LD_LIBRARY_PATH
- required if there is no system openmp and libomp or libgomp are
  only found in the clang hierarchy

STYLE: add some notes in the openmp rules.

- the _OPENMP macro is now used in low-level testing files
2017-12-19 16:07:15 +01:00
Mark Olesen
00325db33b ENH: additional options for transforming points (closes #660)
- The -rotate-angle option allows convenient specification of a
  rotation about an arbitrary axis. Eg, -rotate-angle '((1 1 1) 45)'

- The -origin option can be used to temporarily shift the origin
  for the rotation operations. For example,

      -origin '(0 0 1)' -rotate-angle '((1 0 0) 180)'

  for mirroring.
2017-12-19 11:24:08 +01:00
Mark Olesen
f38ad72ad0 ENH: add argList::optionCount method
- convenience for checking is any/all particular options have been
  specified. Eg,

  if (args.optionCount({"opt1", "opt2", "opt3"}) < 3) ...
2017-12-19 08:20:45 +01:00
mattijs
ddde330884 ENH: overset: new solvers, new stencil 2017-12-08 16:00:02 +00:00
Mark Olesen
8fc6bd17c9 ENH: improvements in profiling (issue #648)
- include amount of free system memory in profiling, which can give an
  indication of when swapping is about to start

- profilingSummary utility to collect profiling from parallel
  calculations. Collects profiling information from processor
  directories and summarize the time spent and number of calls as (max
  avg min) values.
2017-12-01 15:44:20 +01:00
Mark Olesen
d49929b210 ENH: improvements to stringOps format and split functions
- split now optionally retains empty substrings.
  Added split on fixed field width.

- Foam::name() now formats directly into string buffer, which a
  removes one layer of copying and also avoids using a non-constexpr
  in the temporary.

STYLE: explicit type narrowing on zero-padded output for ensight
2017-11-23 20:17:33 +01:00
Mark Olesen
aa112c3f26 ENH: support option aliases with versioning
- can be used for adjusting option names between versions
2017-11-22 14:42:31 +01:00
Mark Olesen
f2ba618c19 STYLE: consistency in using argList::addArgument, argList::addOption 2017-11-22 12:54:28 +01:00
Mark Olesen
a881204946 ENH: stringOps inplace methods now use a std::string parameter
- this makes them applicable to Foam::string, Foam::word etc

ENH: improvements to CStringList

- add strings() sublist variant which can be useful when handling
  command arguments separately

- add construct from SubStrings.
2017-11-22 08:03:52 +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
c7392f7fb0 ENH: additional dictionary compatibility/migration methods
- when dictionary keywords change between versions, the programmer
  can use these compatibility methods to help with migration.

    * csearchCompat, foundCompat, lookupEntryPtrCompat, lookupEntryCompat,
      lookupCompat, lookupOrDefaultCompat, readIfPresentCompat, ...

  They behave like their similarly named base versions, but accept an
  additional list of older keyword names augmented by a version number.
  For example,

      dict.readIfPresentCompat
      (
          "key", {{"olderName", 1612}, {"veryOld", 240}},
          myscalar
      );

   where 1612=OpenFOAM-v1612, 240=OpenFOAM-v2.4.x, etc.
2017-11-08 19:08:10 +01:00
Mark Olesen
8d5f28bcc0 ENH: dictionary add/set methods now return a pointer to the entry
- If the entry could be directly inserted: a pointer to the inserted entry.
- If a dictionary merge was required: a pointer to the dictionary that
  received the entry.
- Return nullptr on any type of insertion failure.

This change is code compatible with existing code since it only alters
a bool return value to be a pointer return value.
2017-11-08 17:43:28 +01:00
Mark Olesen
2ae2783635 ENH: add a test dictionary token streaming class 2017-11-07 13:12:43 +01:00
Mark Olesen
61534989df ENH: simplify primitiveEntry parsing code, move append new tokens
- simplify string output code
2017-11-05 22:07:17 +01:00
Mark Olesen
c4de3e0a4d ENH: enhancements to behaviour of token
- improved memory alignment reduces overhead for Int32 compilation

- added move/swap semantics

- made the type() readonly in favour of setVariant() to allow change
  of variant within a particular storage representation.
  Eg, STRING -> VERBATIMSTRING.
2017-11-05 20:05:28 +01:00
Mark Olesen
e1b71c028c ENH: add move/swap semantics to string types and regExp
- move append() single element to List and DynamicList

ENH: add stringOps::count to avoid unnecessary string conversions
2017-11-05 13:26:10 +01:00
Mark Olesen
cae8a894cd ENH: allow creation of ITstream by parsing string 2017-11-06 09:25:58 +01:00
Mark Olesen
507486194e ENH: improved parallel transfer of strings
- support send/receive with embedded '\0' characters
2017-11-04 15:51:52 +01:00
Mark Olesen
053a648ee6 ENH: improvements to HashTable internals
- make single-parameter construct (label) explicit
- consolidate iterators
- slightly reduced overhead for some HashSet types
- improved resizing behaviour
- compact output for empty Ptr hashes
2017-10-31 08:46:47 +01:00
Mark Olesen
db552fb751 DEFEATURE: remove StaticHashTable
- unused, unmaintained and slower than the regular HashTable
2017-10-30 21:35:05 +01:00
Mark Olesen
930d6dcaf2 ENH: dummy I/O for nullObject, additional null subclass for zero/one
- the zero::null and one::null sub-classes add an additional null
  output adapter.

  The function of the nil class (special-purpose class only used for
  HashSet) is now taken by zero::null.
2017-10-31 10:54:17 +01:00
Mark Olesen
cd46cb7041 ENH: consistent reverse iterator definitions for UList and FixedList
- consistent with C++ STL conventions, the reverse iterators should
  use operator++ to transit the list from rbegin() to rend().

  The previous implementation used raw pointers, which meant that they
  had the opposite behaviour: operator-- to transit from rbegin() to
  rend().

  The updated version only has operator++ defined, thus the compiler
  should catch any possible instances where people were using the old
  (incorrect) versions.

- updated forAllReverseIters() and forAllConstReverseIters() macros to
  be consistent with new implementation and with C++ STL conventions.
2017-10-29 20:57:43 +01:00
Mark Olesen
d6b32094e1 ENH: add reverse iteration macros
- forAllReverseIters and forAllReverseConstIters macros
- stdFoam::rbegin(), stdFoam::rend()
  stdFoam::crbegin(), stdFoam::crend()
2017-10-29 16:02:19 +01:00
Mark Olesen
4e48beffd4 ENH: support "one-shot" changes to the dictionary inputMode (issue #429)
- Instead of relying on #inputMode to effect a global change it is now
  possible (and recommended) to a temporary change in the inputMode
  for the following entry.

     #default   : provide default value if entry is not already defined
     #overwrite : silently remove a previously existing entry
     #warn      : warn about duplicate entries
     #error     : error if any duplicate entries occur
     #merge     : merge sub-dictionaries when possible (the default mode)

  This is generally less cumbersome than the switching the global
  inputMode. For example to provide a set of fallback values.

      #includeIfPresent "user-files"
      ...
      #default value uniform 10;

  vs.

      #includeIfPresent "user-files"
      #inputMode protect
      ...
      value uniform 10;
      #inputMode merge    // _Assuming_ we actually had this before

  These directives can also be used to suppress the normal dictionary
  merge semantics:

     #overwrite dict { entry val; ... }
2017-07-29 17:44:22 +02:00
Mark Olesen
2fdc6b161a ENH: support full-scoping for keywords as lvalue (issue #429)
- patterns only supported for the final element.

  To create an element as a pattern instead of a word, an embedded
  string quote (single or double) is used for that element.
  Any of the following examples:

      "/top/sub/dict/'(p|U).*"     100;
      "/top/sub/dict/'(p|U).*'"    100;
      "/top/sub/dict/\"(p|U).*"    100;
      "/top/sub/dict/\"(p|U).*\""  100;

  are equivalent to the longer form:

      top
      {
          sub
          {
              dict
              {
                  "(p|U).*"     100;
              }
          }
      }

  It is not currently possible to auto-vivify intermediate
  dictionaries with patterns.

    NOK   "/nonexistent.*/value"   100;
    OK    "/existing.*/value"      100;

- full scoping also works for the #remove directive

        #remove "/dict1/subdict2/entry1"
2017-07-20 10:58:05 +02:00
Will Bainbridge
fe595af8c6 ENH: rigidBodyModelState: Added time value member
The absolute value of the the time has been added to the rigid body
model state. This value is not directly necessary for calculating the
evolution of the rigid body system, it just facilitates the
implementation of sub-models which are in some way time-dependent.
2017-12-13 11:59:46 +00:00
Mark Olesen
7d7b0bfe84 STYLE: use list methods find/found instead of findIndex function 2017-10-24 19:07:34 +02:00
Mark Olesen
0a62fd2f87 ENH: allow passing of comparator to sortToc methods
- this increases the flexibility of the interface

- Add stringOps 'natural' string sorting comparison.
  Digits are sorted in their natural order, which means that
      (file10.txt file05.txt file2.txt)
  are sorted as
      (file2.txt file05.txt file10.txt)

STYLE: consistent naming of template parameters for comparators

  - Compare for normal binary predicates
  - ListComparePredicate for list compare binary predicates
2017-10-27 14:28:00 +02:00
Mark Olesen
8ec64d8128 STYLE: compilation of some unit tests 2017-10-26 23:59:18 +02:00
Mark Olesen
16e75d8475 ENH: add fileName::validate static method (issue #628)
- similar to word::validate to allow stripping of invalid characters
  without triggering a FatalError.

- use this validated fileName in Foam::readDir to avoid problems when
  a directory contains files with invalid characters in their names

- adjust rmDir to handle filenames with invalid characters

- fileName::equals() static method to compare strings while ignoring
  any differences that are solely due to duplicate slashes
2017-10-26 21:23:24 +02:00
Mark Olesen
2bd2f83f6e ENH: cleanup and rationalize memory-backed streams
- more consistent naming:
  * Versions that hold and manage their own memory:
      IListStream, OListStream

  * Versions that reference a fixed size external memory:
      UIListStream, UOListStream

- use List storage instead of DynamicList within OListStream.
  Avoids duplicate bookkeeping, more direct handling of resizing.
2017-10-26 12:09:47 +02:00
Mark Olesen
c1c4e91ffb ENH: handle underflow (rounding) of float/double as zero (issue #625)
- The problem occurs when using atof to parse values such as "1e-39"
  since this is out of range for a float and _can_ set errno to
  ERANGE.

  Similar to parsing of integers, now parse with the longest floating
  point representation "long double" via strtold (guaranteed to be
  part of C++11) and verify against the respective VGREAT values for
  overflow. Treat anything smaller than VSMALL to be zero.
2017-10-25 20:55:37 +02:00
Mark Olesen
88bb403fe0 ENH: new stream output: OListStream
- an output stream to a DynamicList
2017-10-24 11:59:11 +02:00
Mark Olesen
7e8217fd17 ENH: include memory streams
- these provide a similar functionality to string-streams, but operate
  on a externally provided memory buffer which can be used to reduce
  the amount of copying.

- classes were previously staged as part of the ADIOS community
  repository.
2017-10-23 12:06:59 +02:00
Mark Olesen
af5f857618 ENH: add reset() method to IStringStream
- for convenience and symmetry with OStringStream

STYLE: void return value for stream rewind() methods

- this makes it easier to design bidirectional streams
2017-10-23 07:50:12 +02:00
Mark Olesen
74f667a85b ENH: additional low-level raw binary output for Ostream.
- low-level beginRaw(), writeRaw(), endRaw() methods.
  These can be used to directly add '()' decorators for serial output
  or prepare/cleanup parallel buffers.
  Used, for example, when outputting indirect lists in binary to avoid.
2017-10-20 10:26:55 +02:00
Mark Olesen
3cbf399470 BUG: failed swap/transfer for DynamicList with different sizing parameters
- now use public functions instead of direct access of private 'capacity_'
  information
2017-10-24 10:29:09 +02:00
Mark Olesen
e1167d9592 ENH: provide openmp compile and link flags.
- the USE_OMP preprocessor symbol is also defined with the openmp
  compile flag to allow conditional compilation of openmp-specific
  code.
2017-10-23 09:38:43 +02:00
Mark Olesen
b29f2a61b6 BUG: missing parallel-aware for metis-like decomposition 2017-10-13 12:45:28 +02:00
Mark Olesen
f116217466 STYLE: remove FULLDEBUG output on readLabel, readScalar
- used in various places to test if the input can be parsed as a
  label/scalar, so warnings tend to flood the output.

- be more explicit when encountering range errors
2017-10-12 12:15:56 +02:00
Mark Olesen
5f98600b53 COMP: handle kahip .so version, and openmp dependency 2017-10-11 18:41:28 +02:00
Andrew Heather
c60627686a Merge branch 'feature-kahip-decompose' into 'develop'
add support for KaHIP decomposition

See merge request Development/OpenFOAM-plus!154
2017-10-11 16:36:48 +01:00
Mark Olesen
e9254eee58 ENH: support KaHIP decomposition
- refactor some common metis-like elements into the metisLikeDecomp
  abstract class.
2017-10-09 21:00:34 +02:00
Mark Olesen
4ba4899660 ENH: minor update of PackedList methods
- additional convenience constructors
2017-10-07 16:10:35 +02:00
Mark Olesen
049617d037 ENH: update List and DynamicList methods (issue #595)
- improve functional compatibility with DynList (remove methods)
  * eg, remove an element from any position in a DynamicList
  * reduce the number of template parameters
  * remove/subset regions of DynamicList

- propagate Swap template specializations for lists, hashtables

- move construct/assignment to various containers.

- add find/found methods for FixedList and UList for a more succinct
  (and clearer?) usage than the equivalent global findIndex() function.

- simplify List_FOR_ALL loops
2017-09-20 17:20:54 +02:00
Sergio Ferraris
e8ec236cdf Merge branch 'feature-string-parsing' into 'develop'
improve consistency in parsing primitives from strings

See merge request !146
2017-09-25 18:28:47 +01:00
Mark Olesen
610854af03 STYLE: minor cleanup after merge 2017-09-22 16:25:17 +02:00
Mark Olesen
66104f2569 ENH: improve input stringency for argList options
Previously:

  - bad command-line input such as -label 1234xyz would parse as a
    label (with value 1234) and the trailing junk would be silently
    ignored. This may or may not be appropriate. If the trailing junk
    looked like this '100E' or '1000E-' (ie, forgot to type the
    exponent), the incorrectly parsed values can be quite bad:

        label  = 32684
        scalar = 6.93556e-310

Now:

  - use the updated readLabel/readScalar routines that trigger a
    FatalIOError on bad input:

        --> FOAM FATAL IO ERROR:
        Trailing content found parsing '1234xyz'

        --> FOAM FATAL IO ERROR:
        Trailing content found parsing '100E'

   This traps erroneous command-line input immediately.
2017-09-21 16:53:46 +02:00
Mark Olesen
accebc74ee ENH: improve consistency in parsing primitives from strings (issue #590)
- Any trailing whitespace when parsing from strings or character buffers
  is ignored rather than being treated as an error. This is consistent
  with behaviour when reading from an Istream and with leading whitespace
  being ignored in the underlying atof/atod, strtof/strtod... functions.

- Allow parsing directly from a std::string instead of just from a 'char*'.
  This reflects the C++11 addition of std::stod to complement the C
  functions strtod. This also makes it easier to parse string directly
  without using an IStringStream.

- Two-parameter parsing methods return success/failure.
  Eg,

      if (readInt32(str, &int32Val)) ...

- One-parameter parsing methods return the value on success or
  emit a FatalIOError.
  Eg,

      const char* buf;
      int32Val = readInt32(buf, &);

- Improved consistency when parsing unsigned ints.
  Use strtoimax and strtoumax throughout.

- Rename readDoubleScalar -> readDouble, readFloatScalar -> readFloat.
  Using the primitive name directly instead of the Foam typedef for
  better consistency with readInt32 etc.

- Clean/improve parseNasScalar.
  Handle normal numbers directly, reduce some operations.
2017-09-18 10:47:07 +02:00
Andrew Heather
d8d6030ab6 INT: Integration of Mattijs' collocated parallel IO additions
Original commit message:
------------------------

Parallel IO: New collated file format

When an OpenFOAM simulation runs in parallel, the data for decomposed fields and
mesh(es) has historically been stored in multiple files within separate
directories for each processor.  Processor directories are named 'processorN',
where N is the processor number.

This commit introduces an alternative "collated" file format where the data for
each decomposed field (and mesh) is collated into a single file, which is
written and read on the master processor.  The files are stored in a single
directory named 'processors'.

The new format produces significantly fewer files - one per field, instead of N
per field.  For large parallel cases, this avoids the restriction on the number
of open files imposed by the operating system limits.

The file writing can be threaded allowing the simulation to continue running
while the data is being written to file.  NFS (Network File System) is not
needed when using the the collated format and additionally, there is an option
to run without NFS with the original uncollated approach, known as
"masterUncollated".

The controls for the file handling are in the OptimisationSwitches of
etc/controlDict:

OptimisationSwitches
{
    ...

    //- Parallel IO file handler
    //  uncollated (default), collated or masterUncollated
    fileHandler uncollated;

    //- collated: thread buffer size for queued file writes.
    //  If set to 0 or not sufficient for the file size threading is not used.
    //  Default: 2e9
    maxThreadFileBufferSize 2e9;

    //- masterUncollated: non-blocking buffer size.
    //  If the file exceeds this buffer size scheduled transfer is used.
    //  Default: 2e9
    maxMasterFileBufferSize 2e9;
}

When using the collated file handling, memory is allocated for the data in the
thread.  maxThreadFileBufferSize sets the maximum size of memory in bytes that
is allocated.  If the data exceeds this size, the write does not use threading.

When using the masterUncollated file handling, non-blocking MPI communication
requires a sufficiently large memory buffer on the master node.
maxMasterFileBufferSize sets the maximum size in bytes of the buffer.  If the
data exceeds this size, the system uses scheduled communication.

The installation defaults for the fileHandler choice, maxThreadFileBufferSize
and maxMasterFileBufferSize (set in etc/controlDict) can be over-ridden within
the case controlDict file, like other parameters.  Additionally the fileHandler
can be set by:
- the "-fileHandler" command line argument;
- a FOAM_FILEHANDLER environment variable.

A foamFormatConvert utility allows users to convert files between the collated
and uncollated formats, e.g.
    mpirun -np 2 foamFormatConvert -parallel -fileHandler uncollated

An example case demonstrating the file handling methods is provided in:
$FOAM_TUTORIALS/IO/fileHandling

The work was undertaken by Mattijs Janssens, in collaboration with Henry Weller.
2017-07-07 11:39:56 +01:00
Will Bainbridge
62e3d37324 primitiveShapes: Generalised tetrahedron and triangle cutting. Cuts are
now possible with level-sets as well as planes. Removed tetPoints class
as this wasn't really used anywhere except for the old tet-cutting
routines. Restored tetPointRef.H to be consistent with other primitive
shapes. Re-wrote tet-overlap mapping in terms of the new cutting.
2017-05-22 11:40:37 +01:00
Mark Olesen
c59c3af146 STYLE: relocate surfaceMeshConvertTesting to test/ (closes #584)
- relocate as Test-surfaceMeshConvert.
2017-09-11 14:50:51 +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
fbdd16a293 ENH: add stringOps::splitAny, stringOps::splitSpace
- assists when building simple hand-rolled parsers.
  Also add string::split() taking a sub-string for the delimiter.
2017-08-14 10:36:12 +02:00
Mark Olesen
5da321b6e6 TUT: various blockMeshDict with convertToMeters instead of scale 2017-08-07 20:57:05 +02:00
Mark Olesen
5148e4f860 STYLE: manage dictionary inputMode directly within entry class
- The logic for switching input-mode was previously completely
  encapsulated within the #inputMode directive, but without any
  programming equivalent. Furthermore, the encapsulation in inputMode
  made the logic less clear in other places.

  Exposing the inputMode as an enum with direct access from entry
  simplifies things a fair bit.

- eliminate one level of else/if nesting in entryIO.C for clearer logic

- for dictionary function entries, simply use
  addNamedToMemberFunctionSelectionTable() and avoid defining a type()
  as a static. For most function entries the information is only used
  to get a name for the selection table lookup anyhow.
2017-08-03 07:14:17 +02:00
Mark Olesen
e70fc61660 ENH: consolidate, cleanup some string methods
- consolidate word::validated() into word::validate() and also allow
  as short form for string::validate<word>(). Also less confusing than
  having similarly named methods that essentially do the same thing.

- more consistent const access when iterating over strings

- add valid(char) for keyType and wordRe
2017-08-02 12:33:35 +02:00
Mark Olesen
797155f862 ENH: additional method for switching error throwing on/off (issue #552)
- error::throwExceptions(bool) returning the previous state makes it
  easier to set and restore states.

- throwing() method to query the current handling (if required).

- the normal error::throwExceptions() and error::dontThrowExceptions()
  also return the previous state, to make it easier to restore later.
2017-07-29 12:25:30 +02:00
Mark Olesen
910967c070 ENH: add Foam::SubStrings container and stringOps::split
- generic means of holding ranges of substring iterators
2017-07-20 19:53:57 +02:00
Mark Olesen
72f242405a STYLE: word::validated without underscore prefix by default (issue #518)
- this now appears to be the more common use case.
2017-07-18 14:09:49 +02:00
Mark Olesen
cc290b7c02 ENH: improve dictionary parsing behaviour for ill-formed entries (closes #510)
- mostly associated with forgotten quotes around "(abd|def)" ...

- Address different potential problems:

      (key) { key1   entry1; }
      (key) { key1   entry1; };    // <- Note trailing ';'
      (key) entry2;
2017-07-19 11:00:44 +02:00
Mark Olesen
db376a412d ENH: improved behaviour of input stream rewind (issue #534)
- clear error flags. Special handling for igzstream.
2017-07-18 11:10:51 +02:00
Mark Olesen
b4b50a3aa8 ENH: added OStringStream reset method (closes #534)
- resets the output buffer completely - implementing what rewind was
  likely meant to have accomplished for many use cases.

STYLE: OSHA1stream reset() for symmetry. Deprecate rewind().
2017-07-17 18:32:42 +02: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
Andrew Heather
b0db30ba2f Merge branch 'feature-externalFileCoupler' into 'develop'
Feature external file coupler

See merge request !126
2017-07-18 11:12:05 +01:00
Mark Olesen
8399277d7d STYLE: eliminate duplicate includes (issue #293) 2017-07-17 14:44:05 +02:00
Mark Olesen
7a408c713b ENH: refactor and combine externalFileCoupler (issue #529) 2017-07-17 12:54:02 +02:00
Mark Olesen
84e47f2d2a ENH: cleanup dictionary code
- use typedefs and new features/methods
- file-scope template to avoid code duplication.
2017-07-06 12:58:04 +02:00
Mark Olesen
e54a930dcc ENH: add mpiBufferSize optimisationSwitch (issue #517)
- allows configuration without an environment variable.
  For compatibility still respect MPI_BUFFER_SIZE env-variable.
2017-07-05 15:52:44 +02:00
Mark Olesen
1bcb454f6d STYLE: hash constructors with power-of-two
- use 1024 instead of 1000 since it will be changed internally to 1024 anyhow.
2017-07-05 10:46:50 +02:00
Andrew Heather
d415bf77bf Merge branch 'develop' of develop.openfoam.com:Development/OpenFOAM-plus into develop 2017-06-26 13:33:19 +01:00
Andrew Heather
4abc7a92ed STYLE: Header updates 2017-06-26 11:03:00 +01:00
Mark Olesen
c0b38033ea ENH: integration of lumpedPointMotion
- This provides a mechanism for moving mesh patches based on external
  input (eg, from an external structures solver). The patch points are
  influenced by the position and rotation of the lumped points.

  BC:  lumpedPointDisplacementPointPatchVectorField

  Controlling mechanisms:
  - externalCoupler
    for coordinating the master/slave

  - lumpedPointMovement
    manages the patch-points motion, but also for extracting forces/moments

  - lumpedPointState
    represents the positions/rotations of the controlling points

  Utils:
  - lumpedPointZones
    diagnostic for visualizing the correspondence between controlling
    points and patch faces

  - lumpedPointMovement
    Test that the patch motion is as desired without invoking moveMesh.
    With the -slave option, return items from a precalculated table
    for the lumpedPointDisplacementPointPatchVectorField BC.
2017-06-23 14:43:09 +01:00
Mark Olesen
6ecddbe4a5 STYLE: use #includeEtc in tutorial cases
#includeEtc "caseDicts/setConstraintTypes"
 vs.
    #include "${WM_PROJECT_DIR}/etc/caseDicts/setConstraintTypes"
2017-06-21 16:42:57 +01:00
Mark Olesen
7eec9f0dd6 STYLE: use standardized 0.orig/ for overset tutorials 2017-06-14 14:15:22 +02:00
Mark Olesen
710f23aa35 COMP: hash-table size overflow with 64-bit labels (fixes #498)
- Requires (1L << N) instead of (1 << N), otherwise it overflows
  and the result is zero.
2017-06-14 12:54:38 +02:00
mattijs
fd665b4a3c ENH: overset: Initial release of overset capability.
Adds overset discretisation to selected physics:
- diffusion : overLaplacianDyMFoam
- incompressible steady : overSimpleFoam
- incompressible transient : overPimpleDyMFoam
- compressible transient: overRhoPimpleDyMFoam
- two-phase VOF: overInterDyMFoam

The overset method chosen is a parallel, fully implicit implementation
whereby the interpolation (from donor to acceptor) is inserted as an
adapted discretisation on the donor cells, such that the resulting matrix
can be solved using the standard linear solvers.

Above solvers come with a set of tutorials, showing how to create and set-up
simple simulations from scratch.
2017-06-14 09:51:02 +01: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
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
62e7ddccdc ENH: add (C++11) user-literal for degrees to radians conversion
- Programming convenience.
  Eg, cos(45_deg) vs cos(degToRad(45))

STYLE: conversions marked as constexpr and noexcept
2017-05-31 10:16:19 +02:00
Mark Olesen
8afc6cbd86 ENH: Enum class as drop-in alternative for NamedEnum
- the NamedEnum wrapper is somewhate too rigid.
  * All enumerated values are contiguous, starting as zero.
  * The implicit one-to-one mapping precludes using it for aliases.
  * For example, perhaps we want to support alternative lookup names for an
    enumeration, or manage an enumeration lookup for a sub-range.
2017-05-29 13:13:53 +02:00