Loading...
Searching...
No Matches
FunctionAXPY.h
// Copyright (C) 2013 Johan Hake
//
// This file is part of DOLFIN.
//
// DOLFIN is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// DOLFIN is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
//
// First added: 2013-02-11
// Last changed: 2013-02-14
#ifndef __FUNCTION_AXPY_H
#define __FUNCTION_AXPY_H
#include <utility>
#include <vector>
namespace dolfin
{
class Function;
class FunctionAXPY
{
public:
enum class Direction : int {ADD_ADD=0, SUB_ADD=1, ADD_SUB=2, SUB_SUB=3};
FunctionAXPY(std::shared_ptr<const Function> func, double scalar);
FunctionAXPY(const FunctionAXPY& axpy, double scalar);
FunctionAXPY(std::shared_ptr<const Function> func0,
std::shared_ptr<const Function> func1,
Direction direction);
FunctionAXPY(const FunctionAXPY& axpy,
std::shared_ptr<const Function> func,
Direction direction);
FunctionAXPY(const FunctionAXPY& axpy0,
const FunctionAXPY& axpy1,
Direction direction);
FunctionAXPY(
std::vector<std::pair<double, std::shared_ptr<const Function>>> pairs);
FunctionAXPY(const FunctionAXPY& axpy);
~FunctionAXPY();
FunctionAXPY operator+(std::shared_ptr<const Function> func) const;
FunctionAXPY operator+(const FunctionAXPY& axpy) const;
FunctionAXPY operator-(std::shared_ptr<const Function> func) const;
FunctionAXPY operator-(const FunctionAXPY& axpy) const;
FunctionAXPY operator*(double scale) const;
FunctionAXPY operator/(double scale) const;
const std::vector<std::pair<double, std::shared_ptr<const Function>>>&
pairs() const;
private:
void _register(const FunctionAXPY& axpy0, double scale);
std::vector<std::pair<double, std::shared_ptr<const Function>>> _pairs;
};
}
#endif
dolfin::FunctionAXPY
Definition FunctionAXPY.h:36
dolfin::FunctionAXPY::operator*
FunctionAXPY operator*(double scale) const
Scale operator.
Definition FunctionAXPY.cpp:152
dolfin::FunctionAXPY::~FunctionAXPY
~FunctionAXPY()
Destructor.
Definition FunctionAXPY.cpp:102
dolfin::FunctionAXPY::operator/
FunctionAXPY operator/(double scale) const
Scale operator.
Definition FunctionAXPY.cpp:157
dolfin::FunctionAXPY::pairs
const std::vector< std::pair< double, std::shared_ptr< const Function > > > & pairs() const
Return the scalar and Function pairs.
Definition FunctionAXPY.cpp:128
dolfin::FunctionAXPY::Direction
Direction
Enum to decide what way AXPY is constructed.
Definition FunctionAXPY.h:41
dolfin::FunctionAXPY::FunctionAXPY
FunctionAXPY(std::shared_ptr< const Function > func, double scalar)
Constructor.
Definition FunctionAXPY.cpp:29
dolfin::FunctionAXPY::operator-
FunctionAXPY operator-(std::shared_ptr< const Function > func) const
Subtraction operator.
Definition FunctionAXPY.cpp:117
dolfin::FunctionAXPY::operator+
FunctionAXPY operator+(std::shared_ptr< const Function > func) const
Addition operator.
Definition FunctionAXPY.cpp:107
dolfin::Function
Definition Function.h:66
dolfin
Definition adapt.h:30