suanPan
ElementTemplate.h
Go to the documentation of this file.
1 /*******************************************************************************
2  * Copyright (C) 2017-2022 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  ******************************************************************************/
30 #ifndef ELEMENTTEMPLATE_H
31 #define ELEMENTTEMPLATE_H
32 
33 #include "MaterialElement.h"
34 
35 class ElementTemplate final : public MaterialElement2D {
36  // As a universal practice, we define two static constants to
37  // represent the number of nodes and the number of DoFs.
38  // This is not necessary but only for clearness.
39  static constexpr unsigned m_node = 3, m_dof = 2, m_size = m_node * m_dof;
40 
41  double thickness = 0.;
42  double area = 0.;
44  mat strain_mat;
45 
46  unique_ptr<Material> m_material;
47 public:
48  ElementTemplate(unsigned, uvec&&, unsigned, double = 1.);
49 
50  int initialize(const shared_ptr<DomainBase>&) override;
51 
52  int update_status() override;
53 
54  int commit_status() override;
55  int clear_status() override;
56  int reset_status() override;
57 };
58 
59 #endif
60 
The ElementTemplate class illustrates the basic formulation a typical Element class used in FEM analy...
Definition: ElementTemplate.h:35
ElementTemplate(unsigned, uvec &&, unsigned, double=1.)
Here we target our ElementTemplate class to fulfill the functionality of a constant stress triangular...
Definition: ElementTemplate.cpp:45
int update_status() override
Now we handle the status update method. We get trial displacement via build-in method and pass trial ...
Definition: ElementTemplate.cpp:143
int commit_status() override
Simply call corresponding methods in material objects. If the element itself has history variables,...
Definition: ElementTemplate.cpp:157
int initialize(const shared_ptr< DomainBase > &) override
As explained before, this method get all necessary information, which includes getting copies of Mate...
Definition: ElementTemplate.cpp:75
int clear_status() override
Definition: ElementTemplate.cpp:159
int reset_status() override
Definition: ElementTemplate.cpp:161
Definition: MaterialElement.h:62
Definition: shapeFunction.h:50