Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-xt
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
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
ag-ohlberger
dune-community
dune-xt
Commits
dd683cd8
Commit
dd683cd8
authored
12 years ago
by
Dr. Felix Tobias Schindler
Browse files
Options
Downloads
Patches
Plain Diff
[common.vector] added resize() for Dune::DynamicVector
parent
1540423f
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
dune/stuff/common/vector.hh
+16
-2
16 additions, 2 deletions
dune/stuff/common/vector.hh
with
16 additions
and
2 deletions
dune/stuff/common/vector.hh
+
16
−
2
View file @
dd683cd8
...
...
@@ -5,13 +5,13 @@
// dune-common
#include
<dune/common/densevector.hh>
#include
<dune/common/dynvector.hh>
namespace
Dune
{
namespace
Stuff
{
namespace
Common
{
// template< class T, class stream = std::ostream >
// void print(const T& arg, stream& out = std::cout, std::string name = "", std::string prefix = "") {
// out << prefix;
...
...
@@ -25,6 +25,7 @@ namespace Common {
// out << arg[arg.size() - 1] << "]" << std::endl;
//}
template
<
class
VectorImp
>
void
clear
(
Dune
::
DenseVector
<
VectorImp
>&
vector
)
{
...
...
@@ -39,6 +40,19 @@ void clear(Dune::DenseVector<VectorImp>& vector)
// }
}
// void clear( DenseVectorType& vector )
template
<
class
T
>
Dune
::
DynamicVector
<
T
>
resize
(
const
Dune
::
DynamicVector
<
T
>&
inVector
,
const
size_t
newSize
,
const
T
fill
=
T
(
0
))
{
Dune
::
DynamicVector
<
T
>
outVector
(
newSize
);
for
(
size_t
ii
=
0
;
ii
<
std
::
min
(
inVector
.
size
(),
newSize
);
++
ii
)
outVector
[
ii
]
=
inVector
[
ii
];
for
(
size_t
ii
=
std
::
min
(
inVector
.
size
(),
newSize
);
ii
<
newSize
;
++
ii
)
outVector
[
ii
]
=
fill
;
return
outVector
;
}
}
// namespace Common
}
// namespace Stuff
}
// namespace Dune
...
...
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