OPAL (Object Oriented Parallel Accelerator Library) 2024.2
OPAL
AsymmetricEnge.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2017, Chris Rogers
3 * All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are met:
6 * 1. Redistributions of source code must retain the above copyright notice,
7 * this list of conditions and the following disclaimer.
8 * 2. Redistributions in binary form must reproduce the above copyright notice,
9 * this list of conditions and the following disclaimer in the documentation
10 * and/or other materials provided with the distribution.
11 * 3. Neither the name of STFC nor the names of its contributors may be used to
12 * endorse or promote products derived from this software without specific
13 * prior written permission.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
19 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25 * POSSIBILITY OF SUCH DAMAGE.
26 */
27
28#ifndef ENDFIELDMODEL_ASYMMETRICENGE_H_
29#define ENDFIELDMODEL_ASYMMETRICENGE_H_
30
31#include <iostream>
32#include <vector>
33#include <memory>
34
37
38namespace endfieldmodel {
39
58 public:
62 AsymmetricEnge(const std::vector<double> aStart,
63 double x0Start,
64 double lambdaStart,
65 const std::vector<double> aEnd,
66 double x0End,
67 double lambdaEnd);
68
72 inline AsymmetricEnge* clone() const;
73
75 std::ostream& print(std::ostream& out) const;
76
78 double function(double x, int n) const;
79
81 inline double getStartOffset() const;
82
84 inline double getCentreLength() const;
85
87 inline double getEndLength() const;
88
90 inline std::shared_ptr<Enge> getEngeStart() const;
91
93 inline void setEngeStart(std::shared_ptr<Enge> eStart);
94
96 inline std::shared_ptr<Enge> getEngeEnd() const;
97
99 inline void setEngeEnd(std::shared_ptr<Enge> eEnd);
100
102 inline double getX0Start() const;
103
105 inline void setX0Start(double x0);
106
108 inline double getX0End() const;
109
111 inline void setX0End(double x0);
112
114 inline void setMaximumDerivative(size_t n);
115
117 void rescale(double scaleFactor);
118
119 private:
120 AsymmetricEnge(const AsymmetricEnge& rhs);
121 std::shared_ptr<Enge> engeStart_m;
122 std::shared_ptr<Enge> engeEnd_m;
123};
124
125std::shared_ptr<Enge> AsymmetricEnge::getEngeStart() const {
126 return engeStart_m;
127}
128std::shared_ptr<Enge> AsymmetricEnge::getEngeEnd() const {
129 return engeEnd_m;
130}
131void AsymmetricEnge::setEngeStart(std::shared_ptr<Enge> enge) {
132 engeStart_m = enge;
133}
134void AsymmetricEnge::setEngeEnd(std::shared_ptr<Enge> enge) {
135 engeEnd_m = enge;
136}
137
139 return engeStart_m->getX0();
140}
141
143 return engeEnd_m->getX0();
144}
145
147 engeStart_m->setX0(x0);
148}
149
151 engeEnd_m->setX0(x0);
152}
153
155 return new AsymmetricEnge(*this);
156}
157
161
163 return (engeStart_m->getCentreLength()+engeEnd_m->getCentreLength())*2;
164}
165
167 return engeStart_m->getCentreLength()/2;
168}
169
171 return (engeStart_m->getEndLength()+engeEnd_m->getEndLength())/2;
172}
173}
174
175#endif
176
std::shared_ptr< Enge > getEngeStart() const
void setEngeEnd(std::shared_ptr< Enge > eEnd)
std::ostream & print(std::ostream &out) const
AsymmetricEnge * clone() const
double function(double x, int n) const
void setEngeStart(std::shared_ptr< Enge > eStart)
std::shared_ptr< Enge > getEngeEnd() const
void rescale(double scaleFactor)
std::shared_ptr< Enge > engeEnd_m
std::shared_ptr< Enge > engeStart_m
static void setEngeDiffIndices(size_t n)
Definition Enge.cpp:91