PSUCompBio / FemTech

Finite Element Modeling Technology
11 stars 7 forks source link

should the 0 1 2 in loop, instead be a loop on ndim? Looks like this is for 3D only. #79

Closed rhk12 closed 5 years ago

rhk12 commented 5 years ago

@enstrophy https://github.com/PSUCompBio/FemTech/blob/2e9178e3a89e3b1b388fe273fda44b0ddf69488d/src/fem/SolidMechanics/GetForce_3D.cpp#L32

enstrophy commented 5 years ago

@rhk12 : There are a few changes that can be done to the code. Will work on this after few more functionalities are added.

Regarding ndim vs 3 : The broad guideline I follow is, If function is specifically for 3D elements ndim is 3 for sure. So 3 can be used instead of ndim. For a generic function common to 2D and 3D, ndim can be used. The rationale behind this is that using the constant 3 might help compiler perform optimizations on the code. Having said that, you will find lots of places where this is not followed. Regarding, GetForce_3D, I think it can be used for 2D as well. I will modify this and push changes.