Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
ogs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
Özgür Ozan Sen
ogs
Commits
380c4e7c
Commit
380c4e7c
authored
8 years ago
by
Christoph Lehmann
Browse files
Options
Downloads
Patches
Plain Diff
[PL] Parameter uses SpatialPosition
parent
6b7e9f81
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
ProcessLib/Parameter.cpp
+1
-1
1 addition, 1 deletion
ProcessLib/Parameter.cpp
ProcessLib/Parameter.h
+24
-23
24 additions, 23 deletions
ProcessLib/Parameter.h
with
25 additions
and
24 deletions
ProcessLib/Parameter.cpp
+
1
−
1
View file @
380c4e7c
...
...
@@ -52,6 +52,6 @@ std::unique_ptr<ParameterBase> createMeshPropertyParameter(
}
return
std
::
unique_ptr
<
ParameterBase
>
(
new
Mesh
Property
Parameter
<
double
>
(
*
property
));
new
Mesh
Element
Parameter
<
double
>
(
*
property
));
}
}
// namespace ProcessLib
This diff is collapsed.
Click to expand it.
ProcessLib/Parameter.h
+
24
−
23
View file @
380c4e7c
...
...
@@ -17,6 +17,7 @@
#include
"BaseLib/ConfigTree.h"
#include
"MeshLib/Elements/Element.h"
#include
"SpatialPosition.h"
namespace
MeshLib
{
...
...
@@ -36,55 +37,55 @@ struct ParameterBase
std
::
string
name
;
};
/// A parameter is representing a value or function of any type.
/// The ReturnType can represent an underlying type of an aggregate type like
/// tuple or matrix (\see tupleSize()).
/// The total number of stored tuples is provided.
template
<
typename
ReturnType
,
typename
...
Args
>
template
<
typename
T
>
struct
Parameter
:
public
ParameterBase
{
virtual
~
Parameter
()
=
default
;
virtual
ReturnType
operator
()(
Args
&&
...
args
)
const
=
0
;
// TODO number of components
virtual
std
::
vector
<
T
>
const
&
getTuple
(
double
const
t
,
SpatialPosition
const
&
pos
)
const
=
0
;
};
/// Single, constant value parameter.
template
<
typename
ReturnType
>
struct
ConstParameter
final
:
public
Parameter
<
ReturnType
,
MeshLib
::
Element
const
&>
{
ConstParameter
(
ReturnType
value
)
:
_value
(
value
)
{
}
ReturnType
operator
()(
MeshLib
::
Element
const
&
)
const
override
template
<
typename
T
>
struct
ConstParameter
final
:
public
Parameter
<
T
>
{
ConstParameter
(
T
const
&
value
)
:
_value
{{
value
}}
{}
std
::
vector
<
T
>
const
&
getTuple
(
double
const
/*t*/
,
SpatialPosition
const
&
/*pos*/
)
const
override
{
return
_value
;
}
private
:
ReturnType
_value
;
std
::
vector
<
T
>
_value
;
};
std
::
unique_ptr
<
ParameterBase
>
createConstParameter
(
BaseLib
::
ConfigTree
const
&
config
);
/// A parameter represented by a mesh property vector.
template
<
typename
ReturnType
>
struct
Mesh
Property
Parameter
final
:
public
Parameter
<
ReturnType
,
MeshLib
::
Element
const
&
>
template
<
typename
T
>
struct
Mesh
Element
Parameter
final
:
public
Parameter
<
T
>
{
Mesh
Property
Parameter
(
MeshLib
::
PropertyVector
<
ReturnType
>
const
&
property
)
Mesh
Element
Parameter
(
MeshLib
::
PropertyVector
<
T
>
const
&
property
)
:
_property
(
property
)
{
}
ReturnType
operator
()(
MeshLib
::
Element
const
&
e
)
const
override
std
::
vector
<
T
>
const
&
getTuple
(
double
const
/*t*/
,
SpatialPosition
const
&
pos
)
const
override
{
return
_property
[
e
.
getID
()];
auto
const
e
=
pos
.
getElementID
();
assert
(
e
);
_cache
.
front
()
=
_property
[
*
e
];
return
_cache
;
}
private
:
MeshLib
::
PropertyVector
<
ReturnType
>
const
&
_property
;
MeshLib
::
PropertyVector
<
T
>
const
&
_property
;
// TODO multi-component
mutable
std
::
vector
<
double
>
_cache
=
std
::
vector
<
double
>
(
1
);
};
std
::
unique_ptr
<
ParameterBase
>
createMeshPropertyParameter
(
BaseLib
::
ConfigTree
const
&
config
,
MeshLib
::
Mesh
const
&
mesh
);
...
...
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