Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F80582920
test_structural_mechanics_model_fixture.hh
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sun, Sep 1, 12:34
Size
2 KB
Mime Type
text/x-c++
Expires
Tue, Sep 3, 12:34 (2 d)
Engine
blob
Format
Raw Data
Handle
20329635
Attached To
rAKA akantu
test_structural_mechanics_model_fixture.hh
View Options
/* -------------------------------------------------------------------------- */
#include "element_class_structural.hh"
#include "structural_mechanics_model.hh"
#include "test_gtest_utils.hh"
/* -------------------------------------------------------------------------- */
#include <gtest/gtest.h>
#include <vector>
/* -------------------------------------------------------------------------- */
#ifndef __AKANTU_TEST_STRUCTURAL_MECHANICS_MODEL_FIXTURE_HH__
#define __AKANTU_TEST_STRUCTURAL_MECHANICS_MODEL_FIXTURE_HH__
using namespace akantu;
template <typename type_> class TestStructuralFixture : public ::testing::Test {
public:
static constexpr const ElementType type = type_::value;
static constexpr const size_t spatial_dimension =
ElementClass<type>::getSpatialDimension();
static const UInt ndof = ElementClass<type>::getNbDegreeOfFreedom();
void SetUp() override {
const auto spatial_dimension = this->spatial_dimension;
mesh = std::make_unique<Mesh>(spatial_dimension);
readMesh(makeMeshName());
std::stringstream element_type;
element_type << this->type;
model = std::make_unique<StructuralMechanicsModel>(*mesh, _all_dimensions,
element_type.str());
addMaterials();
model->initFull();
assignMaterials();
setDirichlets();
setNeumanns();
model->solveStep();
}
virtual void readMesh(std::string filename) {
mesh->read(filename, _miot_gmsh_struct);
}
virtual std::string makeMeshName() {
std::stringstream element_type;
element_type << type;
SCOPED_TRACE(element_type.str().c_str());
return element_type.str() + ".msh";
}
void TearDown() override {
model.reset(nullptr);
mesh.reset(nullptr);
}
virtual void addMaterials() = 0;
virtual void assignMaterials() = 0;
virtual void setDirichlets() = 0;
virtual void setNeumanns() = 0;
protected:
std::unique_ptr<Mesh> mesh;
std::unique_ptr<StructuralMechanicsModel> model;
};
template <typename type_>
constexpr ElementType TestStructuralFixture<type_>::type;
template <typename type_>
constexpr size_t TestStructuralFixture<type_>::spatial_dimension;
template <typename type_> const UInt TestStructuralFixture<type_>::ndof;
// using types = gtest_list_t<StructuralTestElementTypes>;
// TYPED_TEST_CASE(TestStructuralFixture, types);
#endif /* __AKANTU_TEST_STRUCTURAL_MECHANICS_MODEL_FIXTURE_HH__ */
Event Timeline
Log In to Comment