• Alexis SALZMAN's avatar
    [xFEM] Adding optimized version of DeclareState/DeclareInterpolation · db4eefd8
    Alexis SALZMAN authored
    A DeclareInterpolation2 and DeclareState2 is added to xAlgorithm.h in
    this commit. The idea is not to use them right away but instead to test
    them in your context by switching names (remove the 2 and add
    something to old version names). By context here I talk of compiler. For
    those who use something else then GNU g++, those new versions have to be
    validated because they use the following assertion not in the norm I
    The clear method of std::vector do not touch memory allocation.
    Thus the glob and loc vectors use memory management a small number of
    time (for the first set of key of each space for a priori one element
    per space at most). Otherwise the insert is relying on already allocated
    If this assertion is not verified with other compiler something will have
    to be added.
    Besides this memory trick the main modification comes from valgrind
    study. It shows that xFiniteElement destructor and setKeys count
    respectively for 6.44% and 35.49% of 595 call to Declarinterpolation
    with a total of 304 640 elements treated (512 per call).
    KeysFor interfere in setKeys for 19.08%. As stated already by N.C.,
    clearly those computation are too costly compared to the generality or
    maintainability that they provides. The adopted solution was to remove
    xFiniteElement usage in those functions. That may hurt ... Maybe the
    loop on space, glob and loc ingredient may be encapsulate in something
    .. or xFiniteElement may be cleaned.
    For now those new versions are proof concept. Their performance shows up
    more then 20% gain in some application with many declareXXX.
    Note that new version pass test successfully.
xAlgorithm.h 88.7 KB