Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-common
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Core Modules
dune-common
Commits
85d93662
Commit
85d93662
authored
20 years ago
by
Robert Klöfkorn
Browse files
Options
Downloads
Patches
Plain Diff
Now also gcc compatible.
[[Imported from SVN: r968]]
parent
b002552c
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
fem/common/discreteoperator.hh
+30
-21
30 additions, 21 deletions
fem/common/discreteoperator.hh
with
30 additions
and
21 deletions
fem/common/discreteoperator.hh
+
30
−
21
View file @
85d93662
...
...
@@ -17,15 +17,13 @@ namespace Dune {
@{
*/
//*******************************************************************
//*******************************************************************
//*******************************************************************
//*******************************************************************
/*! Default Implementation class for DiscreteOperators
Here the ObjPointer is stored which is used during
the generation of new objects with the operator + method.
There is corresponding interface class is Operator.
NOTE: if operator + and operator * are used the inherited class
DiscreteOperatorImp has to implement a Constructor which gets a copy and
the new LocalOperatorType which is created by the operator + ...
*/
template
<
class
LocalOperatorImp
,
class
DFDomainType
,
class
DFRangeType
,
template
<
class
,
class
,
class
>
class
DiscreteOperatorImp
>
...
...
@@ -41,20 +39,21 @@ namespace Dune {
typedef
DiscreteOperatorDefault
<
LocalOperatorImp
,
DFDomainType
,
DFRangeType
,
DiscreteOperatorImp
>
DiscreteOperatorDefaultType
;
//! Operator which is called on each entity
LocalOperatorImp
&
localOp_
;
typedef
typename
DFRangeType
::
RangeFieldType
RangeFieldType
;
public:
//! make new operator with item points to null
DiscreteOperatorDefault
(
LocalOperatorImp
&
op
)
:
localOp_
(
op
)
,
level_
(
0
)
{}
//! no public method, but has to be public, because all discrete operator
//! must be able to call this method an the template parameters are
//! allways diffrent
LocalOperatorImp
&
getLocalOp
()
DiscreteOperatorDefault
()
:
level_
(
0
)
{}
/*!
no public method, but has to be public, because all discrete operator
must be able to call this method an the template parameters are
allways diffrent.
NOTE: this method has to be overloaded by the DiscreteOperatorImp class
ans must return the reference to local operator */
const
LocalOperatorImp
&
getLocalOp
()
const
{
return
l
ocalOp
_
;
return
asImp
().
getL
ocalOp
()
;
}
/*! add another discrete operator by combining the two local operators
...
...
@@ -66,13 +65,16 @@ namespace Dune {
template
<
class
LocalOperatorType
>
DiscreteOperatorImp
<
CombinedLocalOperator
<
LocalOperatorImp
,
LocalOperatorType
>
,
DFDomainType
,
DFRangeType
>
&
operator
+
(
const
DiscreteOperatorImp
<
LocalOperatorType
,
DFDomainType
,
DFRangeType
>
&
op
)
operator
+
(
DiscreteOperatorImp
<
LocalOperatorType
,
DFDomainType
,
DFRangeType
>
&
op
)
{
if
(
asImp
().
printInfo
())
std
::
cout
<<
"DiscreteOperatorDefault::operator + called!
\n
"
;
typedef
DiscreteOperatorImp
<
LocalOperatorType
,
DFDomainType
,
DFRangeType
>
CopyType
;
typedef
CombinedLocalOperator
<
LocalOperatorImp
,
LocalOperatorType
>
COType
;
COType
*
locOp
=
new
COType
(
l
ocalOp
_
,
const_cast
<
CopyType
&>
(
op
)
.
getLocalOp
(),
asImp
().
printInfo
()
);
new
COType
(
asImp
().
getL
ocalOp
()
,
op
.
getLocalOp
()
,
asImp
().
printInfo
()
);
typedef
DiscreteOperatorImp
<
COType
,
DFDomainType
,
DFRangeType
>
OPType
;
...
...
@@ -89,16 +91,19 @@ namespace Dune {
//! This method work just the same way like the operator +
//! but this time for mutiplication with scalar
DiscreteOperatorImp
<
ScaledLocalOperator
<
LocalOperatorImp
,
typename
DFDomainType
::
RangeFieldType
>
,
DFDomainType
,
DFRangeType
>
&
typename
DFDomainType
::
RangeFieldType
>
,
DFDomainType
,
DFRangeType
>
&
operator
*
(
const
RangeFieldType
&
scalar
)
{
if
(
asImp
().
printInfo
())
std
::
cout
<<
"DiscreteOperatorDefault::operator * called!
\n
"
;
typedef
ScaledLocalOperator
<
LocalOperatorImp
,
typename
DFDomainType
::
RangeFieldType
>
ScalOperatorType
;
typedef
DiscreteOperatorImp
<
ScalOperatorType
,
DFDomainType
,
DFRangeType
>
ScalDiscrType
;
ScalOperatorType
*
sop
=
new
ScalOperatorType
(
l
ocalOp
_
,
scalar
,
asImp
().
printInfo
()
);
ScalDiscrType
*
discrOp
=
new
ScalDiscrType
(
asImp
()
,
*
sop
);
ScalOperatorType
*
sop
=
new
ScalOperatorType
(
asImp
().
getL
ocalOp
()
,
scalar
,
asImp
().
printInfo
()
);
ScalDiscrType
*
discrOp
=
new
ScalDiscrType
(
asImp
()
,
*
sop
);
// memorize this new generated object because is represents this
// operator and is deleted if this operator is deleted
...
...
@@ -131,13 +136,17 @@ namespace Dune {
std
::
cerr
<<
"ERROR: DiscreteOperatorDefault::operator () called!
\n
"
;
}
//! default implemenation of printInfo just returns false, no info is
//! printed, if true every constructor of CombinedLocalOperator prints
//! messages
bool
printInfo
()
{
return
false
;
}
protected
:
// current level of operator
//
!
current level of operator
mutable
int
level_
;
private
:
//! Barton-Nackman
DiscreteOperatorImp
<
LocalOperatorImp
,
DFDomainType
,
DFRangeType
>
&
asImp
()
{
return
static_cast
<
DiscreteOperatorImp
<
LocalOperatorImp
,
DFDomainType
,
DFRangeType
>
&>
(
*
this
);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment