suanPan
ExternalMaterial.h
Go to the documentation of this file.
1/*******************************************************************************
2 * Copyright (C) 2017-2024 Theodore Chang
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 ******************************************************************************/
50#ifndef EXTERNALMATERIAL_H
51#define EXTERNALMATERIAL_H
52
53#include <Material/Material.h>
55
56class ExternalMaterial final : public Material {
57 static MaterialType get_type(const ExternalMaterialData&);
58
59 using Interface = void (*)(ExternalMaterialData*, int*);
60
61 std::vector<double> constant;
62
63 Interface cooker;
64
66
67public:
69 unsigned, // unique material tag
70 std::vector<double>&&, // parameter pool
71 void* // handler pointer
72 );
74 ExternalMaterial(ExternalMaterial&&) noexcept = delete;
75 ExternalMaterial& operator=(const ExternalMaterial&) = delete;
76 ExternalMaterial& operator=(ExternalMaterial&&) noexcept = delete;
77 ~ExternalMaterial() override;
78
79 bool validate();
80
81 int initialize(const shared_ptr<DomainBase>&) override;
82
83 void initialize_history(unsigned) override;
84 void set_initial_history(const vec&) override;
85
86 unique_ptr<Material> get_copy() override;
87
88 int update_trial_status(const vec&) override;
89 int update_trial_status(const vec&, const vec&) override;
90
91 int commit_status() override;
92 int reset_status() override;
93 int clear_status() override;
94
95 std::vector<vec> record(OutputType) override;
96};
97
98#endif
99
OutputType
Definition: OutputType.h:23
The DomainBase class is a template.
Definition: DomainBase.h:104
A ExternalMaterial class.
Definition: ExternalMaterial.h:56
ExternalMaterial(unsigned, std::vector< double > &&, void *)
Definition: ExternalMaterial.cpp:27
void initialize_history(unsigned) override
Definition: ExternalMaterial.cpp:96
std::vector< vec > record(OutputType) override
Definition: ExternalMaterial.cpp:151
unique_ptr< Material > get_copy() override
Definition: ExternalMaterial.cpp:100
int update_trial_status(const vec &) override
Definition: ExternalMaterial.cpp:102
void set_initial_history(const vec &) override
Definition: ExternalMaterial.cpp:98
int initialize(const shared_ptr< DomainBase > &) override
Definition: ExternalMaterial.cpp:72
bool validate()
Definition: ExternalMaterial.cpp:64
int reset_status() override
Definition: ExternalMaterial.cpp:135
ExternalMaterial(ExternalMaterial &&) noexcept=delete
int clear_status() override
Definition: ExternalMaterial.cpp:143
int commit_status() override
Definition: ExternalMaterial.cpp:127
A Material abstract base class.
Definition: Material.h:111
MaterialType
Definition: Material.h:34
std::vector< T > vector
Definition: container.h:53
A ExternalMaterialData class.
Definition: ExternalMaterialData.h:51