Commit Graph

10 Commits

Author SHA1 Message Date
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
724b034cc7 argList enhancement: added convenience methods for accessing options
Oriented somewhat on dictionary methods.

Return the argument string associated with the named option:
    Info<< "-foo: " << args.option("foo") << nl;

Return true if the named option is found
    if (args.optionFound("foo")) ...

Return an IStringStream to the named option
    old:      value = readScalar(IStringStream(args.options()["foo"])());
    newer:    value = readScalar(args.optionLookup("foo")());
    also:     List<scalar> lst(args.optionLookup("foo")());

Read a value from the named option
    newest:   value = args.optionRead<scalar>("foo");

Read a value from the named option if present.
    old:  if (args.options().found("foo"))
          {
              value = readScalar(IStringStream(args.options()["foo"])());
          }
    new:  args.optionReadIfPresent("foo", value);

Read a List of values from the named option
    patches = args.optionReadList<word>("patches");

Didn't bother adding optionReadListIfPresent<T>(const word&), since it
probably wouldn't be common anyhow.
2009-05-19 18:19:49 +02:00
Mark Olesen
a0a9cd3366 introduce readList<T> function
- Read a bracket-delimited list, or handle a single value as list of size 1.
  Mostly useful for handling command-line arguments.
  eg,
      if (args.options().found("patches"))
      {
          patches = readList<word>(IStringStream(args.options()["patches"])());
      }
  can handle both of these:
      -patches  patch0
      -patches \( patch1 patch2 patch3 \)
2009-05-18 12:05:52 +02:00
Mark Olesen
6ce8e7d0c0 added List::append() methods 2009-04-22 16:11:52 +02:00
mattijs
6c387489d7 subset constructor 2009-03-12 15:59:27 +00:00
Mark Olesen
19503c93e1 rename xfer<T> class to Xfer<T>
- The capitalization is consistent with most other template classes, but
  more importantly frees up xfer() for use as method name without needing
  special treatment to avoid ambiguities.

  It seems reasonable to have different names for transfer(...) and xfer()
  methods, since the transfer is occuring in different directions.
  The xfer() method can thus replace the recently introduced zero-parameter
  transfer() methods.
  Other name candidates (eg, yield, release, etc.) were deemed too abstract.
2009-01-05 12:30:19 +01:00
Mark Olesen
cf488912bb added xfer<...> transfer() method to various containers
- this should provide a slightly more naturally means to using transfer
  constructors, for example
          labelList list2(list1.transfer());
      vs. labelList list2(xferMove(list1));

- returns a plain list where appropriate (eg, DynamicList, SortableList)
  for example
          labelList list2(dynList1.transfer());
      vs. labelList list2(xferMoveTo<labelList>(dynList1));
2009-01-02 15:54:51 +01:00
Mark Olesen
28b200bcd9 update copyrights for 2009 2008-12-31 19:01:56 +01:00
Mark Olesen
02cabc3cf2 updated Copyright (C) \d+-2008 OpenCFD Ltd. 2008-06-25 15:01:46 +02:00
OpenFOAM-admin
3170c7c0c9 Creation of OpenFOAM-dev repository 15/04/2008 2008-04-15 18:56:58 +01:00