| 11 | using namespace PyMesh; |
| 12 | |
| 13 | ShapeFunction::Ptr ShapeFunction::create( |
| 14 | ShapeFunction::FEMeshPtr mesh, const std::string& func_type) { |
| 15 | const size_t dim = mesh->getDim(); |
| 16 | const size_t nodes_per_element = mesh->getNodePerElement(); |
| 17 | if (func_type == "linear") { |
| 18 | if (dim == 2 && nodes_per_element == 3) { |
| 19 | return Ptr(new LinearShapeFunctionOverTriangle(mesh)); |
| 20 | } else if (dim == 3 && nodes_per_element == 3) { |
| 21 | return Ptr(new LinearShapeFunctionOverTriangle(mesh)); |
| 22 | } else if (dim == 3 && nodes_per_element == 4) { |
| 23 | return Ptr(new LinearShapeFunctionOverTetrahedron(mesh)); |
| 24 | } else { |
| 25 | std::stringstream err_msg; |
| 26 | err_msg << "Linear shape function is incompatible with " << nodes_per_element |
| 27 | << " nodes per element in " << dim << "D."; |
| 28 | throw RuntimeError(err_msg.str()); |
| 29 | } |
| 30 | } else { |
| 31 | std::stringstream err_msg; |
| 32 | err_msg << "Shape function type \"" << func_type |
| 33 | << "\" is not supported yet."; |
| 34 | throw NotImplementedError(err_msg.str()); |
| 35 | } |
| 36 | } |
nothing calls this directly
no test coverage detected