• Nicolas CHEVAUGEON's avatar
    [xfem] Reduces dependencies on xMesh.h. This has implications in other parts of the lib. · 9c703287
    Nicolas CHEVAUGEON authored
        Currently, xMesh.h, by cascading include, is visible by a too large part of
        the library. Change one Character of xMesh.h, and you need to recompile
        the world. The aim of this commit is to reduce these dependencies.
        It affect lots of files but only a little in each. As discuted in meeting,
        I won't clang format them all for this push, But I clang format the added files.
    
        ADDED FILES :
    
        1 xFEM/src/xMeshFwd.h
        2 xFEM/src/xIntegrationRuleFwd.h
        3 xInterface/AOMD/general/src/xAOMDEntityUtil.h
        4 xInterface/xOctree/src/OctreeUtilities.cc
    
        1 xMeshFwd.h : A forward header fo xMesh.h. Include this where you need to
         forward declare the type defined in xMesh, but not there full declaration.
         Typically include it in place of xMesh.h wherever you need the type previously
         defined in xMesh but not their full description (you only declare pointer or
         refs to xMesh, you just need xIter, xClassIter or xPartition or the type of
         partman used inside xMesh (parmanxMesh_t) )
    
        2 xIntegrationRuleFwd.h, same philosophie as above, a forward header for
         xIntegrationRule. it forward declare class xIntergrationRule and define the
         type def xGetPartion (the function used to parametrize how to get the sub
         elements in the xIntergrationRulePartition familly.
    
        3 xAOMDEntityUtil.h Some function previously defined in xMesh.h/cc,
         are in fact simple utility function applied on mEntity.
         There are place in the code where they are needed, but where you don't need
         xMesh. For now I moved the following one there, in namespace xiterface::aomd :
          - void getSubentities(AOMD::mEntity* e, const int d,
                                std::vector < AOMD::mEntity * > &l);
          - void getSupportBoundary(AOMD::mEntity *in,
                                   std::set<AOMD::mEntity *> &supportBoundary )
         They are used in :
          xCut/xLegacySimpleCut/src/xRefCutToAOMD.cc,
          xGeom/src/xDistanceNearestPointGenerator_imp.h, xTLS/src/xRefCutToCGAL.cc
    
        4 OctreeUtilities.cc This is an implementation file for OctreeUtilities.h
          Following function are moved to the .cc :
          xLevelSetTo_ls_xyz_t_Adaptator::xLevelSetTo_ls_xyz_t_Adaptator(xLevelSet &ls_)
          double  xLevelSetTo_ls_xyz_t_Adaptator::operator()(x,y,z).
          using namespace xfem and using namespace xoctree; are removed from the global
          scope in OctreeUtilities.h
    
        INTERFACE CHANGES :
    
        - xIntegrationRulePartition familly : the getpartition function that
          parametrize how to go from the integ entity to it's sub entity must now be
          given explicitly as a first argument.
          Rational : when first introduced, this parametrization could be implicit
          thanks to a default argument set to the static xMesh::getPartition.
          This implied an unwanted dependencies of xIntegrationRule to xMesh, and make
          user code unclear on the real dependencies of there Integration rule to
          there cutting process. Concerned files :
          xCrack/src/IntegratorSingularCrack2D.cc,
          xCrack/src/IntegratorSingularCrack3D.cc, xFEM/src/xIntegrationRule.h,
          xFEM/src/xIntegrationRule.cc, xFEM/src/xIntegrationRuleStored.h,
          xFEM/src/xIntegrationRuleStored.cc, xPhysics/src/xpElastic.cc,
          xPhysics/src/xpFluidMechanics.cc, xPhysics/src/xpFluidMechanics.cc,
          xPhysics/src/xpThermic.cc, xTLS/src/TLSGeomInterface.cc,
          xTLS/src/TLSGeomInterfaceSignedVectorDistanceFunction.cc,
          xTLS/src/TLSGeomInterfaceSignedVectorLevelSet.cc,
          xTLS/src/TLSGeomInterfaceVectorLevelSet.cc
    
        - xCrack/src/xcFront.h : added begin and end to iterate on front_parts.
          used to simplify loops in
          in xCrack/src/xcFrontDomainManager.cc, xCrack/src/xcFrontManager.cc,
          xCrack/src/xcInteractionIntegralsOnCrack.cc
    
        - xCrack/src/xcInteractionIntegralsOnCrack.h
          xAcceptLocalPart is now template on the DATAMANAGER that store was_created_by
           affected files : xCrack/src/xcInteractionIntegralsOnCrack.cc
    
        - xFEM/src/xAlgorithm.h :
          DeclareInterpolationHanging : the datamanager needed need now to be
          explicitlty given (no default value). Rational:  again the default
          value hide to  the user the real dependencies of the algorithm.
    
        - xFEM/src/xValueCreators.h :
          * xMirrorCreator : used to interconnect xValue on "mirror" entity,
          typically used for periodic Boundary condition. Previously, it was
          using an xMesh pointer and internal call to AOMD's lookupForMirrorEntities,
          on this mesh. This is too dependend on both xMesh and AOMD. Looking closely,
          all that is needed for this algorithm to work is a way to get from one entity
          a list of entity it mirror. The new interface is based on that.
          At construction, full control is given to the user which just have to give
          an std::function that take a pointer to a mesh entity and return the list
          of mirror entity. the pointer to the mesh itself is not needed anymore.
          * xValueCreatorRegularAndHanging : no default value any more for the
          isHangingOn at construction (same rational as for the use of the other
          static datamanger of xMesh, if you use them, do it explicitly.)
          the pointer to the mesh is not needed any more at construction.
    
        IMPLIED MODIFICATIONS:
    
        - replaced xMesh.h by xMeshFwd.h or include xMeshFwd.h or remove include xMesh.h
         in the following files :
          xCrack/src/CrackPostpro.h, xCrack/src/lCrack.h, xCrack/src/xcFront.h,
          xCrack/src/xcFrontDomain.h, xCrack/src/xcCrackBase.h,
          xCrack/src/xcFrontDomainManager.h, xCrack/src/xcFrontPart.h,
          xCrack/src/xcFrontSpaceManager.h, xCut/xDoubleCut/src/xElemCutDomainData.h,
          xCut/xDoubleCut/src/xPhysDomain.h,   xCut/xDoubleCut/src/xPolytopeOFF.cc,
          xCut/xDoubleCut/src/xPolytopeToAOMDElem.h,
          xCut/xLegacySimpleCut/src/xPhysSurf.h,
          xCut/xLegacySimpleCut/src/xPhysSurfVLS.h,
          xCut/xLegacySimpleCut/src/xRefCut.cc,
          xCut/xLegacySimpleCut/src/xRefCutToAOMD.h,  xExport/src/xPostPro.h
          xExt/src/DoubleCutting.h, xFEM/src/xApproxFunctionCorrectedShifted.cc,
          xFEM/src/xData.h, xFEM/src/xElement.cc,  xFEM/src/xGatherMesh.h,
          xFEM/src/xIntegrationRule.cc, xFEM/src/xIntegrationRule.h, xFEM/src/xRegion.h,
          xFEM/src/xRegularGrid.h, xFEM/src/xMeshFwd.h, xFEM/src/xSubMesh.h,
          xFEM/src/xSubMeshManager.cc, xFEM/src/xSubMeshManager.h, xFEM/src/xValue.cc,
          xFEM/src/xValue.h, xFEM/src/xValueManager.h, xFEM/src/xValue_imp.h
          xFEM/src/xVectorField.cc (include xRegion instead), xFEM/src/xVectorField.h,
          xFEM/src/xVectorLevelSet.h, xGeom/src/xDistanceNearestPointGenerator.h
          (use "xAOMDEntityUtil.h"), xInterface/xOctree/src/surf2LevelSet.h,
          xPhysics/src/xpThermic.cc,
          xTLS/src/TLSGeomInterfaceSignedVectorDistanceFunction.h,
          xTLS/src/TLSGeomInterfaceSignedVectorLevelSet.h, xTLS/src/TLSVelocity.h,
          xTLS/src/xRefCutToCGAL.cc
    
        - include xMesh.h in the following files :
          xCrack/src/ExportSensors.cc, xCrack/src/JintModalParks.cc,
          xCrack/src/lCrack.cc,  xCrack/src/xcFront.cc
          xCrack/src/xcFrontDomain.cc,  xCrack/src/xcFrontDomainManager.cc
          xCrack/src/xcInteractionIntegralsOnCrack.cc,
          xCut/xDoubleCut/src/xPolytopeToAOMDElem.cc
          xCut/xDoubleCut/src/xSignedVectorLevelSetEnrichment.h,
          xExport/src/xPostPro.cc,  xExt/src/SpaceLagrangeDualBoundary.cc,
          xExt/src/SpaceLagrangeDualMinBoundary.cc,
          xExt/src/SpaceLagrangeDualNewBoundary.cc, xExt/src/SpaceLagrangeDualSimple.cc,
          xFEM/src/xApproxFunctionCorrectedShifted.cc, xFEM/src/xCommandOnGeomElem.h,
          xFEM/src/xExtendShapeFcts.h, xFEM/src/xGatherMesh.cc,
          xFEM/src/xNonLocalInfoForKeysAndFcts.h, xFEM/src/xRegularGrid.cc,
          xFEM/src/xSubMesh.cc, xFEM/src/xValueCreators.cc,
          xInterface/xOctree/src/surf2LevelSet.cc, xPhysics/src/xPhysSurf3.cc,
          xPhysics/src/xpElastic.cc, xPhysics/src/xpFluidMechanics.cc,
          xTLS/src/TLSGeomInterfaceSignedVectorDistanceFunction.cc
    
         -removed useless forward declaration of xMesh in :
          xCrack/src/xcFrontSpaces.h, xCrack/src/xcInteractionIntegralsOnCrack.h,
          xCut/xLegacySimpleCut/src/xPhysSurfByTagging.h,
          xCut/xLegacySimpleCut/src/xPhysSurfParameter.h, xExport/src/xSensors.h,
          xExt/src/xPhysBand.h, xPhysics/src/xpFluidMechanics.cc,
          xTLS/src/TLSEnrichment.h, xTLS/src/TLSGeomInterfaceVectorLevelSet.h,
          xTLS/src/TLSValueCreatorRampHeaviside.h, xTLS/src/TLSVelocity.h,
          xTLS/src/xEvalWeightedDirectionalAverage.h
    
         -replaced include xIntegrationRule.h by xIntegrationRuleFwd.h
          or remove xIntegrationRule.h :
          xCut/xDoubleCut/src/xPhysDomain.h, xFEM/src/xAlgorithm.h, xFEM/src/xField.h,
          xFEM/src/xIntegrationRule.h, xFEM/src/xSpace.h, xTLS/src/TLSGeomInterface.h
    
        - Trellis/Util/Util/include/mPoint.h
          Added stream operator <<  for mPoint.
        - lCrack.cc/h :
          int lCrack::dim() const,  void lCrack::setV1Ddebug(std::function ...),
          lCrack::~lCrack  are moved to lCrack.cc.
          using namespace xfem moved from global scope to inside namespace xcrack
        - xCut/xDoubleCut/src/xElemCutDomainData.cc :
          now include "mVertex.h"
        - xCut/xLegacySimpleCut/src/xPhysSurf.cc/h  :
          int   xPhysSurfBase::dim() const,   xPhysSurf::~xPhysSurf() and
          xPhysSurfOctree::xPhysSurfOctree  implementations moved to xPhysSurf.cc
        - xExt/src/SpaceLagrangeDualBoundary.cc/h :
          OutsideVertex::OutsideVertex(const xLevelSet* f) and
          AOMD::mEntity* OutsideVertex::operator()(AOMD::mEntity* e) are now
          implemented in the .cc file
        - xFEM/src/xData.cc : data member in xData::nb_evo now initialized to 0
        - xFEM/src/xElement.cc :
          xElement::xyz2uvw(const Trellis_Util::mPoint& xyz) this function that
          invert the mapping was constructing a temporary xMesh in case of QHAD and HEX,
          containing only one element..  This was way more to much than needed,
          since Trellis_Util::Mapping used in this function just need an mEntity.
          I replaced the construction of an xMesh by the construction of the correct
          mEntity only.
        - xFEM/src/xLevelSet.h :  added now needed include unordered_map
        - xFEM/src/xLevelSetOperators.cc :
          call xRegion::dim() instead of xRegion::getMesh()->dim() rational :
          remove deps on xMesh, clearer.
        - xFEM/src/xLevelSetOperators.h :
          removed using std::cout/endl at global scope, added include xEntityFilter
        - xFEM/src/xMesh.h :
          removed using std::map, std::vector, std::set, std::string at xfem scope,
          now   include  xMeshFwd.h, getSupportBoundary and getSubentities now moved to
          xInterface/AOMD/general/src/xAOMDEntityUtil.h
        - xFEM/src/xRegularGrid.h/cc :  xRegularGrid::xRegularGrid implementation
          moved to .cc
        - xFEM/src/xRegularGrid.h : #define TOL 1.e-06 at xfem scope,
          replaced by  constexpr static  double TOL  = 1.e-06; in xfem::xRegularGrid
        - xFEM/src/xSpace.cc now include "xIntegrationRule.h"
        - xFEM/src/xValueCreatorLinkOnFrontFiltered.cc, in ::buildTable
          a non-standard variable size array was used (vertices).
          Replaced by a std::vector.
        - xFEM/src/xVectorField.cc some loop where rewritted.
        - xInterface/xOctree/src/surf2LevelSet.cc implementation of  surface2LevelSet
          constructors,  computeWeightedPseudoNormals::proceed(),
          surface2LevelSetNarrowBand  are moved to the .cc
          rational : these functions call some xMesh member functions)
        - xPhysics/src/xpEval.h/cc ElementLengthMaterialVariablesVisitor_c moved to .cc
          rational : constructor use some member of xMesh.
        - xPhysics/src/xpPhysicalFormulation.cc  : used xRegion member dim, begin and end instead of asking the same on a region "all" meshes's. (rational : reduce deps on xMesh, clearer code)
    
        ADDED std:: in front of standard symbol
         By cascading inclusion, using namespace std was visible in some files
         (comming from some AOMD include). After the change in the inclusion hierachy,
         namespace std is not visible any more in some header file. I choose to not add
         using namespace std at global scope of a header file, and add to std::
         in front of standard symbols. Concerned files :
         xCrack/src/JintParks.h, xCrack/src/xcFrontManager.cc,
         xCut/xDoubleCut/src/xSignedVectorLevelSet.h,
         xCut/xDoubleCut/src/xSignedVectorLevelSet_imp.h,
         xExport/src/xExportAlgorithm.cc, xExport/src/xPostProVTU.h,
         xExt/src/MaterialCommand.h, xExt/src/SpaceLagrangeDualNewBoundary.cc,
         xExt/src/SpaceLagrangeDualNewBoundary.h, xExt/src/ValueOldAndCurrent.h,
         xFEM/src/xAlgorithm.h, xFEM/src/xDistStateOfValue_imp.h, xFEM/src/xElement.cc,
         xFEM/src/xMaterialSensitivity.h, xFEM/src/xSpacePolynomialQH.h,
         xFEM/src/xSubMesh.h, xFEM/src/xValueLinearCombination_imp.h,
         xFEM/src/xVectorLevelSet_imp.h, xFastMarching/src/FMUpdater.h,
         xTLS/src/TLSGeomInterface.h, xTLS/src/TLSVelocityModeEshelby_imp.h,
         xTLS/src/xEvalLSAdvanceFromImposedConditions_imp.h
    
        ADDED using namespace std :
         Same reason as above, I added using namespace std in .cc files that needed it :
          - xCrack/src/xcFrontDomain.cc, xCrack/src/xcFrontSpaceManager.cc,
            xExport/src/xPostProMSH.cc, xExt/src/SpaceLagrangeDualNewBoundary.h,
            xExt/src/SpaceLagrangeDualSimple.cc
    
        removed using namespace xfem :
          xFEM/src/xGatherMesh.h
    
        replace some old style cast by static_cast :
          - xExt/src/SpaceLagrangeDualNewBoundary.cc
    9c703287