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
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
Yuhao Liu
ogs
Commits
f33804e8
Commit
f33804e8
authored
10 years ago
by
Tom Fischer
Browse files
Options
Downloads
Patches
Plain Diff
[ML] PropertyVector: add docu.
parent
6c406362
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
MeshLib/PropertyVector.h
+22
-3
22 additions, 3 deletions
MeshLib/PropertyVector.h
with
22 additions
and
3 deletions
MeshLib/PropertyVector.h
+
22
−
3
View file @
f33804e8
/**
* \file
* \brief Definition of the class Properties that implements a container of
* properties.
*
* \copyright
* Copyright (c) 2012-2014, OpenGeoSys Community (http://www.opengeosys.org)
...
...
@@ -22,6 +19,10 @@
namespace
MeshLib
{
/// Class template PropertyVector is a std::vector with template parameter
/// PROP_VAL_TYPE. The reason for the derivation of std::vector is
/// the template specialisation for pointer types below.
/// \tparam PROP_VAL_TYPE typical this is a scalar, a vector or a matrix
template
<
typename
PROP_VAL_TYPE
>
class
PropertyVector
:
public
std
::
vector
<
PROP_VAL_TYPE
>
{
...
...
@@ -35,16 +36,32 @@ public:
{}
};
/// Class template PropertyVector is a std::vector with template parameter
/// T, where T is a pointer type.
/// The behaviour has changed for the constructor, destructor and the operator[].
/// The user has to provide the size and an item to group mapping for construction.
/// The destructor takes care to delete the entries of the vector.
/// The operator[] uses an item to group property map to access to the
/// correct property.
/// \tparam T pointer type, the type the type points to is typical a scalar,
/// a vector or a matrix type
template
<
typename
T
>
class
PropertyVector
<
T
*>
:
public
std
::
vector
<
T
*>
{
public:
/// @param n_prop_groups number of different property values
/// @param item2group_mapping Class Mesh has a mapping from the mesh items
/// (Node or Element) to an index (position in the data structure).
/// The vector item2group_mapping must have the same number of entries as
/// the above mapping and the values have to be in the range
/// \f$[0, \text{n_prop_groups})\f$.
PropertyVector
(
std
::
size_t
n_prop_groups
,
std
::
vector
<
std
::
size_t
>
const
&
item2group_mapping
)
:
std
::
vector
<
T
*>
(
n_prop_groups
),
_item2group_mapping
(
item2group_mapping
)
{}
/// Destructor ensures the deletion of the heap-constructed objects.
~
PropertyVector
()
{
std
::
for_each
(
...
...
@@ -52,6 +69,8 @@ public:
);
}
/// The operator[] uses the item to group property map to access to the
/// correct property value/object.
T
*
const
&
operator
[](
std
::
size_t
id
)
const
{
return
(
*
static_cast
<
std
::
vector
<
T
*>
const
*>
(
this
))[
_item2group_mapping
[
id
]];
...
...
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