Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
Term Paper
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
Philip Mueller
Term Paper
Commits
e1a57b15
Commit
e1a57b15
authored
5 years ago
by
Philip Mueller, HS
Browse files
Options
Downloads
Patches
Plain Diff
Added functions to construct a sample list from the other containers.
parent
c93b079b
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
code/cpp/samples/yggdrasil_sampleList.cpp
+69
-0
69 additions, 0 deletions
code/cpp/samples/yggdrasil_sampleList.cpp
code/cpp/samples/yggdrasil_sampleList.hpp
+39
-0
39 additions, 0 deletions
code/cpp/samples/yggdrasil_sampleList.hpp
with
108 additions
and
0 deletions
code/cpp/samples/yggdrasil_sampleList.cpp
+
69
−
0
View file @
e1a57b15
...
...
@@ -18,6 +18,8 @@
#include
<samples/yggdrasil_sample.hpp>
#include
<samples/yggdrasil_dimensionArray.hpp>
#include
<samples/yggdrasil_sampleList.hpp>
#include
<samples/yggdrasil_arraySample.hpp>
#include
<samples/yggdrasil_sampleCollection.hpp>
#include
<samples/yggdrasil_matrixOrder.hpp>
#include
<samples/yggdrasil_container_util.txx>
//This is the helper code
...
...
@@ -84,6 +86,73 @@ yggdrasil_sampleList_t::getColMatrix(
};
//End: getColMatrix
yggdrasil_sampleList_t
::
yggdrasil_sampleList_t
(
const
yggdrasil_arraySample_t
&
sArray
)
:
yggdrasil_sampleList_t
(
sArray
.
nDims
())
//Construct an empty container
{
//Load the parameter
const
Size_t
D
=
sArray
.
nDims
();
const
Size_t
N
=
sArray
.
nSamples
();
//Preallocate space for the insertion
this
->
reserve
(
N
);
yggdrasil_assert
(
this
->
nSamples
()
==
0
);
/*
* Iterate through the array and load the sample.
* We will then move them into the underling container.
*/
for
(
Size_t
i
=
0
;
i
!=
N
;
++
i
)
{
//load the sample
Sample_t
s_i
=
sArray
.
getSample
(
i
);
//Move the sample into the container
this
->
m_samples
.
push_back
(
std
::
move
(
s_i
));
yggdrasil_assert
(
this
->
nSamples
()
==
i
);
};
//End for(i):
//Nw do not need D
(
void
)
D
;
};
//ENd: load from array
yggdrasil_sampleList_t
::
yggdrasil_sampleList_t
(
const
yggdrasil_sampleCollection_t
&
sCol
)
:
yggdrasil_sampleList_t
(
sCol
.
nDims
())
//Construct an empy container
{
//Load the parameter
const
Size_t
D
=
sCol
.
nDims
();
const
Size_t
N
=
sCol
.
nSamples
();
//Preallocate space for the insertion
this
->
reserve
(
N
);
yggdrasil_assert
(
this
->
nSamples
()
==
0
);
/*
* Iterate through the array and load the sample.
* We will then move them into the underling container.
*/
for
(
Size_t
i
=
0
;
i
!=
N
;
++
i
)
{
//load the sample
Sample_t
s_i
=
sCol
.
getSample
(
i
);
//Move the sample into the container
this
->
m_samples
.
push_back
(
std
::
move
(
s_i
));
yggdrasil_assert
(
this
->
nSamples
()
==
i
);
};
//End for(i):
//Nw do not need D
(
void
)
D
;
};
//ENd: load from collection
template
<
class
DimArr_t
>
void
yggdrasil_sampleList_t
::
internal_setDimensionArray
(
...
...
This diff is collapsed.
Click to expand it.
code/cpp/samples/yggdrasil_sampleList.hpp
+
39
−
0
View file @
e1a57b15
...
...
@@ -26,6 +26,13 @@
YGGDRASIL_NS_START
(
yggdrasil
)
//FWD of the Sample array class
class
yggdrasil_arraySample_t
;
//FWD of the sample collection type
class
yggdrasil_sampleCollection_t
;
/**
* \class yggdrasil_sampleList_t
* \brief Representation of many samples.
...
...
@@ -221,6 +228,38 @@ public:
const
yggdrasil_sampleList_t
&
)
=
default
;
/**
* \brief This function performs a deep copy of sArray.
*
* This function loads the sample from the sample array sArray into *this.
* sArray is not modified.
* This allows the transformation of an sample array into a sample list.
*
* \param sArray The container to load from
*
* \throw If an error is detected.
*/
explicit
yggdrasil_sampleList_t
(
const
yggdrasil_arraySample_t
&
sArray
);
/**
* \brief This function performs a deep copy of sColl.
*
* This functions loads the samples from the sample collection
* sCol and stores them in *this. sCol is not modified.
* This function allows to transform a collection into an array.
*
* \param sCol The collection ot load
*
* \throw If an error is detected.
*/
explicit
yggdrasil_sampleList_t
(
const
yggdrasil_sampleCollection_t
&
sCol
);
/**
* \brief Move constructor.
*
...
...
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