Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tnl-dev
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor 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
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
TNL
tnl-dev
Commits
f0675c08
There was an error fetching the commit references. Please try again later.
Commit
f0675c08
authored
9 years ago
by
Tomáš Oberhuber
Browse files
Options
Downloads
Patches
Plain Diff
Refactoring exact nonlinear diffusion.
parent
f5d084b5
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/operators/diffusion/tnlExactNonlinearDiffusion.h
+62
-36
62 additions, 36 deletions
src/operators/diffusion/tnlExactNonlinearDiffusion.h
src/operators/diffusion/tnlExactNonlinearDiffusion_impl.h
+23
-23
23 additions, 23 deletions
src/operators/diffusion/tnlExactNonlinearDiffusion_impl.h
with
85 additions
and
59 deletions
src/operators/diffusion/tnlExactNonlinearDiffusion.h
+
62
−
36
View file @
f0675c08
...
...
@@ -20,71 +20,97 @@
#include
<functions/tnlDomain.h>
template
<
typename
OperatorQ
,
int
Dimensions
>
template
<
typename
Nonlinearity
,
int
Dimensions
>
class
tnlExactNonlinearDiffusion
{};
template
<
typename
OperatorQ
>
class
tnlExactNonlinearDiffusion
<
OperatorQ
,
1
>
:
public
tnlDomain
<
1
,
SpaceDomain
>
template
<
typename
Nonlinearity
>
class
tnlExactNonlinearDiffusion
<
Nonlinearity
,
1
>
:
public
tnlDomain
<
1
,
SpaceDomain
>
{
public:
enum
{
Dimensions
=
1
};
static
tnlString
getType
();
#ifdef HAVE_NOT_CXX11
template
<
typename
Function
,
typename
Vertex
,
typename
Real
>
#else
template
<
typename
Function
,
typename
Vertex
,
typename
Real
=
typename
Vertex
::
RealType
>
#endif
static
tnlString
getType
()
{
return
"tnlExactNonlinearDiffusion< "
+
Nonlinearity
::
getType
()
+
", 1 >"
;
};
void
setNonlinearity
(
const
Nonlinearity
&
nonlinearity
)
{
this
->
nonlinearity
=
nonlinearity
;
}
template
<
typename
Function
>
__cuda_callable__
Real
operator
()(
const
Function
&
function
,
const
Vertex
&
v
,
const
Real
&
time
=
0.0
)
const
;
const
Real
&
time
=
0.0
)
const
{
const
Real
u_x
=
function
.
template
getPartialDerivative
<
1
,
0
,
0
>(
v
,
time
);
const
Real
u_xx
=
function
.
template
getPartialDerivative
<
2
,
0
,
0
>(
v
,
time
);
const
Real
g
=
nonlinearity
(
function
,
v
,
time
)
const
Real
g_x
=
nonlinearity
::
template
getPartialDerivative
<
Function
,
1
,
0
,
0
>(
function
,
v
,
time
);
return
u_xx
-
u_x
*
g_x
/
g
;
}
protected
:
Nonlinearity
nonlinearity
;
};
template
<
typename
OperatorQ
>
class
tnlExactNonlinearDiffusion
<
OperatorQ
,
2
>
:
public
tnlDomain
<
2
,
SpaceDomain
>
template
<
typename
Nonlinearity
>
class
tnlExactNonlinearDiffusion
<
Nonlinearity
,
2
>
:
public
tnlDomain
<
2
,
SpaceDomain
>
{
public:
enum
{
Dimensions
=
2
};
static
tnlString
getType
();
static
tnlString
getType
()
{
return
"tnlExactNonlinearDiffusion< "
+
Nonlinearity
::
getType
()
+
", 2 >"
;
};
#ifdef HAVE_NOT_CXX11
template
<
typename
Function
,
typename
Vertex
,
typename
Real
>
#else
template
<
typename
Function
,
typename
Vertex
,
typename
Real
=
typename
Vertex
::
RealType
>
#endif
void
setNonlinearity
(
const
Nonlinearity
&
nonlinearity
)
{
this
->
nonlinearity
=
nonlinearity
;
}
template
<
typename
Function
>
__cuda_callable__
Real
operator
()(
const
Function
&
function
,
const
Vertex
&
v
,
const
Vertex
Type
&
v
,
const
Real
&
time
=
0.0
)
const
;
protected
:
Nonlinearity
nonlinearity
;
};
template
<
typename
OperatorQ
>
class
tnlExactNonlinearDiffusion
<
OperatorQ
,
3
>
:
public
tnlDomain
<
3
,
SpaceDomain
>
template
<
typename
Nonlinearity
>
class
tnlExactNonlinearDiffusion
<
Nonlinearity
,
3
>
:
public
tnlDomain
<
3
,
SpaceDomain
>
{
public:
enum
{
Dimensions
=
3
};
static
tnlString
getType
();
#ifdef HAVE_NOT_CXX11
template
<
typename
Function
,
typename
Vertex
,
typename
Real
>
#else
template
<
typename
Function
,
typename
Vertex
,
typename
Real
=
typename
Vertex
::
RealType
>
#endif
static
tnlString
getType
()
{
return
"tnlExactNonlinearDiffusion< "
+
Nonlinearity
::
getType
()
+
", 3 >"
;
}
void
setNonlinearity
(
const
Nonlinearity
&
nonlinearity
)
{
this
->
nonlinearity
=
nonlinearity
;
}
template
<
typename
Function
>
__cuda_callable__
Real
operator
()(
const
Function
&
function
,
const
Vertex
&
v
,
const
Vertex
Type
&
v
,
const
Real
&
time
=
0.0
)
const
;
protected
:
Nonlinearity
nonlinearity
;
};
#include
"tnlExactNonlinearDiffusion_impl.h"
...
...
This diff is collapsed.
Click to expand it.
src/operators/diffusion/tnlExactNonlinearDiffusion_impl.h
+
23
−
23
View file @
f0675c08
...
...
@@ -18,73 +18,73 @@
#ifndef TNLEXACTNONLINEARDIFFUSION_IMPL_H_
#define TNLEXACTNONLINEARDIFFUSION_IMPL_H_
template
<
typename
OperatorQ
>
template
<
typename
Nonlinearity
>
tnlString
tnlExactNonlinearDiffusion
<
OperatorQ
,
1
>::
tnlExactNonlinearDiffusion
<
Nonlinearity
,
1
>::
getType
()
{
return
"tnlExactNonlinearDiffusion< "
+
OperatorQ
::
getType
()
+
", 1 >"
;
return
"tnlExactNonlinearDiffusion< "
+
Nonlinearity
::
getType
()
+
", 1 >"
;
}
template
<
typename
OperatorQ
>
template
<
typename
Nonlinearity
>
template
<
typename
Function
,
typename
Vertex
,
typename
Real
>
__cuda_callable__
Real
tnlExactNonlinearDiffusion
<
OperatorQ
,
1
>::
tnlExactNonlinearDiffusion
<
Nonlinearity
,
1
>::
operator
()(
const
Function
&
function
,
const
Vertex
&
v
,
const
Real
&
time
)
const
{
return
function
.
template
getPartialDerivative
<
2
,
0
,
0
>(
v
,
time
)
-
function
.
template
getPartialDerivative
<
1
,
0
,
0
>(
v
,
time
)
*
OperatorQ
::
template
getPartialDerivative
<
1
,
0
,
0
>(
function
,
v
,
time
)
/
OperatorQ
::
template
getPartialDerivative
<
0
,
0
,
0
>(
function
,
v
,
time
);
*
Nonlinearity
::
template
getPartialDerivative
<
Function
,
1
,
0
,
0
>(
function
,
v
,
time
)
/
Nonlinearity
(
function
,
v
,
time
);
}
template
<
typename
OperatorQ
>
template
<
typename
Nonlinearity
>
tnlString
tnlExactNonlinearDiffusion
<
OperatorQ
,
2
>::
tnlExactNonlinearDiffusion
<
Nonlinearity
,
2
>::
getType
()
{
return
"tnlExactNonlinearDiffusion< "
+
OperatorQ
::
getType
()
+
", 2 >"
;
return
"tnlExactNonlinearDiffusion< "
+
Nonlinearity
::
getType
()
+
", 2 >"
;
}
template
<
typename
OperatorQ
>
template
<
typename
Nonlinearity
>
template
<
typename
Function
,
typename
Vertex
,
typename
Real
>
__cuda_callable__
Real
tnlExactNonlinearDiffusion
<
OperatorQ
,
2
>::
tnlExactNonlinearDiffusion
<
Nonlinearity
,
2
>::
operator
()(
const
Function
&
function
,
const
Vertex
&
v
,
const
Real
&
time
)
const
{
return
function
.
template
getPartialDerivative
<
2
,
0
,
0
>(
v
,
time
)
+
function
.
template
getPartialDerivative
<
0
,
2
,
0
>(
v
,
time
)
-
(
OperatorQ
::
template
getPartialDerivative
<
1
,
0
,
0
>
(
function
,
v
,
time
)
*
function
.
template
getPartialDerivative
<
1
,
0
,
0
>(
v
,
time
)
+
OperatorQ
::
template
getPartialDerivative
<
0
,
1
,
0
>
(
function
,
v
,
time
)
*
function
.
template
getPartialDerivative
<
0
,
1
,
0
>(
v
,
time
)
)
/
OperatorQ
::
template
getPartialDerivative
<
0
,
0
,
0
>
(
function
,
v
,
time
);
-
(
Nonlinearity
::
template
getPartialDerivative
<
1
,
0
,
0
>
(
function
,
v
,
time
)
*
function
.
template
getPartialDerivative
<
1
,
0
,
0
>(
v
,
time
)
+
Nonlinearity
::
template
getPartialDerivative
<
0
,
1
,
0
>
(
function
,
v
,
time
)
*
function
.
template
getPartialDerivative
<
0
,
1
,
0
>(
v
,
time
)
)
/
Nonlinearity
::
template
getPartialDerivative
<
0
,
0
,
0
>
(
function
,
v
,
time
);
}
template
<
typename
OperatorQ
>
template
<
typename
Nonlinearity
>
tnlString
tnlExactNonlinearDiffusion
<
OperatorQ
,
3
>::
tnlExactNonlinearDiffusion
<
Nonlinearity
,
3
>::
getType
()
{
return
"tnlExactNonlinearDiffusion< "
+
OperatorQ
::
getType
()
+
", 3 >"
;
return
"tnlExactNonlinearDiffusion< "
+
Nonlinearity
::
getType
()
+
", 3 >"
;
}
template
<
typename
OperatorQ
>
template
<
typename
Nonlinearity
>
template
<
typename
Function
,
typename
Vertex
,
typename
Real
>
__cuda_callable__
Real
tnlExactNonlinearDiffusion
<
OperatorQ
,
3
>::
tnlExactNonlinearDiffusion
<
Nonlinearity
,
3
>::
operator
()(
const
Function
&
function
,
const
Vertex
&
v
,
const
Real
&
time
)
const
{
return
function
.
template
getPartialDerivative
<
2
,
0
,
0
>(
v
,
time
)
+
function
.
template
getPartialDerivative
<
0
,
2
,
0
>(
v
,
time
)
+
function
.
template
getPartialDerivative
<
0
,
0
,
2
>(
v
,
time
)
-
(
OperatorQ
::
template
getPartialDerivative
<
1
,
0
,
0
>
(
function
,
v
,
time
)
*
function
.
template
getPartialDerivative
<
1
,
0
,
0
>(
v
,
time
)
+
OperatorQ
::
template
getPartialDerivative
<
0
,
1
,
0
>
(
function
,
v
,
time
)
*
function
.
template
getPartialDerivative
<
0
,
1
,
0
>(
v
,
time
)
+
OperatorQ
::
template
getPartialDerivative
<
0
,
0
,
1
>
(
function
,
v
,
time
)
*
function
.
template
getPartialDerivative
<
0
,
0
,
1
>(
v
,
time
)
)
/
OperatorQ
::
template
getPartialDerivative
<
0
,
0
,
0
>
(
function
,
v
,
time
);
-
(
Nonlinearity
::
template
getPartialDerivative
<
1
,
0
,
0
>
(
function
,
v
,
time
)
*
function
.
template
getPartialDerivative
<
1
,
0
,
0
>(
v
,
time
)
+
Nonlinearity
::
template
getPartialDerivative
<
0
,
1
,
0
>
(
function
,
v
,
time
)
*
function
.
template
getPartialDerivative
<
0
,
1
,
0
>(
v
,
time
)
+
Nonlinearity
::
template
getPartialDerivative
<
0
,
0
,
1
>
(
function
,
v
,
time
)
*
function
.
template
getPartialDerivative
<
0
,
0
,
1
>(
v
,
time
)
)
/
Nonlinearity
::
template
getPartialDerivative
<
0
,
0
,
0
>
(
function
,
v
,
time
);
}
#endif
/* TNLEXACTNONLINEARDIFFUSION_IMPL_H_ */
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