Mimetic Operators Library Enhanced 4.0
Loading...
Searching...
No Matches
operators.h
Go to the documentation of this file.
1/*
2 * SPDX-License-Identifier: GPL-3.0-only
3 *
4 * Copyright 2008-2024 San Diego State University Research Foundation (SDSURF).
5 *
6 * This program 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, version 3.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * LICENSE file or on the web GNU General Public License
14 * <https:*www.gnu.org/licenses/> for more details.
15 */
16
17/*
18 * @file operators.h
19 *
20 * @brief Sparse operation inline definitions for mimetic class constructions
21 * @date 2024/10/15
22 */
23
24#ifndef OPERATORS_H
25#define OPERATORS_H
26
27#include "interpol.h"
28#include "laplacian.h"
29#include "mixedbc.h"
30#include "robinbc.h"
31
32inline sp_mat operator*(const Divergence &div, const Gradient &grad) {
33 return (sp_mat)div * (sp_mat)grad;
34}
35
36inline sp_mat operator+(const Laplacian &lap, const RobinBC &bc) {
37 return (sp_mat)lap + (sp_mat)bc;
38}
39
40inline sp_mat operator+(const Laplacian &lap, const MixedBC &bc) {
41 return (sp_mat)lap + (sp_mat)bc;
42}
43
44inline vec operator*(const Divergence &div, const vec &v) {
45 return (sp_mat)div * v;
46}
47
48inline vec operator*(const Gradient &grad, const vec &v) {
49 return (sp_mat)grad * v;
50}
51
52inline vec operator*(const Laplacian &lap, const vec &v) {
53 return (sp_mat)lap * v;
54}
55
56inline vec operator*(const Interpol &I, const vec &v) {
57 return (sp_mat)I * v;
58}
59
60// Add scalar multiplication operators
61inline sp_mat operator*(const double scalar, const Interpol& I) {
62 return scalar * (sp_mat)I;
63}
64
65inline sp_mat operator*(const Interpol& I, const double scalar) {
66 return scalar * (sp_mat)I;
67}
68
69inline sp_mat operator*(const double scalar, const Laplacian& L) {
70 return scalar * (sp_mat)L;
71}
72
73inline sp_mat operator*(const Laplacian& L, const double scalar) {
74 return scalar * (sp_mat)L;
75}
76
77inline sp_mat operator*(const double scalar, const RobinBC& bc) {
78 return scalar * (sp_mat)bc;
79}
80
81inline sp_mat operator*(const RobinBC& bc, const double scalar) {
82 return scalar * (sp_mat)bc;
83}
84
85#endif // OPERATORS_H
Mimetic Divergence operator.
Definition divergence.h:26
Mimetic Gradient operator.
Definition gradient.h:27
Mimetic Interpolator operator.
Definition interpol.h:25
Mimetic Laplacian operator.
Definition laplacian.h:25
Mimetic Mixed Boundary Condition operator.
Definition mixedbc.h:27
Mimetic Robin Boundary Condition operator.
Definition robinbc.h:23
sp_mat operator+(const Laplacian &lap, const RobinBC &bc)
Definition operators.h:36
sp_mat operator*(const Divergence &div, const Gradient &grad)
Definition operators.h:32