1. 30 Jul, 2020 2 commits
  2. 28 Jul, 2020 4 commits
    • Mark Olesen's avatar
      BUG: potential memory leaks in HashPtrTable (#1787) · 65d640e5
      Mark Olesen authored
      - using HashPtrTable::set() with the same key twice did not guarantee
        proper cleanup of memory since it simply used the underlying
        HashTable::set() without doing anything about the old memory. Now
        check for pre-existing storage and delete it when it does not
        correspond to the newly stored pointer.
      
        This problem is independent of potential memory slicing previously
        flagged (#1286) and only partially resolved.
      65d640e5
    • Mark Olesen's avatar
      ENH: add get() retrieval of a pointer from PtrLists, HashPtrTable · fa71840d
      Mark Olesen authored
      - naming similarity with autoPtr, unique_ptr and other containers.
      
        For UPtrList derivatives, this is equivalent to the existing
        operator(). The read-only variant is also equivalent to the
        single-parameter 'set(label)' method.
      
        With PtrList<T> list(...) :
      
            const T* ptr = list.get(10);
            if (ptr)
            {
                ptr->method();
            }
      
        vs.
            if (list.set(10))
            {
                list[10].method();
            }
      
        For HashPtrTable there is only a read-only variant which is equivalent
        to testing for existence and for value.
      
        With HashPtrTable<T> hash(...) :
      
            const T* ptr = list.get("key");
            if (ptr)
            {
                ptr->method();
            }
      
        vs.
            if (list.found("key"))
            {
                // Fails on null pointer!!
                list["key"].method();
            }
      
      Use of get() is largely a matter of taste or local coding requirements
      fa71840d
    • Mark Olesen's avatar
      ENH: support emplace methods and std::unique_ptr for PtrList-derivatives · 872c9d37
      Mark Olesen authored
      - emplace methods
        Eg,
            m.internalCoeffs().emplace(patchi, fc.size(), Zero);
        vs.
            m.internalCoeffs().set(patchi, new Field<Type>(fc.size(), Zero));
      
      - handle insert/append of refPtr wherever tmp was already supported
      
      COMP: incorrect variable names in PtrListOpsTemplates.C
      872c9d37
    • Mark Olesen's avatar
      ENH: HashTable::emplace_set() method, HashPtrTable support for unique_ptr · 4110699d
      Mark Olesen authored
      - forwarding like the emplace() method, but overwriting existing
        entries as required
      
      - propagate similar changes to HashPtrTable
      
        For example, with HashPtrTable<labelList> table(...) :
      
        With 'insert' semantics
      
            table.emplace("list1", 1000);
      
        vs
            if (!table.found("list1"))
            {
                table.set("list1", new labelList(1000));
            }
        or
            table.insert("list1", autoPtr<labelList>::New(1000));
      
        Note that the last example invokes an unnecessary allocation/deletion
        if the insertion is unsuccessful.
      
        With 'set' semantics:
      
            table.emplace_set("list1", 15);
      
        vs
            table.set("list1", new labelList(15));
      4110699d
  3. 27 Jul, 2020 3 commits
  4. 22 Jul, 2020 2 commits
  5. 23 Jul, 2020 1 commit
  6. 21 Jul, 2020 1 commit
    • Mark Olesen's avatar
      ENH: support writable reference for tmp (#1775) · be058bec
      Mark Olesen authored
      - improves flexibility. Can tag a tmp as allowing non-const access to
        the reference and skip additional const_cast in following code. For
        example,
      
            tmp<volScalarField> tfld(nullptr);
            auto* ptr = getObjectPtr<volScalarField>("field");
            if (ptr)
            {
                tfld.ref(*ptr);
            }
            else
            {
                tfld.reset(volScalarField::New(...));
            }
            auto& fld = tfld.ref();
      
      ENH: renamed tmpNrc to refPtr
      
      - the name 'refPtr' (reference|pointer) should be easier to remember
        than tmpNrc (tmp, but non-ref-counted).
      
      - provide tmpNrc typedef and header for code compatibility
      
      NOTE
      
      - in some places refPtr and tmp can be used instead of a
        std::reference_wrapper for handling external references.
      
        Unlike std::reference_wrapper, it can be default constructed
        (holding nothing), whereas reference_wrapper may need a dummy
        reference. However, the lifetime extension of references _may_ be
        better with reference_wrapper.
      be058bec
  7. 16 Jul, 2020 8 commits
  8. 14 Jul, 2020 2 commits
    • Mark Olesen's avatar
      ENH: mutable libs() access in Time and other classes (#1737) · 1e7c6ea2
      Mark Olesen authored
      - This reflects the pre-existing coding situation where const_cast was
        used throughout to effect the same.
      
      STYLE: fix private/protected access
      
      - CodedField, codedMixedFvPatchField
      1e7c6ea2
    • Mark Olesen's avatar
      ENH: various dlLibraryTable improvements/refinements (#1737) · 41d3e6f1
      Mark Olesen authored
      - libs() singleton method for global library handling
      
      - explicit handling of empty filename for dlLibraryTable open/close.
        Largely worked before, but now be more explicit about its behaviour.
      
      - add (key, dict) constructor and open() methods.
        More similarity to dimensionedType, Enum etc, and there is no
        ambiguity with the templated open().
      
      - construct or open from initializer_list of names
      
      - optional verbosity when opening with auxiliary table,
        avoid duplicate messages or spurious messages for these.
      
      - basename and fullname methods (migrated from dynamicCode).
      
      - centralise low-level load/unload hooks
      
      - adjust close to also dlclose() aliased library names.
      41d3e6f1
  9. 10 Jul, 2020 1 commit
    • Mark Olesen's avatar
      ENH: update lemon version and linkage directive (#1768) · 6365bab8
      Mark Olesen authored
      - replace `%namespace` directive with simpler `%static` directive.
      
        We always encapsulate Lemon parser routines in an anonymous
        namespace, so a simpler static linkage directive suffices.
      
        This reduces the size of the Lemon patch (program and template).
      6365bab8
  10. 09 Jul, 2020 2 commits
  11. 01 Jul, 2020 1 commit
  12. 26 Jun, 2020 1 commit
  13. 24 Jun, 2020 1 commit
    • Andrew Heather's avatar
      ENH: AMI - multiple updates · a13e00b5
      Andrew Heather authored
      - start of work to create a 1-to-1 face mapping across AMI patches
      - faces are inserted according to the AMI addressing based on Horacio's method
      - removed 'updated' flag and reworked some demand driven updates
      - updated to handle 'walking' through baffles
      - use bitSet instead of boolList
      - moved update of meshPhi to movePoints() functions at fvPatch level
      - moved scaling of areas to movePoints() functions at fvPatch level
      - rehomed topology change code to own file
      - added warning re: geometry construction
      
      ACMI
      - split srcMask into srcMask and srcAreaMask
        - former in range 0-1, and latter has bounding or tol to (1-tol) to avoid
          sigFpe's
      a13e00b5
  14. 23 Jun, 2020 1 commit
  15. 22 Jun, 2020 2 commits
  16. 17 Jun, 2020 1 commit
  17. 16 Jun, 2020 1 commit
  18. 15 Jun, 2020 2 commits
  19. 10 Jun, 2020 1 commit
  20. 08 Jun, 2020 3 commits