Commit 454108ce authored by Felipe Bordeu's avatar Felipe Bordeu
Browse files

Work on CheckIntegrities

parent 6afb5e9b
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -44,3 +44,11 @@ cdef class CElementFilterEvaluated:
        res = self.cpp_object.ToStr().decode('UTF-8')
        res += "Done"
        return res

def CheckIntegrity(GUI=False):

    return "OK"


if __name__ == '__main__':
    print(CheckIntegrity(True))# pragma: no cover
+12 −0
Original line number Diff line number Diff line
@@ -7,6 +7,7 @@
from libcpp.vector cimport vector
from libcpp.string cimport string

cimport cython
import numpy as np
cimport numpy as cnp
cnp.import_array()
@@ -33,6 +34,8 @@ cdef class CUnstructuredMesh():
    def AddNodalTag(self, name,  cnp.ndarray[CBasicIndexType, ndim=1, mode="c"] ids not None):
        self.cpp_object.AddNodalTag(name, FlattenedMap[Matrix, CBasicIndexType, Dynamic, _1](ids))

    @cython.boundscheck(False)  # Deactivate bounds checking
    @cython.wraparound(False)   # Deactivate negative indexing.
    def SetDataFromPython(self,pyUM):

        pyUM.GetPosOfNodes()
@@ -65,6 +68,15 @@ cdef class CUnstructuredMesh():

def CheckIntegrity(GUI=False):
    obj = CUnstructuredMesh()
    import BasicTools.Containers.ElementNames as ElementNames
    from BasicTools.Containers.UnstructuredMeshCreationTools import CreateCube
    resII = CreateCube([20,20,20],[-1.0,-1.0,-1.0],[2./46, 2./46,2./46])

    resII.nodesTags.CreateTag('nodesTags').SetIds([0,1])
    elements = resII.GetElementsOfType(ElementNames.Triangle_3)
    elements.GetTag("ElemementTag").SetIds([0])
    resII.ConvertDataForNativeTreatment()
    obj.SetDataFromPython(resII)
    print(obj)
    return "OK"

+2 −2
Original line number Diff line number Diff line
@@ -548,13 +548,13 @@ class MonoElementsIntegral(BOO):

def CheckIntegrity(GUI=False):
    import BasicTools.FE.Integration as Integration
    from  BasicTools.FE.Integration import CheckIntegrityIntegrationWithIntegrationPointField
    backup  = Integration.UseCpp

    Integration.UseCpp = False
    res = "ok"
    try:
        from BasicTools.FE.UnstructuredFeaSym import CheckIntegrity as CI
        res = CI(GUI)
        res = CheckIntegrityIntegrationWithIntegrationPointField(GUI)
    except:
        Integration.UseCpp = backup
        raise
+2 −2
Original line number Diff line number Diff line
@@ -152,7 +152,7 @@ cdef class NativeDofNumbering:

def CheckIntegrity(GUI=False):
    import BasicTools.FE.DofNumbering  as DN
    return DN.CheckIntegrityUsingAlgo("DictBase",GUI)
    return DN.CheckIntegrityUsingAlgo("CppBase",GUI)

if __name__ == '__main__':
    print(CheckIntegrity(True))# pragma: no cover
+11 −0
Original line number Diff line number Diff line
@@ -34,3 +34,14 @@ cdef class CSpace:
                if on == "F2" :
                    on = "E"
                self.cpp_object.AddDofTo(name.encode(),ord(on[0].encode()), PBasicIndexType(idxI), PBasicIndexType(idxII) )

def CheckIntegrity(GUI=False):

    from BasicTools.FE.Spaces.FESpaces import AllSpaces
    for name, space in AllSpaces.items():
        obj = CSpace()
        obj.SetDataFromPython(space)
    return "ok"

if __name__ == '__main__':
    print(CheckIntegrity(True))# pragma: no cover
Loading