MCPcopy Create free account
hub / github.com/PyMesh/PyMesh / create

Method create

tools/Assembler/ShapeFunctions/ShapeFunction.cpp:13–36  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11using namespace PyMesh;
12
13ShapeFunction::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}

Callers

nothing calls this directly

Calls 5

RuntimeErrorClass · 0.85
NotImplementedErrorClass · 0.85
getDimMethod · 0.45
getNodePerElementMethod · 0.45
strMethod · 0.45

Tested by

no test coverage detected