Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F66922356
integral_operator.hh
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Tue, Jun 18, 21:45
Size
3 KB
Mime Type
text/x-c++
Expires
Thu, Jun 20, 21:45 (2 d)
Engine
blob
Format
Raw Data
Handle
18316785
Attached To
rTAMAAS tamaas
integral_operator.hh
View Options
/*
* SPDX-License-Indentifier: AGPL-3.0-or-later
*
* Copyright (©) 2016-2022 EPFL (École Polytechnique Fédérale de Lausanne),
* Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides)
* Copyright (©) 2020-2022 Lucas Frérot
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
/* -------------------------------------------------------------------------- */
#ifndef INTEGRAL_OPERATOR_HH
#define INTEGRAL_OPERATOR_HH
/* -------------------------------------------------------------------------- */
#include "grid_base.hh"
#include "model_type.hh"
/* -------------------------------------------------------------------------- */
namespace
tamaas
{
/* -------------------------------------------------------------------------- */
class
Model
;
/**
* @brief Generic class for integral operators
*/
class
IntegralOperator
{
public
:
/// Kind of operator
enum
kind
{
neumann
,
dirichlet
,
dirac
};
public
:
/// Constructor
IntegralOperator
(
Model
*
model
)
:
model
(
model
)
{}
/// Virtual destructor for subclasses
virtual
~
IntegralOperator
()
=
default
;
/// Apply operator on input
virtual
void
apply
(
GridBase
<
Real
>&
input
,
GridBase
<
Real
>&
output
)
const
=
0
;
/// Apply operator on filtered input
virtual
void
applyIf
(
GridBase
<
Real
>&
input
,
GridBase
<
Real
>&
output
,
const
std
::
function
<
bool
(
UInt
)
>&
/*unused*/
)
const
{
apply
(
input
,
output
);
}
/// Update any data dependent on model parameters
virtual
void
updateFromModel
()
=
0
;
/// Get model
const
Model
&
getModel
()
const
{
return
*
model
;
}
/// Kind
virtual
kind
getKind
()
const
=
0
;
/// Type
virtual
model_type
getType
()
const
=
0
;
/// Norm
virtual
Real
getOperatorNorm
()
{
TAMAAS_EXCEPTION
(
"operator does not implement norm"
);
}
/// Dense shape (for Scipy integration)
virtual
std
::
pair
<
UInt
,
UInt
>
matvecShape
()
const
{
TAMAAS_EXCEPTION
(
"operator does not implement "
"scipy.sparse.linalg.LinearOperator interface"
);
}
/// matvec definition
virtual
GridBase
<
Real
>
matvec
(
GridBase
<
Real
>&
/*x*/
)
const
{
TAMAAS_EXCEPTION
(
"operator does not implement "
"scipy.sparse.linalg.LinearOperator interface"
);
}
protected
:
Model
*
model
=
nullptr
;
};
/* -------------------------------------------------------------------------- */
/* Printing IntegralOperator::kind to string */
/* -------------------------------------------------------------------------- */
std
::
ostream
&
operator
<<
(
std
::
ostream
&
o
,
const
IntegralOperator
::
kind
&
val
);
}
// namespace tamaas
#endif
// INTEGRAL_OPERATOR_HH
Event Timeline
Log In to Comment