Greg-Hamel / FEMur

Simple Finite Element Model (FEM) Library
MIT License
0 stars 0 forks source link

Implement single shape function calculation per element type. #9

Closed Greg-Hamel closed 7 years ago

Greg-Hamel commented 7 years ago

In the current implementation, every element created will calculate its own shape functions. If multiple element of the same type (i.e. pre-defined Tria6) are created all instances of this class will create their own shape functions. These shape functions will all be the same because they are based on the reference element and not the real coordinates.

This process will take away a lot of time in the process.

I will need to update the algorithm to only calculate it with the first instance.

Greg-Hamel commented 7 years ago

A first guess of what could be done is using a class variable to keep track of whether or not the shape function has been calculated in the first place.

I will implement this soon enough.

Here is a quick snippet of what I am talking about:

class A(self):
    Ne_ref = None
    __init__(self):
        self.Ne_ref = None

    def get_Ne_ref(self):
        if A.Ne_ref is None:
            <Get Shape Function Code>
            A.Ne_ref = <result>
            self.Ne_ref = A.Ne_ref
        else:
            self.Ne_ref = A.Ne_ref
Greg-Hamel commented 7 years ago

This change was made to all pre-defined element2D sub-classes, because if more than one type of element is evaluated in the code, each type of elements' shape functions need to be independent (different from other element type.)