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
093b83d3
Commit
093b83d3
authored
10 years ago
by
Tom Fischer
Browse files
Options
Downloads
Patches
Plain Diff
[ML] Improved docu and error messages within the sources.
parent
19c53bbb
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/Properties.h
+16
-8
16 additions, 8 deletions
MeshLib/Properties.h
with
16 additions
and
8 deletions
MeshLib/Properties.h
+
16
−
8
View file @
093b83d3
...
@@ -30,11 +30,11 @@
...
@@ -30,11 +30,11 @@
namespace
MeshLib
namespace
MeshLib
{
{
/// @brief
Material p
roperty manager on mesh items.
/// @brief
P
roperty manager on mesh items.
/// Class Properties manages scalar, vector or matrix properties. For instance
/// Class Properties manages scalar, vector or matrix properties. For instance
/// in groundwater flow porosity is a scalar property and permeabilty can be
/// in groundwater flow porosity is a scalar property and permeabilty can be
/// stored as a tensor property. Properties are assigned to mesh items, i.e.
/// stored as a tensor property. Properties are assigned to mesh items, i.e.
/// Node or Element objects. The
n
ewProperty() method first creates a
/// Node or Element objects. The
createN
ewProperty
Vector
() method first creates a
/// PropertyVector of template type T (scalar, vector or matrix).
/// PropertyVector of template type T (scalar, vector or matrix).
/// This class stores the PropertyVector, accessible by a combination of the
/// This class stores the PropertyVector, accessible by a combination of the
/// name and the type of the mesh item (Node or Element).
/// name and the type of the mesh item (Node or Element).
...
@@ -42,7 +42,9 @@ class Properties
...
@@ -42,7 +42,9 @@ class Properties
{
{
public:
public:
/// Method creates a PropertyVector if a PropertyVector with the same name
/// Method creates a PropertyVector if a PropertyVector with the same name
/// and the same type T was not already created before.
/// and the same type T was not already created before. In case there exists
/// already such a PropertyVector the returned boost::optional holds an
/// invalid/unusable PropertyVector.
/// There are two versions of this method. This method is used
/// There are two versions of this method. This method is used
/// when every mesh item at hand has its own property value, i.e. \f$n\f$
/// when every mesh item at hand has its own property value, i.e. \f$n\f$
/// mesh item and \f$n\f$ different property values.
/// mesh item and \f$n\f$ different property values.
...
@@ -61,7 +63,7 @@ public:
...
@@ -61,7 +63,7 @@ public:
_properties
.
find
(
property_key
)
_properties
.
find
(
property_key
)
);
);
if
(
it
!=
_properties
.
end
())
{
if
(
it
!=
_properties
.
end
())
{
WARN
(
"A property of the name
\"
%s
\"
is already assigned to the mesh."
,
ERR
(
"A property of the name
\"
%s
\"
is already assigned to the mesh."
,
name
.
c_str
());
name
.
c_str
());
return
boost
::
optional
<
PropertyVector
<
T
>
&>
();
return
boost
::
optional
<
PropertyVector
<
T
>
&>
();
}
}
...
@@ -78,13 +80,18 @@ public:
...
@@ -78,13 +80,18 @@ public:
}
}
/// Method creates a PropertyVector if a PropertyVector with the same name
/// Method creates a PropertyVector if a PropertyVector with the same name
/// and the same type T was not already created before.
/// and the same type T was not already created before. In case there exists
/// already such a PropertyVector the returned boost::optional holds an
/// invalid/unusable PropertyVector.
/// This method is used if only a small number of distinct property values
/// This method is used if only a small number of distinct property values
/// in a property exist (e.g. mapping
material
groups to elements).
/// in a property exist (e.g. mapping
property
groups to elements).
/// In this case a mapping between mesh items and properties (stored
/// In this case a mapping between mesh items and properties (stored
/// on the heap), see the parameter item2group_mapping, is required.
/// on the heap), see the parameter item2group_mapping, is required.
/// @tparam T type of the property value
/// @tparam T type of the property value
/// @param name the name of the property
/// @param name the name of the property
/// @param n_prop_groups number of distinct property groups
/// @param item2group_mapping the mapping between mesh item and the property
/// group
/// @param mesh_item_type for instance node or element assigned properties
/// @param mesh_item_type for instance node or element assigned properties
/// @return On success a reference to a PropertyVector packed into a
/// @return On success a reference to a PropertyVector packed into a
/// boost::optional else an empty boost::optional.
/// boost::optional else an empty boost::optional.
...
@@ -100,7 +107,7 @@ public:
...
@@ -100,7 +107,7 @@ public:
_properties
.
find
(
property_key
)
_properties
.
find
(
property_key
)
);
);
if
(
it
!=
_properties
.
end
())
{
if
(
it
!=
_properties
.
end
())
{
WARN
(
"A property of the name
\"
%s
\"
already assigned to the mesh."
,
ERR
(
"A property of the name
\"
%s
\"
already assigned to the mesh."
,
name
.
c_str
());
name
.
c_str
());
return
boost
::
optional
<
PropertyVector
<
T
>
&>
();
return
boost
::
optional
<
PropertyVector
<
T
>
&>
();
}
}
...
@@ -134,10 +141,11 @@ public:
...
@@ -134,10 +141,11 @@ public:
boost
::
any_cast
<
PropertyVector
<
T
>
const
&>
(
it
->
second
)
boost
::
any_cast
<
PropertyVector
<
T
>
const
&>
(
it
->
second
)
);
);
}
catch
(
boost
::
bad_any_cast
const
&
)
{
}
catch
(
boost
::
bad_any_cast
const
&
)
{
ERR
(
"A property with the
desir
ed data type is not available."
);
ERR
(
"A property with the
specifi
ed data type is not available."
);
return
boost
::
optional
<
PropertyVector
<
T
>
const
&>
();
return
boost
::
optional
<
PropertyVector
<
T
>
const
&>
();
}
}
}
else
{
}
else
{
ERR
(
"A property with the specified name and MeshItemType is not available."
);
return
boost
::
optional
<
PropertyVector
<
T
>
const
&>
();
return
boost
::
optional
<
PropertyVector
<
T
>
const
&>
();
}
}
}
}
...
...
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