Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tnl-dev
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
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
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
TNL
tnl-dev
Commits
6107ec75
There was an error fetching the commit references. Please try again later.
Commit
6107ec75
authored
5 years ago
by
Jakub Klinkovský
Browse files
Options
Downloads
Patches
Plain Diff
Using getData() instead of data in StaticArray
parent
f3156459
No related branches found
No related tags found
1 merge request
!49
Bug fixes
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/TNL/Containers/StaticArray.hpp
+9
-9
9 additions, 9 deletions
src/TNL/Containers/StaticArray.hpp
src/TNL/Containers/detail/StaticArrayAssignment.h
+4
-4
4 additions, 4 deletions
src/TNL/Containers/detail/StaticArrayAssignment.h
with
13 additions
and
13 deletions
src/TNL/Containers/StaticArray.hpp
+
9
−
9
View file @
6107ec75
...
...
@@ -102,21 +102,21 @@ template< int Size, typename Value >
__cuda_callable__
StaticArray
<
Size
,
Value
>::
StaticArray
(
const
Value
v
[
Size
]
)
{
Algorithms
::
StaticFor
<
0
,
Size
>::
exec
(
detail
::
AssignArrayFunctor
{},
d
ata
,
v
);
Algorithms
::
StaticFor
<
0
,
Size
>::
exec
(
detail
::
AssignArrayFunctor
{},
getD
ata
()
,
v
);
}
template
<
int
Size
,
typename
Value
>
__cuda_callable__
StaticArray
<
Size
,
Value
>::
StaticArray
(
const
Value
&
v
)
{
Algorithms
::
StaticFor
<
0
,
Size
>::
exec
(
detail
::
AssignValueFunctor
{},
d
ata
,
v
);
Algorithms
::
StaticFor
<
0
,
Size
>::
exec
(
detail
::
AssignValueFunctor
{},
getD
ata
()
,
v
);
}
template
<
int
Size
,
typename
Value
>
__cuda_callable__
StaticArray
<
Size
,
Value
>::
StaticArray
(
const
StaticArray
<
Size
,
Value
>&
v
)
{
Algorithms
::
StaticFor
<
0
,
Size
>::
exec
(
detail
::
AssignArrayFunctor
{},
d
ata
,
v
.
getData
()
);
Algorithms
::
StaticFor
<
0
,
Size
>::
exec
(
detail
::
AssignArrayFunctor
{},
getD
ata
()
,
v
.
getData
()
);
}
template
<
int
Size
,
typename
Value
>
...
...
@@ -228,7 +228,7 @@ template< int Size, typename Value >
__cuda_callable__
StaticArray
<
Size
,
Value
>&
StaticArray
<
Size
,
Value
>::
operator
=
(
const
StaticArray
<
Size
,
Value
>&
array
)
{
Algorithms
::
StaticFor
<
0
,
Size
>::
exec
(
detail
::
AssignArrayFunctor
{},
d
ata
,
array
.
getData
()
);
Algorithms
::
StaticFor
<
0
,
Size
>::
exec
(
detail
::
AssignArrayFunctor
{},
getD
ata
()
,
array
.
getData
()
);
return
*
this
;
}
...
...
@@ -264,7 +264,7 @@ StaticArray< Size, Value >::
operator
StaticArray
<
Size
,
OtherValue
>
()
const
{
StaticArray
<
Size
,
OtherValue
>
aux
;
Algorithms
::
StaticFor
<
0
,
Size
>::
exec
(
detail
::
AssignArrayFunctor
{},
aux
.
getData
(),
d
ata
);
Algorithms
::
StaticFor
<
0
,
Size
>::
exec
(
detail
::
AssignArrayFunctor
{},
aux
.
getData
(),
getD
ata
()
);
return
aux
;
}
...
...
@@ -272,27 +272,27 @@ template< int Size, typename Value >
__cuda_callable__
void
StaticArray
<
Size
,
Value
>::
setValue
(
const
ValueType
&
val
)
{
Algorithms
::
StaticFor
<
0
,
Size
>::
exec
(
detail
::
AssignValueFunctor
{},
d
ata
,
val
);
Algorithms
::
StaticFor
<
0
,
Size
>::
exec
(
detail
::
AssignValueFunctor
{},
getD
ata
()
,
val
);
}
template
<
int
Size
,
typename
Value
>
bool
StaticArray
<
Size
,
Value
>::
save
(
File
&
file
)
const
{
file
.
save
(
d
ata
,
Size
);
file
.
save
(
getD
ata
()
,
Size
);
return
true
;
}
template
<
int
Size
,
typename
Value
>
bool
StaticArray
<
Size
,
Value
>::
load
(
File
&
file
)
{
file
.
load
(
d
ata
,
Size
);
file
.
load
(
getD
ata
()
,
Size
);
return
true
;
}
template
<
int
Size
,
typename
Value
>
void
StaticArray
<
Size
,
Value
>::
sort
()
{
detail
::
StaticArraySort
<
Size
-
1
,
0
,
Value
>::
exec
(
d
ata
);
detail
::
StaticArraySort
<
Size
-
1
,
0
,
Value
>::
exec
(
getD
ata
()
);
}
template
<
int
Size
,
typename
Value
>
...
...
This diff is collapsed.
Click to expand it.
src/TNL/Containers/detail/StaticArrayAssignment.h
+
4
−
4
View file @
6107ec75
...
...
@@ -21,7 +21,7 @@ struct AssignArrayFunctor
{
template
<
typename
LeftValue
,
typename
RightValue
>
__cuda_callable__
void
operator
()(
int
i
,
LeftValue
&
data
,
const
RightValue
&
v
)
const
void
operator
()(
int
i
,
LeftValue
*
data
,
const
RightValue
*
v
)
const
{
data
[
i
]
=
v
[
i
];
}
...
...
@@ -31,7 +31,7 @@ struct AssignValueFunctor
{
template
<
typename
LeftValue
,
typename
RightValue
>
__cuda_callable__
void
operator
()(
int
i
,
LeftValue
&
data
,
const
RightValue
&
v
)
const
void
operator
()(
int
i
,
LeftValue
*
data
,
const
RightValue
&
v
)
const
{
data
[
i
]
=
v
;
}
...
...
@@ -53,7 +53,7 @@ struct StaticArrayAssignment< StaticArray, T, true >
static
void
assign
(
StaticArray
&
a
,
const
T
&
v
)
{
static_assert
(
StaticArray
::
getSize
()
==
T
::
getSize
(),
"Cannot assign static arrays with different size."
);
Algorithms
::
StaticFor
<
0
,
StaticArray
::
getSize
()
>::
exec
(
AssignArrayFunctor
{},
a
.
getData
(),
v
);
Algorithms
::
StaticFor
<
0
,
StaticArray
::
getSize
()
>::
exec
(
AssignArrayFunctor
{},
a
.
getData
(),
v
.
getData
()
);
}
};
...
...
@@ -68,7 +68,7 @@ struct StaticArrayAssignment< StaticArray, T, false >
__cuda_callable__
static
void
assign
(
StaticArray
&
a
,
const
T
&
v
)
{
Algorithms
::
StaticFor
<
0
,
StaticArray
::
getSize
()
>::
exec
(
AssignValueFunctor
{},
a
,
v
);
Algorithms
::
StaticFor
<
0
,
StaticArray
::
getSize
()
>::
exec
(
AssignValueFunctor
{},
a
.
getData
()
,
v
);
}
};
...
...
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