Chaste Commit::ca8ccdedf819b6e02855bc0e8e6f50bdecbc5208
ImmersedBoundaryElement.cpp
1/*
2
3Copyright (c) 2005-2024, University of Oxford.
4All rights reserved.
5
6University of Oxford means the Chancellor, Masters and Scholars of the
7University of Oxford, having an administrative office at Wellington
8Square, Oxford OX1 2JD, UK.
9
10This file is part of Chaste.
11
12Redistribution and use in source and binary forms, with or without
13modification, are permitted provided that the following conditions are met:
14 * Redistributions of source code must retain the above copyright notice,
15 this list of conditions and the following disclaimer.
16 * Redistributions in binary form must reproduce the above copyright notice,
17 this list of conditions and the following disclaimer in the documentation
18 and/or other materials provided with the distribution.
19 * Neither the name of the University of Oxford nor the names of its
20 contributors may be used to endorse or promote products derived from this
21 software without specific prior written permission.
22
23THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
24AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
27LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
29GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
32OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33
34*/
35
36#include "ImmersedBoundaryElement.hpp"
37#include "Exception.hpp"
38
39template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
41 const std::vector<Node<SPACE_DIM>*>& rNodes)
42 : MutableElement<ELEMENT_DIM, SPACE_DIM>(index, rNodes),
43 mpFluidSource(nullptr),
44 mAverageNodeSpacing(DOUBLE_UNSET),
45 mIsBoundaryElement(false)
46{
47 if constexpr (ELEMENT_DIM == SPACE_DIM)
48 {
49 // Ensure number of nodes is at least 3
50 assert(rNodes.size() > 2);
51 }
52 else
53 {
55 }
56}
57
58template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
62
63template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
65{
66 mpFluidSource = fluidSource;
67}
68
69template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
71{
72 return mpFluidSource;
73}
74
75template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
77{
78 return mCornerNodes;
79}
80
81template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
83{
84 return mAverageNodeSpacing;
85}
86
87template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
89{
90 mAverageNodeSpacing = averageNodeSpacing;
91}
92
93template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
95{
96 return mIsBoundaryElement;
97}
99template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
101{
102 mIsBoundaryElement = isBoundaryElement;
103}
105template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
107{
108 mCornerNodes.push_back(node);
109}
110
112// Specialization for 1d elements //
113// //
114// 1d elements are just edges (lines) //
116
121template<unsigned SPACE_DIM>
123 : MutableElement<1, SPACE_DIM>(index, rNodes),
124 mpFluidSource(nullptr),
125 mAverageNodeSpacing(DOUBLE_UNSET),
126 mIsBoundaryElement(false)
127{
128}
129
130template<unsigned SPACE_DIM>
132{
133 EXCEPTION("SetFluidSource not implemented for 1D");
134}
136template<unsigned SPACE_DIM>
137std::shared_ptr<FluidSource<SPACE_DIM>> ImmersedBoundaryElement<1, SPACE_DIM>::GetFluidSource()
138{
139 EXCEPTION("GetFluidSource not implemented for 1D");
140 return nullptr;
141}
143template<unsigned SPACE_DIM>
146 return mCornerNodes;
147}
148
149template<unsigned SPACE_DIM>
151{
152 return mAverageNodeSpacing;
153}
154
155template<unsigned SPACE_DIM>
157{
158 mAverageNodeSpacing = averageNodeSpacing;
159}
160
161template<unsigned SPACE_DIM>
163{
164 return mIsBoundaryElement;
165}
166
167template<unsigned SPACE_DIM>
169{
170 mIsBoundaryElement = isBoundaryElement;
171}
172
173
174// Explicit instantiation
175template class ImmersedBoundaryElement<0,1>;
176template class ImmersedBoundaryElement<1,1>;
177template class ImmersedBoundaryElement<0,2>;
178template class ImmersedBoundaryElement<1,2>;
179template class ImmersedBoundaryElement<2,2>;
180template class ImmersedBoundaryElement<0,3>;
181template class ImmersedBoundaryElement<1,3>;
182template class ImmersedBoundaryElement<2,3>;
183template class ImmersedBoundaryElement<3,3>;
const double DOUBLE_UNSET
Definition Exception.hpp:57
#define EXCEPTION(message)
#define NEVER_REACHED
void SetAverageNodeSpacing(double averageNodeSpacing)
std::shared_ptr< FluidSource< SPACE_DIM > > GetFluidSource()
std::vector< Node< SPACE_DIM > * > & rGetCornerNodes()
void SetFluidSource(std::shared_ptr< FluidSource< SPACE_DIM > > fluidSource)
void AddCornerNode(Node< SPACE_DIM > *node)
ImmersedBoundaryElement(unsigned index, const std::vector< Node< SPACE_DIM > * > &rNodes)
virtual bool IsElementOnBoundary() const
void SetIsBoundaryElement(bool isBoundaryElement)
Definition Node.hpp:59