suanPan
RigidWallPenalty.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 ******************************************************************************/
29#ifndef RIGIDWALLPENALTY_H
30#define RIGIDWALLPENALTY_H
31
32#include "Constraint.h"
33#include <Domain/NodeHelper.hpp>
34
36protected:
37 template<DOF... D> void set_handler() { throw std::logic_error("not implemented"); }
38
39 const unsigned n_dim;
40
41 const double alpha;
42
43 const vec edge_a, edge_b;
44 const vec origin, outer_norm;
45 const double length_a = 0., length_b = 0.;
46
47 bool (*checker_handler)(const shared_ptr<Node>&) = nullptr;
48 Col<double> (*current_velocity_handler)(const shared_ptr<Node>&) = nullptr;
49 Col<double> (*incre_acceleration_handler)(const shared_ptr<Node>&) = nullptr;
50 Col<double> (*trial_position_handler)(const shared_ptr<Node>&) = nullptr;
51 Col<double> (*trial_displacement_handler)(const shared_ptr<Node>&) = nullptr;
52 Col<double> (*trial_velocity_handler)(const shared_ptr<Node>&) = nullptr;
53 Col<double> (*trial_acceleration_handler)(const shared_ptr<Node>&) = nullptr;
54
55public:
56 RigidWallPenalty(unsigned, unsigned, unsigned, vec&&, vec&&, double, unsigned);
57 RigidWallPenalty(unsigned, unsigned, unsigned, vec&&, vec&&, vec&&, double, unsigned);
58
59 int process(const shared_ptr<DomainBase>&) override;
60
61 void commit_status() override;
62 void clear_status() override;
63 void reset_status() override;
64};
65
66template<> inline void RigidWallPenalty::set_handler<DOF::U1>() {
67 checker_handler = check_dof_definition<DOF::U1>;
68 current_velocity_handler = get_current_velocity<DOF::U1>;
69 incre_acceleration_handler = get_incre_acceleration<DOF::U1>;
70 trial_position_handler = get_trial_position<DOF::U1>;
71 trial_displacement_handler = get_trial_displacement<DOF::U1>;
72 trial_velocity_handler = get_trial_velocity<DOF::U1>;
73 trial_acceleration_handler = get_trial_acceleration<DOF::U1>;
74}
75
76template<> inline void RigidWallPenalty::set_handler<DOF::U1, DOF::U2>() {
77 checker_handler = check_dof_definition<DOF::U1, DOF::U2>;
78 current_velocity_handler = get_current_velocity<DOF::U1, DOF::U2>;
79 incre_acceleration_handler = get_incre_acceleration<DOF::U1, DOF::U2>;
80 trial_position_handler = get_trial_position<DOF::U1, DOF::U2>;
81 trial_displacement_handler = get_trial_displacement<DOF::U1, DOF::U2>;
82 trial_velocity_handler = get_trial_velocity<DOF::U1, DOF::U2>;
83 trial_acceleration_handler = get_trial_acceleration<DOF::U1, DOF::U2>;
84}
85
86template<> inline void RigidWallPenalty::set_handler<DOF::U1, DOF::U2, DOF::U3>() {
87 checker_handler = check_dof_definition<DOF::U1, DOF::U2, DOF::U3>;
88 current_velocity_handler = get_current_velocity<DOF::U1, DOF::U2, DOF::U3>;
89 incre_acceleration_handler = get_incre_acceleration<DOF::U1, DOF::U2, DOF::U3>;
90 trial_position_handler = get_trial_position<DOF::U1, DOF::U2, DOF::U3>;
91 trial_displacement_handler = get_trial_displacement<DOF::U1, DOF::U2, DOF::U3>;
92 trial_velocity_handler = get_trial_velocity<DOF::U1, DOF::U2, DOF::U3>;
93 trial_acceleration_handler = get_trial_acceleration<DOF::U1, DOF::U2, DOF::U3>;
94}
95
97public:
98 RigidWallPenalty1D(unsigned, unsigned, unsigned, vec&&, vec&&, double);
99};
100
102public:
103 RigidWallPenalty2D(unsigned, unsigned, unsigned, vec&&, vec&&, double);
104 RigidWallPenalty2D(unsigned, unsigned, unsigned, vec&&, vec&&, vec&&, double);
105};
106
108public:
109 RigidWallPenalty3D(unsigned, unsigned, unsigned, vec&&, vec&&, double);
110 RigidWallPenalty3D(unsigned, unsigned, unsigned, vec&&, vec&&, vec&&, double);
111};
112
113#endif
114
A Constraint class.
Definition: Constraint.h:36
Definition: RigidWallPenalty.h:96
RigidWallPenalty1D(unsigned, unsigned, unsigned, vec &&, vec &&, double)
Definition: RigidWallPenalty.cpp:79
Definition: RigidWallPenalty.h:101
RigidWallPenalty2D(unsigned, unsigned, unsigned, vec &&, vec &&, double)
Definition: RigidWallPenalty.cpp:82
Definition: RigidWallPenalty.h:107
RigidWallPenalty3D(unsigned, unsigned, unsigned, vec &&, vec &&, double)
Definition: RigidWallPenalty.cpp:93
A RigidWall class.
Definition: RigidWallPenalty.h:35
Col< double >(* trial_acceleration_handler)(const shared_ptr< Node > &)
Definition: RigidWallPenalty.h:53
Col< double >(* trial_velocity_handler)(const shared_ptr< Node > &)
Definition: RigidWallPenalty.h:52
const vec origin
Definition: RigidWallPenalty.h:44
bool(* checker_handler)(const shared_ptr< Node > &)
Definition: RigidWallPenalty.h:47
void clear_status() override
Definition: RigidWallPenalty.cpp:75
const double alpha
Definition: RigidWallPenalty.h:41
Col< double >(* trial_displacement_handler)(const shared_ptr< Node > &)
Definition: RigidWallPenalty.h:51
Col< double >(* trial_position_handler)(const shared_ptr< Node > &)
Definition: RigidWallPenalty.h:50
void reset_status() override
Definition: RigidWallPenalty.cpp:77
const unsigned n_dim
Definition: RigidWallPenalty.h:39
int process(const shared_ptr< DomainBase > &) override
This method provides all necessary pieces of typical constraints/loads required, including additional...
Definition: RigidWallPenalty.cpp:40
const double length_b
Definition: RigidWallPenalty.h:45
const vec edge_a
Definition: RigidWallPenalty.h:43
void commit_status() override
Definition: RigidWallPenalty.cpp:73
const double length_a
Definition: RigidWallPenalty.h:45
Col< double >(* incre_acceleration_handler)(const shared_ptr< Node > &)
Definition: RigidWallPenalty.h:49
void set_handler()
Definition: RigidWallPenalty.h:37
Col< double >(* current_velocity_handler)(const shared_ptr< Node > &)
Definition: RigidWallPenalty.h:48
const vec outer_norm
Definition: RigidWallPenalty.h:44
RigidWallPenalty(unsigned, unsigned, unsigned, vec &&, vec &&, double, unsigned)
Definition: RigidWallPenalty.cpp:22
const vec edge_b
Definition: RigidWallPenalty.h:43
DOF
Definition: DOF.h:29