Loading [MathJax]/extensions/TeX/AMSmath.js
ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages Concepts
Constant.hpp
Go to the documentation of this file.
1/*
2 * Copyright (C) 2010-2022 The ESPResSo project
3 *
4 * This file is part of ESPResSo.
5 *
6 * ESPResSo is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * ESPResSo is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19#ifndef CORE_EXTERNAL_FIELD_FIELDS_CONSTANT_HPP
20#define CORE_EXTERNAL_FIELD_FIELDS_CONSTANT_HPP
21
22#include "jacobian_type.hpp"
23#include <utils/Vector.hpp>
24
25#include <cstddef>
26
27namespace FieldCoupling {
28namespace Fields {
29/**
30 * @brief A vector field that is constant in space.
31 */
32template <typename T, std::size_t codim> class Constant {
33public:
34 using value_type =
36 using jacobian_type = detail::jacobian_type<T, codim>;
37
38private:
39 value_type m_value;
40
41public:
42 Constant(const value_type &value) : m_value(value) {}
43
44 value_type &value() { return m_value; }
45
46 value_type operator()(const Utils::Vector3d &, double = {}) const {
47 return m_value;
48 }
49 static constexpr jacobian_type jacobian(const Utils::Vector3d &) {
50 return jacobian_type{};
51 }
52
53 bool fits_in_box(const Utils::Vector3d &) const { return true; }
54};
55} // namespace Fields
56} // namespace FieldCoupling
57
58#endif
Vector implementation and trait types for boost qvm interoperability.
A vector field that is constant in space.
Definition Constant.hpp:32
Constant(const value_type &value)
Definition Constant.hpp:42
detail::jacobian_type< T, codim > jacobian_type
Definition Constant.hpp:36
bool fits_in_box(const Utils::Vector3d &) const
Definition Constant.hpp:53
value_type operator()(const Utils::Vector3d &, double={}) const
Definition Constant.hpp:46
typename Utils::decay_to_scalar< Utils::Vector< T, codim > >::type value_type
Definition Constant.hpp:35
static constexpr jacobian_type jacobian(const Utils::Vector3d &)
Definition Constant.hpp:49
Meta function to turns a Vector<1, T> into T.
Definition Vector.hpp:479