feat: add analysis model objects
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
#pragma once
|
||||
|
||||
namespace fesa::boundary {
|
||||
|
||||
enum class BoundaryConditionKind {
|
||||
SinglePointConstraint
|
||||
};
|
||||
|
||||
class BoundaryCondition {
|
||||
public:
|
||||
virtual ~BoundaryCondition() = default;
|
||||
|
||||
virtual BoundaryConditionKind kind() const noexcept = 0;
|
||||
};
|
||||
|
||||
} // namespace fesa::boundary
|
||||
@@ -0,0 +1,26 @@
|
||||
#pragma once
|
||||
|
||||
#include "fesa/boundary/BoundaryCondition.hpp"
|
||||
#include "fesa/core/ModelTypes.hpp"
|
||||
|
||||
namespace fesa::boundary {
|
||||
|
||||
using fesa::core::Dof;
|
||||
using fesa::core::NodeId;
|
||||
|
||||
class SinglePointConstraint final : public BoundaryCondition {
|
||||
public:
|
||||
SinglePointConstraint(NodeId node_id, Dof dof, double value);
|
||||
|
||||
BoundaryConditionKind kind() const noexcept override;
|
||||
NodeId nodeId() const noexcept;
|
||||
Dof dof() const noexcept;
|
||||
double value() const noexcept;
|
||||
|
||||
private:
|
||||
NodeId node_id_;
|
||||
Dof dof_;
|
||||
double value_;
|
||||
};
|
||||
|
||||
} // namespace fesa::boundary
|
||||
@@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "fesa/boundary/BoundaryCondition.hpp"
|
||||
#include "fesa/core/BoundaryCondition.hpp"
|
||||
#include "fesa/core/ElementDefinition.hpp"
|
||||
#include "fesa/core/LoadDefinition.hpp"
|
||||
@@ -8,8 +9,12 @@
|
||||
#include "fesa/core/Node.hpp"
|
||||
#include "fesa/core/PropertyDefinition.hpp"
|
||||
#include "fesa/core/StepDefinition.hpp"
|
||||
#include "fesa/element/Element.hpp"
|
||||
#include "fesa/load/Load.hpp"
|
||||
#include "fesa/material/Material.hpp"
|
||||
|
||||
#include <cstddef>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
@@ -27,6 +32,10 @@ public:
|
||||
std::size_t addBoundaryCondition(BoundaryCondition condition);
|
||||
std::size_t addNodalLoad(NodalLoadDefinition load);
|
||||
void addStep(LinearStaticStepDefinition step);
|
||||
void addElementObject(std::unique_ptr<fesa::element::Element> element);
|
||||
void addMaterialObject(std::unique_ptr<fesa::material::Material> material);
|
||||
std::size_t addLoadObject(std::unique_ptr<fesa::load::Load> load);
|
||||
std::size_t addBoundaryObject(std::unique_ptr<fesa::boundary::BoundaryCondition> boundary);
|
||||
|
||||
const Node* findNode(NodeId id) const noexcept;
|
||||
const Node& node(NodeId id) const;
|
||||
@@ -62,6 +71,22 @@ public:
|
||||
const LinearStaticStepDefinition& step(StepId id) const;
|
||||
std::size_t stepCount() const noexcept;
|
||||
|
||||
const fesa::element::Element* findElementObject(ElementId id) const noexcept;
|
||||
const fesa::element::Element& elementObject(ElementId id) const;
|
||||
std::size_t elementObjectCount() const noexcept;
|
||||
|
||||
const fesa::material::Material* findMaterialObject(MaterialId id) const noexcept;
|
||||
const fesa::material::Material& materialObject(MaterialId id) const;
|
||||
std::size_t materialObjectCount() const noexcept;
|
||||
|
||||
const fesa::load::Load* findLoadObject(std::size_t index) const noexcept;
|
||||
const fesa::load::Load& loadObject(std::size_t index) const;
|
||||
std::size_t loadObjectCount() const noexcept;
|
||||
|
||||
const fesa::boundary::BoundaryCondition* findBoundaryObject(std::size_t index) const noexcept;
|
||||
const fesa::boundary::BoundaryCondition& boundaryObject(std::size_t index) const;
|
||||
std::size_t boundaryObjectCount() const noexcept;
|
||||
|
||||
private:
|
||||
std::unordered_map<NodeId, Node> nodes_;
|
||||
std::unordered_map<ElementId, ElementDefinition> elements_;
|
||||
@@ -72,6 +97,10 @@ private:
|
||||
std::vector<BoundaryCondition> boundary_conditions_;
|
||||
std::vector<NodalLoadDefinition> nodal_loads_;
|
||||
std::unordered_map<StepId, LinearStaticStepDefinition> steps_;
|
||||
std::unordered_map<ElementId, std::unique_ptr<fesa::element::Element>> element_objects_;
|
||||
std::unordered_map<MaterialId, std::unique_ptr<fesa::material::Material>> material_objects_;
|
||||
std::vector<std::unique_ptr<fesa::load::Load>> load_objects_;
|
||||
std::vector<std::unique_ptr<fesa::boundary::BoundaryCondition>> boundary_objects_;
|
||||
};
|
||||
|
||||
} // namespace fesa::core
|
||||
|
||||
@@ -10,6 +10,8 @@ class Node {
|
||||
public:
|
||||
Node(NodeId id, double x, double y, double z);
|
||||
|
||||
static constexpr std::size_t dofCount() noexcept { return kDofPerNode; }
|
||||
|
||||
NodeId id() const noexcept;
|
||||
double x() const noexcept;
|
||||
double y() const noexcept;
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
#pragma once
|
||||
|
||||
#include "fesa/core/ElementDefinition.hpp"
|
||||
|
||||
#include <array>
|
||||
#include <cstddef>
|
||||
|
||||
namespace fesa::element {
|
||||
|
||||
using fesa::core::ElementId;
|
||||
using fesa::core::ElementType;
|
||||
using fesa::core::NodeId;
|
||||
using fesa::core::PropertyId;
|
||||
|
||||
class Element {
|
||||
public:
|
||||
virtual ~Element() = default;
|
||||
|
||||
virtual ElementId id() const noexcept = 0;
|
||||
virtual ElementType type() const noexcept = 0;
|
||||
virtual std::size_t nodeCount() const noexcept = 0;
|
||||
virtual const std::array<NodeId, 4>& connectivity() const noexcept = 0;
|
||||
virtual PropertyId propertyId() const noexcept = 0;
|
||||
};
|
||||
|
||||
} // namespace fesa::element
|
||||
@@ -0,0 +1,24 @@
|
||||
#pragma once
|
||||
|
||||
#include "fesa/element/Element.hpp"
|
||||
|
||||
namespace fesa::element {
|
||||
|
||||
class Mitc4Element final : public Element {
|
||||
public:
|
||||
Mitc4Element(ElementId id, std::array<NodeId, 4> connectivity, PropertyId property_id);
|
||||
|
||||
ElementId id() const noexcept override;
|
||||
ElementType type() const noexcept override;
|
||||
std::size_t nodeCount() const noexcept override;
|
||||
std::size_t dofCount() const noexcept;
|
||||
const std::array<NodeId, 4>& connectivity() const noexcept override;
|
||||
PropertyId propertyId() const noexcept override;
|
||||
|
||||
private:
|
||||
ElementId id_;
|
||||
std::array<NodeId, 4> connectivity_;
|
||||
PropertyId property_id_;
|
||||
};
|
||||
|
||||
} // namespace fesa::element
|
||||
@@ -0,0 +1,16 @@
|
||||
#pragma once
|
||||
|
||||
namespace fesa::load {
|
||||
|
||||
enum class LoadKind {
|
||||
Nodal
|
||||
};
|
||||
|
||||
class Load {
|
||||
public:
|
||||
virtual ~Load() = default;
|
||||
|
||||
virtual LoadKind kind() const noexcept = 0;
|
||||
};
|
||||
|
||||
} // namespace fesa::load
|
||||
@@ -0,0 +1,26 @@
|
||||
#pragma once
|
||||
|
||||
#include "fesa/core/ModelTypes.hpp"
|
||||
#include "fesa/load/Load.hpp"
|
||||
|
||||
namespace fesa::load {
|
||||
|
||||
using fesa::core::Dof;
|
||||
using fesa::core::NodeId;
|
||||
|
||||
class NodalLoad final : public Load {
|
||||
public:
|
||||
NodalLoad(NodeId node_id, Dof dof, double value);
|
||||
|
||||
LoadKind kind() const noexcept override;
|
||||
NodeId nodeId() const noexcept;
|
||||
Dof dof() const noexcept;
|
||||
double value() const noexcept;
|
||||
|
||||
private:
|
||||
NodeId node_id_;
|
||||
Dof dof_;
|
||||
double value_;
|
||||
};
|
||||
|
||||
} // namespace fesa::load
|
||||
@@ -0,0 +1,21 @@
|
||||
#pragma once
|
||||
|
||||
#include "fesa/material/Material.hpp"
|
||||
|
||||
namespace fesa::material {
|
||||
|
||||
class LinearElasticMaterial final : public Material {
|
||||
public:
|
||||
LinearElasticMaterial(MaterialId id, double young_modulus, double poisson_ratio);
|
||||
|
||||
MaterialId id() const noexcept override;
|
||||
double youngModulus() const noexcept;
|
||||
double poissonRatio() const noexcept;
|
||||
|
||||
private:
|
||||
MaterialId id_;
|
||||
double young_modulus_;
|
||||
double poisson_ratio_;
|
||||
};
|
||||
|
||||
} // namespace fesa::material
|
||||
@@ -0,0 +1,16 @@
|
||||
#pragma once
|
||||
|
||||
#include "fesa/core/ModelTypes.hpp"
|
||||
|
||||
namespace fesa::material {
|
||||
|
||||
using fesa::core::MaterialId;
|
||||
|
||||
class Material {
|
||||
public:
|
||||
virtual ~Material() = default;
|
||||
|
||||
virtual MaterialId id() const noexcept = 0;
|
||||
};
|
||||
|
||||
} // namespace fesa::material
|
||||
@@ -0,0 +1,24 @@
|
||||
#pragma once
|
||||
|
||||
#include "fesa/core/ModelTypes.hpp"
|
||||
|
||||
namespace fesa::property {
|
||||
|
||||
using fesa::core::MaterialId;
|
||||
using fesa::core::PropertyId;
|
||||
|
||||
class ShellProperty {
|
||||
public:
|
||||
ShellProperty(PropertyId id, MaterialId material_id, double thickness);
|
||||
|
||||
PropertyId id() const noexcept;
|
||||
MaterialId materialId() const noexcept;
|
||||
double thickness() const noexcept;
|
||||
|
||||
private:
|
||||
PropertyId id_;
|
||||
MaterialId material_id_;
|
||||
double thickness_;
|
||||
};
|
||||
|
||||
} // namespace fesa::property
|
||||
Reference in New Issue
Block a user