Example #1
0
MeshLib::Mesh* constructMesh(MeshLib::Mesh const& mesh)
{
    INFO("Splitting nodes...");
    std::vector<MeshLib::Element*> const& elems = mesh.getElements();
    std::vector<MeshLib::Node*> new_nodes;
    std::vector<MeshLib::Element*> new_elems;
    std::vector<std::vector<std::size_t>> node_map;
    node_map.resize(mesh.getNumberOfNodes());
    for (MeshLib::Element* elem : elems)
    {
        if (elem->getGeomType() == MeshLib::MeshElemType::LINE)
            new_elems.push_back(createElement<MeshLib::Line>(*elem, new_nodes, node_map));
        else if (elem->getGeomType() == MeshLib::MeshElemType::TRIANGLE)
            new_elems.push_back(createElement<MeshLib::Tri>(*elem, new_nodes, node_map));
        else if (elem->getGeomType() == MeshLib::MeshElemType::QUAD)
            new_elems.push_back(createElement<MeshLib::Quad>(*elem, new_nodes, node_map));
        else if (elem->getGeomType() == MeshLib::MeshElemType::TETRAHEDRON)
            new_elems.push_back(createElement<MeshLib::Tet>(*elem, new_nodes, node_map));
        else if (elem->getGeomType() == MeshLib::MeshElemType::HEXAHEDRON)
            new_elems.push_back(createElement<MeshLib::Hex>(*elem, new_nodes, node_map));
        else if (elem->getGeomType() == MeshLib::MeshElemType::PYRAMID)
            new_elems.push_back(createElement<MeshLib::Pyramid>(*elem, new_nodes, node_map));
        else if (elem->getGeomType() == MeshLib::MeshElemType::PRISM)
            new_elems.push_back(createElement<MeshLib::Prism>(*elem, new_nodes, node_map));
        else
        {
            ERR("Error: Unknown element type.");
            return nullptr;
        }
    }

    MeshLib::Properties new_props =
        constructProperties(mesh.getProperties(), new_elems, node_map, new_nodes.size());
    return new MeshLib::Mesh("Unity conform mesh", new_nodes, new_elems, new_props);
}
// Constructor specifying material properties.
HuntCrossleyForce::ContactParameters::ContactParameters
   (double stiffness, double dissipation, double staticFriction, 
    double dynamicFriction, double viscousFriction)
{
    constructProperties();
    set_stiffness(stiffness);
    set_dissipation(dissipation);
    set_static_friction(staticFriction);
    set_dynamic_friction(dynamicFriction);
    set_viscous_friction(viscousFriction);
}
//_____________________________________________________________________________
// Convienience constructor.
ContactGeometry::ContactGeometry(const Vec3& location, const Vec3& orientation, 
    PhysicalFrame& body) : ModelComponent()
{
    setNull();
    constructProperties();

    _body = &body;
    set_body_name(body.getName());
    set_location(location);
    set_orientation(orientation);
}
Example #4
0
ContactMesh::ContactMesh(const std::string& filename,
                         const SimTK::Vec3& location,
                         const SimTK::Vec3& orientation,
                         const PhysicalFrame& frame) :
    ContactGeometry(location, orientation, frame)
{
    setNull();
    constructProperties();
    setFilename(filename);
    if (filename != ""){
        std::ifstream file;
        file.open(filename.c_str());
        if (file.fail())
            throw Exception("Error loading mesh file: "+filename+". The file should exist in same folder with model.\n Model loading is aborted.");
        file.close();
        SimTK::PolygonalMesh mesh;
        mesh.loadFile(filename);
        _geometry.reset(new SimTK::ContactGeometry::TriangleMesh(mesh));
    }
}
Example #5
0
ContactMesh::ContactMesh() 
{
    setNull();
    constructProperties();
}
// Take over ownership of supplied object.
HuntCrossleyForce::HuntCrossleyForce(ContactParameters* params)
{
    constructProperties();
    addContactParameters(params);
}
// Default constructor.
HuntCrossleyForce::HuntCrossleyForce()
{
    constructProperties();
}
// Default constructor.
HuntCrossleyForce::ContactParameters::ContactParameters()
{
    constructProperties();
}
//_____________________________________________________________________________
// Default constructor.
ContactGeometry::ContactGeometry() : ModelComponent()
{
    setNull();
    constructProperties();
}
Example #10
0
//=============================================================================
// CONSTRUCTOR(S) AND DESTRUCTOR
//=============================================================================
//_____________________________________________________________________________
// Default constructor.
Force::Force()
{
    setNull();
    constructProperties();
}
// Construct with supplied contact parameters.
ElasticFoundationForce::ElasticFoundationForce(ContactParameters* params)
{
	constructProperties();
    addContactParameters(params);
}
// Default constructor.
ElasticFoundationForce::ElasticFoundationForce()
{
	constructProperties();
}
// Default constructor.
ElasticFoundationForce::ContactParameters::ContactParameters()
{
    constructProperties();
}
MarkersReference::MarkersReference() : Reference_<SimTK::Vec3>()
{
    constructProperties();
    setAuthors("Ajay Seth");
}