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
Dmitri Naumov
ogs
Commits
5d635541
Commit
5d635541
authored
3 years ago
by
Tom Fischer
Browse files
Options
Downloads
Patches
Plain Diff
[NL/DOF] Rm. template switch for searching cache objects.
The caching mechanism was removed in previous commits.
parent
0bac7593
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
NumLib/DOF/SimpleMatrixVectorProvider.cpp
+12
-12
12 additions, 12 deletions
NumLib/DOF/SimpleMatrixVectorProvider.cpp
NumLib/DOF/SimpleMatrixVectorProvider.h
+3
-3
3 additions, 3 deletions
NumLib/DOF/SimpleMatrixVectorProvider.h
with
15 additions
and
15 deletions
NumLib/DOF/SimpleMatrixVectorProvider.cpp
+
12
−
12
View file @
5d635541
...
@@ -21,7 +21,7 @@ namespace LinAlg = MathLib::LinAlg;
...
@@ -21,7 +21,7 @@ namespace LinAlg = MathLib::LinAlg;
namespace
NumLib
namespace
NumLib
{
{
template
<
bool
do_search
,
typename
MatVec
,
typename
...
Args
>
template
<
typename
MatVec
,
typename
...
Args
>
std
::
pair
<
MatVec
*
,
bool
>
SimpleMatrixVectorProvider
::
get_
(
std
::
pair
<
MatVec
*
,
bool
>
SimpleMatrixVectorProvider
::
get_
(
std
::
size_t
&
id
,
std
::
map
<
MatVec
*
,
std
::
size_t
>&
used_map
,
Args
&&
...
args
)
std
::
size_t
&
id
,
std
::
map
<
MatVec
*
,
std
::
size_t
>&
used_map
,
Args
&&
...
args
)
{
{
...
@@ -34,22 +34,22 @@ std::pair<MatVec*, bool> SimpleMatrixVectorProvider::get_(
...
@@ -34,22 +34,22 @@ std::pair<MatVec*, bool> SimpleMatrixVectorProvider::get_(
return
{
res
.
first
->
first
,
true
};
return
{
res
.
first
->
first
,
true
};
}
}
template
<
bool
do_search
,
typename
...
Args
>
template
<
typename
...
Args
>
std
::
pair
<
GlobalMatrix
*
,
bool
>
SimpleMatrixVectorProvider
::
getMatrix_
(
std
::
pair
<
GlobalMatrix
*
,
bool
>
SimpleMatrixVectorProvider
::
getMatrix_
(
std
::
size_t
&
id
,
Args
&&
...
args
)
std
::
size_t
&
id
,
Args
&&
...
args
)
{
{
return
get_
<
do_search
>
(
id
,
_used_matrices
,
std
::
forward
<
Args
>
(
args
)...);
return
get_
(
id
,
_used_matrices
,
std
::
forward
<
Args
>
(
args
)...);
}
}
GlobalMatrix
&
SimpleMatrixVectorProvider
::
getMatrix
(
std
::
size_t
&
id
)
GlobalMatrix
&
SimpleMatrixVectorProvider
::
getMatrix
(
std
::
size_t
&
id
)
{
{
return
*
getMatrix_
<
true
>
(
id
).
first
;
return
*
getMatrix_
(
id
).
first
;
}
}
GlobalMatrix
&
SimpleMatrixVectorProvider
::
getMatrix
(
GlobalMatrix
&
SimpleMatrixVectorProvider
::
getMatrix
(
MathLib
::
MatrixSpecifications
const
&
ms
,
std
::
size_t
&
id
)
MathLib
::
MatrixSpecifications
const
&
ms
,
std
::
size_t
&
id
)
{
{
return
*
getMatrix_
<
true
>
(
id
,
ms
).
first
;
return
*
getMatrix_
(
id
,
ms
).
first
;
// TODO assert that the returned object always is of the right size
// TODO assert that the returned object always is of the right size
}
}
...
@@ -68,37 +68,37 @@ void SimpleMatrixVectorProvider::releaseMatrix(GlobalMatrix const& A)
...
@@ -68,37 +68,37 @@ void SimpleMatrixVectorProvider::releaseMatrix(GlobalMatrix const& A)
}
}
}
}
template
<
bool
do_search
,
typename
...
Args
>
template
<
typename
...
Args
>
std
::
pair
<
GlobalVector
*
,
bool
>
SimpleMatrixVectorProvider
::
getVector_
(
std
::
pair
<
GlobalVector
*
,
bool
>
SimpleMatrixVectorProvider
::
getVector_
(
std
::
size_t
&
id
,
Args
&&
...
args
)
std
::
size_t
&
id
,
Args
&&
...
args
)
{
{
return
get_
<
do_search
>
(
id
,
_used_vectors
,
std
::
forward
<
Args
>
(
args
)...);
return
get_
(
id
,
_used_vectors
,
std
::
forward
<
Args
>
(
args
)...);
}
}
GlobalVector
&
SimpleMatrixVectorProvider
::
getVector
(
std
::
size_t
&
id
)
GlobalVector
&
SimpleMatrixVectorProvider
::
getVector
(
std
::
size_t
&
id
)
{
{
return
*
getVector_
<
true
>
(
id
).
first
;
return
*
getVector_
(
id
).
first
;
}
}
GlobalVector
&
SimpleMatrixVectorProvider
::
getVector
(
GlobalVector
&
SimpleMatrixVectorProvider
::
getVector
(
MathLib
::
MatrixSpecifications
const
&
ms
)
MathLib
::
MatrixSpecifications
const
&
ms
)
{
{
std
::
size_t
id
=
0u
;
std
::
size_t
id
=
0u
;
return
*
getVector_
<
false
>
(
id
,
ms
).
first
;
return
*
getVector_
(
id
,
ms
).
first
;
// TODO assert that the returned object always is of the right size
// TODO assert that the returned object always is of the right size
}
}
GlobalVector
&
SimpleMatrixVectorProvider
::
getVector
(
GlobalVector
&
SimpleMatrixVectorProvider
::
getVector
(
MathLib
::
MatrixSpecifications
const
&
ms
,
std
::
size_t
&
id
)
MathLib
::
MatrixSpecifications
const
&
ms
,
std
::
size_t
&
id
)
{
{
return
*
getVector_
<
true
>
(
id
,
ms
).
first
;
return
*
getVector_
(
id
,
ms
).
first
;
// TODO assert that the returned object always is of the right size
// TODO assert that the returned object always is of the right size
}
}
GlobalVector
&
SimpleMatrixVectorProvider
::
getVector
(
GlobalVector
const
&
x
)
GlobalVector
&
SimpleMatrixVectorProvider
::
getVector
(
GlobalVector
const
&
x
)
{
{
std
::
size_t
id
=
0u
;
std
::
size_t
id
=
0u
;
auto
const
&
res
=
getVector_
<
false
>
(
id
,
x
);
auto
const
&
res
=
getVector_
(
id
,
x
);
if
(
!
res
.
second
)
if
(
!
res
.
second
)
{
// no new object has been created
{
// no new object has been created
LinAlg
::
copy
(
x
,
*
res
.
first
);
LinAlg
::
copy
(
x
,
*
res
.
first
);
...
@@ -109,7 +109,7 @@ GlobalVector& SimpleMatrixVectorProvider::getVector(GlobalVector const& x)
...
@@ -109,7 +109,7 @@ GlobalVector& SimpleMatrixVectorProvider::getVector(GlobalVector const& x)
GlobalVector
&
SimpleMatrixVectorProvider
::
getVector
(
GlobalVector
const
&
x
,
GlobalVector
&
SimpleMatrixVectorProvider
::
getVector
(
GlobalVector
const
&
x
,
std
::
size_t
&
id
)
std
::
size_t
&
id
)
{
{
auto
const
&
res
=
getVector_
<
true
>
(
id
,
x
);
auto
const
&
res
=
getVector_
(
id
,
x
);
if
(
!
res
.
second
)
if
(
!
res
.
second
)
{
// no new object has been created
{
// no new object has been created
LinAlg
::
copy
(
x
,
*
res
.
first
);
LinAlg
::
copy
(
x
,
*
res
.
first
);
...
...
This diff is collapsed.
Click to expand it.
NumLib/DOF/SimpleMatrixVectorProvider.h
+
3
−
3
View file @
5d635541
...
@@ -55,15 +55,15 @@ public:
...
@@ -55,15 +55,15 @@ public:
~
SimpleMatrixVectorProvider
()
override
;
~
SimpleMatrixVectorProvider
()
override
;
private:
private:
template
<
bool
do_search
,
typename
...
Args
>
template
<
typename
...
Args
>
std
::
pair
<
GlobalMatrix
*
,
bool
>
getMatrix_
(
std
::
size_t
&
id
,
Args
&&
...
args
);
std
::
pair
<
GlobalMatrix
*
,
bool
>
getMatrix_
(
std
::
size_t
&
id
,
Args
&&
...
args
);
template
<
bool
do_search
,
typename
...
Args
>
template
<
typename
...
Args
>
std
::
pair
<
GlobalVector
*
,
bool
>
getVector_
(
std
::
size_t
&
id
,
Args
&&
...
args
);
std
::
pair
<
GlobalVector
*
,
bool
>
getVector_
(
std
::
size_t
&
id
,
Args
&&
...
args
);
// returns a pair with the pointer to the matrix/vector and
// returns a pair with the pointer to the matrix/vector and
// a boolean indicating if a new object has been built (then true else false)
// a boolean indicating if a new object has been built (then true else false)
template
<
bool
do_search
,
typename
MatVec
,
typename
...
Args
>
template
<
typename
MatVec
,
typename
...
Args
>
std
::
pair
<
MatVec
*
,
bool
>
get_
(
std
::
size_t
&
id
,
std
::
pair
<
MatVec
*
,
bool
>
get_
(
std
::
size_t
&
id
,
std
::
map
<
MatVec
*
,
std
::
size_t
>&
used_map
,
std
::
map
<
MatVec
*
,
std
::
size_t
>&
used_map
,
Args
&&
...
args
);
Args
&&
...
args
);
...
...
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