nutofem / nuto

NuTo - yet another finite element library
https://nuto.readthedocs.io
Boost Software License 1.0
17 stars 5 forks source link

Remove `ElementShapeFunctions.h/cpp` #210

Closed Psirus closed 6 years ago

Psirus commented 6 years ago

I think this ElementShapeFunctions.h/cpp file is way to big, and collects all shape functions for no good reason. And it shows in names like DerivativeShapeFunctionsTriangleOrder1, which could just be named DerivativeShapeFunctions at the appropriate interpolation class. So I think moving that there is the nicer approach. In 23b8c23a I have tried that for TriangleLinear. Does anyone see a problem with continuing that?

TTitscher commented 6 years ago

I am not sure about this one:

What if, for now, we provide them as static functions in the corresponding classes like:

// class InterpolaitonTriangleLinear
static Eigen::Fix ShapeFunctions(ip){...}

Eigen::Dynamic GetShapeFunctions(ip) const override
{
return ShapeFunctions(ip);
}

The big file is gone, the change is also mainly copy-paste and we keep the option on fixed size calculations. edit: Plus, we would have them available as static functions, which can be handy, e.g. in tests

Psirus commented 6 years ago

It adds a bit of extra code, since everything is now there twice (see InterpolationTriangleLinear.h and InterpolationTriangleLinear.cpp), but I think its fine.

joergfunger commented 6 years ago

Why can't these methods that return shape functions and derivatives be always static?

TTitscher commented 6 years ago

They have to implement the InterpolationInterface. And virtual methods cannot be static.

pmueller2 commented 6 years ago

The files are deleted in #250. Most content moved to the respective interpolation classes.