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
74b2a34b
There was an error fetching the commit references. Please try again later.
Commit
74b2a34b
authored
8 years ago
by
Tomáš Oberhuber
Browse files
Options
Downloads
Patches
Plain Diff
Refactoring the eikonal solver.
parent
8e9cde1d
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/operators/hamilton-jacobi/upwind-eikonal/upwindEikonal.h
+135
-137
135 additions, 137 deletions
src/operators/hamilton-jacobi/upwind-eikonal/upwindEikonal.h
with
135 additions
and
137 deletions
src/operators/hamilton-jacobi/upwind-eikonal/upwindEikonal.h
+
135
−
137
View file @
74b2a34b
...
...
@@ -44,48 +44,47 @@ template< typename MeshReal,
typename
Index
>
class
upwindEikonalScheme
<
tnlGrid
<
1
,
MeshReal
,
Device
,
MeshIndex
>
,
Real
,
Index
>
{
public:
typedef
Real
RealType
;
typedef
Device
DeviceType
;
typedef
Index
IndexType
;
typedef
tnlGrid
<
1
,
Real
,
Device
,
Index
>
MeshType
;
typedef
tnlVector
<
RealType
,
DeviceType
,
IndexType
>
DofVectorType
;
typedef
typename
MeshType
::
CoordinatesType
CoordinatesType
;
static
tnlString
getType
();
template
<
typename
PreimageFunction
,
typename
MeshEntity
>
__cuda_callable__
Real
operator
()(
const
PreimageFunction
&
u
,
const
MeshEntity
&
entity
,
const
RealType
&
signU
)
const
{
const
RealType
&
hx_inv
=
entity
.
getMesh
().
template
getSpaceStepsProducts
<
-
1
>();
const
typename
MeshEntity
::
template
NeighbourEntities
<
1
>
&
neighbourEntities
=
entity
.
getNeighbourEntities
();
const
RealType
&
u_c
=
u
[
entity
.
getIndex
()
];
const
RealType
&
u_e
=
u
[
neighbourEntities
.
template
getEntityIndex
<
1
>()
];
const
RealType
&
u_w
=
u
[
neighbourEntities
.
template
getEntityIndex
<
-
1
>()
];
if
(
signU
>
0.0
)
{
const
RealType
&
xf
=
negativePart
(
(
u_e
-
u_c
)
*
hx_inv
);
const
RealType
&
xb
=
positivePart
(
(
u_c
-
u_w
)
*
hx_inv
);
return
sqrt
(
xf
*
xf
+
xb
*
xb
);
}
else
if
(
signU
<
0.0
)
{
const
RealType
&
xf
=
negativePart
(
(
u_c
-
u_w
)
*
hx_inv
);
const
RealType
&
xb
=
positivePart
(
(
u_e
-
u_c
)
*
hx_inv
);
return
sqrt
(
xf
*
xf
+
xb
*
xb
);
}
else
public:
typedef
Real
RealType
;
typedef
Device
DeviceType
;
typedef
Index
IndexType
;
typedef
tnlGrid
<
1
,
Real
,
Device
,
Index
>
MeshType
;
typedef
tnlVector
<
RealType
,
DeviceType
,
IndexType
>
DofVectorType
;
typedef
typename
MeshType
::
CoordinatesType
CoordinatesType
;
static
tnlString
getType
();
template
<
typename
PreimageFunction
,
typename
MeshEntity
>
__cuda_callable__
Real
operator
()(
const
PreimageFunction
&
u
,
const
MeshEntity
&
entity
,
const
RealType
&
signU
)
const
{
return
0.0
;
}
};
const
RealType
&
hx_inv
=
entity
.
getMesh
().
template
getSpaceStepsProducts
<
-
1
>();
const
typename
MeshEntity
::
template
NeighbourEntities
<
1
>
&
neighbourEntities
=
entity
.
getNeighbourEntities
();
const
RealType
&
u_c
=
u
[
entity
.
getIndex
()
];
const
RealType
&
u_e
=
u
[
neighbourEntities
.
template
getEntityIndex
<
1
>()
];
const
RealType
&
u_w
=
u
[
neighbourEntities
.
template
getEntityIndex
<
-
1
>()
];
if
(
signU
>
0.0
)
{
const
RealType
&
xf
=
negativePart
(
(
u_e
-
u_c
)
*
hx_inv
);
const
RealType
&
xb
=
positivePart
(
(
u_c
-
u_w
)
*
hx_inv
);
return
sqrt
(
xf
*
xf
+
xb
*
xb
);
}
else
if
(
signU
<
0.0
)
{
const
RealType
&
xf
=
negativePart
(
(
u_c
-
u_w
)
*
hx_inv
);
const
RealType
&
xb
=
positivePart
(
(
u_e
-
u_c
)
*
hx_inv
);
return
sqrt
(
xf
*
xf
+
xb
*
xb
);
}
else
{
return
0.0
;
}
};
};
/****
...
...
@@ -98,51 +97,50 @@ template< typename MeshReal,
typename
Index
>
class
upwindEikonalScheme
<
tnlGrid
<
2
,
MeshReal
,
Device
,
MeshIndex
>
,
Real
,
Index
>
{
public:
typedef
Real
RealType
;
typedef
Device
DeviceType
;
typedef
Index
IndexType
;
typedef
tnlGrid
<
2
,
Real
,
Device
,
Index
>
MeshType
;
typedef
tnlVector
<
RealType
,
DeviceType
,
IndexType
>
DofVectorType
;
typedef
typename
MeshType
::
CoordinatesType
CoordinatesType
;
static
tnlString
getType
();
template
<
typename
PreimageFunction
,
typename
MeshEntity
>
__cuda_callable__
Real
operator
()(
const
PreimageFunction
&
u
,
const
MeshEntity
&
entity
,
const
RealType
&
signU
)
const
{
const
RealType
&
hx_inv
=
entity
.
getMesh
().
template
getSpaceStepsProducts
<
-
1
,
0
>();
const
RealType
&
hy_inv
=
entity
.
getMesh
().
template
getSpaceStepsProducts
<
0
,
-
1
>();
const
typename
MeshEntity
::
template
NeighbourEntities
<
2
>
&
neighbourEntities
=
entity
.
getNeighbourEntities
();
const
RealType
&
u_c
=
u
[
entity
.
getIndex
()
];
const
RealType
&
u_e
=
u
[
neighbourEntities
.
template
getEntityIndex
<
1
,
0
>()
];
const
RealType
&
u_w
=
u
[
neighbourEntities
.
template
getEntityIndex
<
-
1
,
0
>()
];
const
RealType
&
u_n
=
u
[
neighbourEntities
.
template
getEntityIndex
<
0
,
1
>()
];
const
RealType
&
u_s
=
u
[
neighbourEntities
.
template
getEntityIndex
<
0
,
-
1
>()
];
if
(
signU
>
0.0
)
{
const
RealType
xf
=
negativePart
(
(
u_e
-
u_c
)
*
hx_inv
);
const
RealType
xb
=
positivePart
(
(
u_c
-
u_w
)
*
hx_inv
);
const
RealType
yf
=
negativePart
(
(
u_n
-
u_c
)
*
hy_inv
);
const
RealType
yb
=
positivePart
(
(
u_c
-
u_s
)
*
hy_inv
);
return
sqrt
(
xf
*
xf
+
xb
*
xb
+
yf
*
yf
+
yb
*
yb
);
public:
typedef
Real
RealType
;
typedef
Device
DeviceType
;
typedef
Index
IndexType
;
typedef
tnlGrid
<
2
,
Real
,
Device
,
Index
>
MeshType
;
typedef
tnlVector
<
RealType
,
DeviceType
,
IndexType
>
DofVectorType
;
typedef
typename
MeshType
::
CoordinatesType
CoordinatesType
;
static
tnlString
getType
();
template
<
typename
PreimageFunction
,
typename
MeshEntity
>
__cuda_callable__
Real
operator
()(
const
PreimageFunction
&
u
,
const
MeshEntity
&
entity
,
const
RealType
&
signU
)
const
{
const
RealType
&
hx_inv
=
entity
.
getMesh
().
template
getSpaceStepsProducts
<
-
1
,
0
>();
const
RealType
&
hy_inv
=
entity
.
getMesh
().
template
getSpaceStepsProducts
<
0
,
-
1
>();
const
typename
MeshEntity
::
template
NeighbourEntities
<
2
>
&
neighbourEntities
=
entity
.
getNeighbourEntities
();
const
RealType
&
u_c
=
u
[
entity
.
getIndex
()
];
const
RealType
&
u_e
=
u
[
neighbourEntities
.
template
getEntityIndex
<
1
,
0
>()
];
const
RealType
&
u_w
=
u
[
neighbourEntities
.
template
getEntityIndex
<
-
1
,
0
>()
];
const
RealType
&
u_n
=
u
[
neighbourEntities
.
template
getEntityIndex
<
0
,
1
>()
];
const
RealType
&
u_s
=
u
[
neighbourEntities
.
template
getEntityIndex
<
0
,
-
1
>()
];
if
(
signU
>
0.0
)
{
const
RealType
xf
=
negativePart
(
(
u_e
-
u_c
)
*
hx_inv
);
const
RealType
xb
=
positivePart
(
(
u_c
-
u_w
)
*
hx_inv
);
const
RealType
yf
=
negativePart
(
(
u_n
-
u_c
)
*
hy_inv
);
const
RealType
yb
=
positivePart
(
(
u_c
-
u_s
)
*
hy_inv
);
return
sqrt
(
xf
*
xf
+
xb
*
xb
+
yf
*
yf
+
yb
*
yb
);
}
else
if
(
signU
<
0.0
)
{
const
RealType
xf
=
positivePart
(
(
u_e
-
u_c
)
*
hx_inv
);
const
RealType
xb
=
negativePart
(
(
u_c
-
u_w
)
*
hx_inv
);
const
RealType
yf
=
positivePart
(
(
u_n
-
u_c
)
*
hy_inv
);
const
RealType
yb
=
negativePart
(
(
u_c
-
u_s
)
*
hy_inv
);
return
sqrt
(
xf
*
xf
+
xb
*
xb
+
yf
*
yf
+
yb
*
yb
);
}
else
return
0.0
;
}
else
if
(
signU
<
0.0
)
{
const
RealType
xf
=
positivePart
(
(
u_e
-
u_c
)
*
hx_inv
);
const
RealType
xb
=
negativePart
(
(
u_c
-
u_w
)
*
hx_inv
);
const
RealType
yf
=
positivePart
(
(
u_n
-
u_c
)
*
hy_inv
);
const
RealType
yb
=
negativePart
(
(
u_c
-
u_s
)
*
hy_inv
);
return
sqrt
(
xf
*
xf
+
xb
*
xb
+
yf
*
yf
+
yb
*
yb
);
}
else
return
0.0
;
}
};
/****
...
...
@@ -156,59 +154,59 @@ template< typename MeshReal,
class
upwindEikonalScheme
<
tnlGrid
<
3
,
MeshReal
,
Device
,
MeshIndex
>
,
Real
,
Index
>
{
public:
typedef
Real
RealType
;
typedef
Device
DeviceType
;
typedef
Index
IndexType
;
typedef
tnlGrid
<
3
,
Real
,
Device
,
Index
>
MeshType
;
typedef
tnlVector
<
RealType
,
DeviceType
,
IndexType
>
DofVectorType
;
typedef
typename
MeshType
::
CoordinatesType
CoordinatesType
;
static
tnlString
getType
();
template
<
typename
PreimageFunction
,
typename
MeshEntity
>
__cuda_callable__
Real
operator
()(
const
PreimageFunction
&
u
,
const
MeshEntity
&
entity
,
const
RealType
&
signU
)
const
{
const
RealType
&
hx_inv
=
entity
.
getMesh
().
template
getSpaceStepsProducts
<
-
1
,
0
,
0
>();
const
RealType
&
hy_inv
=
entity
.
getMesh
().
template
getSpaceStepsProducts
<
0
,
-
1
,
0
>();
const
RealType
&
hz_inv
=
entity
.
getMesh
().
template
getSpaceStepsProducts
<
0
,
0
,
-
1
>();
const
typename
MeshEntity
::
template
NeighbourEntities
<
3
>
&
neighbourEntities
=
entity
.
getNeighbourEntities
();
const
RealType
&
u_c
=
u
[
entity
.
getIndex
()
];
const
RealType
&
u_e
=
u
[
neighbourEntities
.
template
getEntityIndex
<
1
,
0
,
0
>()
];
const
RealType
&
u_w
=
u
[
neighbourEntities
.
template
getEntityIndex
<
-
1
,
0
,
0
>()
];
const
RealType
&
u_n
=
u
[
neighbourEntities
.
template
getEntityIndex
<
0
,
1
,
0
>()
];
const
RealType
&
u_s
=
u
[
neighbourEntities
.
template
getEntityIndex
<
0
,
-
1
,
0
>()
];
const
RealType
&
u_t
=
u
[
neighbourEntities
.
template
getEntityIndex
<
0
,
0
,
1
>()
];
const
RealType
&
u_b
=
u
[
neighbourEntities
.
template
getEntityIndex
<
0
,
0
,
-
1
>()
];
if
(
signU
>
0.0
)
{
const
RealType
xf
=
negativePart
(
(
u_e
-
u_c
)
*
hx_inv
);
const
RealType
xb
=
positivePart
(
(
u_c
-
u_w
)
*
hx_inv
);
const
RealType
yf
=
negativePart
(
(
u_n
-
u_c
)
*
hy_inv
);
const
RealType
yb
=
positivePart
(
(
u_c
-
u_s
)
*
hy_inv
);
const
RealType
zf
=
negativePart
(
(
u_t
-
u_c
)
*
hz_inv
);
const
RealType
zb
=
positivePart
(
(
u_c
-
u_b
)
*
hz_inv
);
return
sqrt
(
xf
*
xf
+
xb
*
xb
+
yf
*
yf
+
yb
*
yb
+
zf
*
zf
+
zb
*
zb
);
}
else
if
(
signU
<
0.0
)
public:
typedef
Real
RealType
;
typedef
Device
DeviceType
;
typedef
Index
IndexType
;
typedef
tnlGrid
<
3
,
Real
,
Device
,
Index
>
MeshType
;
typedef
tnlVector
<
RealType
,
DeviceType
,
IndexType
>
DofVectorType
;
typedef
typename
MeshType
::
CoordinatesType
CoordinatesType
;
static
tnlString
getType
();
template
<
typename
PreimageFunction
,
typename
MeshEntity
>
__cuda_callable__
Real
operator
()(
const
PreimageFunction
&
u
,
const
MeshEntity
&
entity
,
const
RealType
&
signU
)
const
{
const
RealType
xf
=
positivePart
(
(
u_e
-
u_c
)
*
hx_inv
);
const
RealType
xb
=
negativePart
(
(
u_c
-
u_w
)
*
hx_inv
);
const
RealType
yf
=
positivePart
(
(
u_n
-
u_c
)
*
hy_inv
);
const
RealType
yb
=
negativePart
(
(
u_c
-
u_s
)
*
hy_inv
);
const
RealType
zf
=
positivePart
(
(
u_t
-
u_c
)
*
hz_inv
);
const
RealType
zb
=
negativePart
(
(
u_c
-
u_b
)
*
hz_inv
);
return
sqrt
(
xf
*
xf
+
xb
*
xb
+
yf
*
yf
+
yb
*
yb
+
zf
*
zf
+
zb
*
zb
);
}
else
return
0.0
;
};
const
RealType
&
hx_inv
=
entity
.
getMesh
().
template
getSpaceStepsProducts
<
-
1
,
0
,
0
>();
const
RealType
&
hy_inv
=
entity
.
getMesh
().
template
getSpaceStepsProducts
<
0
,
-
1
,
0
>();
const
RealType
&
hz_inv
=
entity
.
getMesh
().
template
getSpaceStepsProducts
<
0
,
0
,
-
1
>();
const
typename
MeshEntity
::
template
NeighbourEntities
<
3
>
&
neighbourEntities
=
entity
.
getNeighbourEntities
();
const
RealType
&
u_c
=
u
[
entity
.
getIndex
()
];
const
RealType
&
u_e
=
u
[
neighbourEntities
.
template
getEntityIndex
<
1
,
0
,
0
>()
];
const
RealType
&
u_w
=
u
[
neighbourEntities
.
template
getEntityIndex
<
-
1
,
0
,
0
>()
];
const
RealType
&
u_n
=
u
[
neighbourEntities
.
template
getEntityIndex
<
0
,
1
,
0
>()
];
const
RealType
&
u_s
=
u
[
neighbourEntities
.
template
getEntityIndex
<
0
,
-
1
,
0
>()
];
const
RealType
&
u_t
=
u
[
neighbourEntities
.
template
getEntityIndex
<
0
,
0
,
1
>()
];
const
RealType
&
u_b
=
u
[
neighbourEntities
.
template
getEntityIndex
<
0
,
0
,
-
1
>()
];
if
(
signU
>
0.0
)
{
const
RealType
xf
=
negativePart
(
(
u_e
-
u_c
)
*
hx_inv
);
const
RealType
xb
=
positivePart
(
(
u_c
-
u_w
)
*
hx_inv
);
const
RealType
yf
=
negativePart
(
(
u_n
-
u_c
)
*
hy_inv
);
const
RealType
yb
=
positivePart
(
(
u_c
-
u_s
)
*
hy_inv
);
const
RealType
zf
=
negativePart
(
(
u_t
-
u_c
)
*
hz_inv
);
const
RealType
zb
=
positivePart
(
(
u_c
-
u_b
)
*
hz_inv
);
return
sqrt
(
xf
*
xf
+
xb
*
xb
+
yf
*
yf
+
yb
*
yb
+
zf
*
zf
+
zb
*
zb
);
}
else
if
(
signU
<
0.0
)
{
const
RealType
xf
=
positivePart
(
(
u_e
-
u_c
)
*
hx_inv
);
const
RealType
xb
=
negativePart
(
(
u_c
-
u_w
)
*
hx_inv
);
const
RealType
yf
=
positivePart
(
(
u_n
-
u_c
)
*
hy_inv
);
const
RealType
yb
=
negativePart
(
(
u_c
-
u_s
)
*
hy_inv
);
const
RealType
zf
=
positivePart
(
(
u_t
-
u_c
)
*
hz_inv
);
const
RealType
zb
=
negativePart
(
(
u_c
-
u_b
)
*
hz_inv
);
return
sqrt
(
xf
*
xf
+
xb
*
xb
+
yf
*
yf
+
yb
*
yb
+
zf
*
zf
+
zb
*
zb
);
}
else
return
0.0
;
};
};
...
...
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