Mentions légales du service
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
ScalFMM
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
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
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
solverstack
ScalFMM
Commits
e8d25505
Commit
e8d25505
authored
10 years ago
by
Quentin Khan
Browse files
Options
Downloads
Patches
Plain Diff
CostCell can now optionnally define its storage type
parent
52fa99dc
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
Examples/CostZones.hpp
+12
-10
12 additions, 10 deletions
Examples/CostZones.hpp
with
12 additions
and
10 deletions
Examples/CostZones.hpp
+
12
−
10
View file @
e8d25505
...
...
@@ -4,19 +4,20 @@
#include
<vector>
/**
* \author Quentin Khan
* \brief Cell with a cost memory for balance computations.
* \author Quentin Khan
*
* This class extends BaseClass to add simple computation cost memory.
*
* \tparam BaseClass The base cell class to extend. The constructors are
* inherited automatically.
* \tparam The type to use in order to store the cost. Defaults to FSize.
*/
template
<
typename
BaseClass
>
template
<
typename
BaseClass
,
typename
CostType
=
FSize
>
class
FCostCell
:
public
BaseClass
{
/// The cost of the cell. It is declared mutable because the existing
/// algorithms use const cells.
mutable
long
int
_cost
=
0
;
mutable
CostType
_cost
=
0
;
public:
using
BaseClass
::
BaseClass
;
...
...
@@ -27,22 +28,23 @@ public:
* \brief Gets the cost of the cell.
* \return The cost of the cell
*/
long
int
getCost
()
const
{
CostType
getCost
()
const
{
return
_cost
;
}
/**
* Sets the cost of the cell.
* \return The cost of the cell
* \brief Sets the cost of the cell.
*/
long
int
setCost
(
int
newCost
)
{
void
setCost
(
CostType
newCost
)
{
_cost
=
newCost
;
return
_cost
;
}
/**
* Add a cost to the cell.
* \brief Add a cost to the cell.
* \return The cost of the cell
* \warning Can be used on const cells !
*/
long
int
addCost
(
int
cost
)
const
{
CostType
addCost
(
CostType
cost
)
const
{
_cost
+=
cost
;
return
_cost
;
}
...
...
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