Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
solverstack
ScalFMM
Commits
2194e395
Commit
2194e395
authored
Mar 25, 2021
by
ESTERIE Pierre
Browse files
Some work on particle container
parent
4542bd2a
Changes
6
Hide whitespace changes
Inline
Side-by-side
experimental/include/scalfmm/container/particle_container.hpp
View file @
2194e395
...
...
@@ -48,10 +48,12 @@ namespace scalfmm::container
using
self_type
=
particle_container
<
Particle
>
;
using
base_type
=
variadic_container_tuple
<
self_type
,
tuple_type
>
;
using
particle_type
=
Particle
;
// using value_type = Particle; // Compatibility with vector
using
value_type
=
Particle
;
using
proxy_type
=
typename
Particle
::
proxy_type
;
using
const_proxy_type
=
typename
Particle
::
const_proxy_type
;
// Forwarding constructors
using
base_type
::
base_type
;
// Forwarding constructors
using
base_type
::
base_type
;
/// @brief
///
...
...
@@ -64,6 +66,20 @@ namespace scalfmm::container
std
::
advance
(
it
,
i
);
return
particle_type
(
*
it
);
}
[[
nodiscard
]]
inline
auto
at
(
std
::
size_t
i
)
->
proxy_type
{
auto
it
{
std
::
begin
(
*
this
)};
std
::
advance
(
it
,
i
);
return
proxy_type
(
*
it
);
}
[[
nodiscard
]]
inline
auto
at
(
std
::
size_t
i
)
const
->
const_proxy_type
{
auto
it
{
std
::
begin
(
*
this
)};
std
::
advance
(
it
,
i
);
return
const_proxy_type
(
*
it
);
}
///
/// \brief size
/// \return the number of particles inside the container
...
...
experimental/include/scalfmm/container/variadic_adaptor.hpp
View file @
2194e395
...
...
@@ -96,6 +96,7 @@ namespace scalfmm::container
using
container_private_type
=
std
::
conditional_t
<
std
::
is_base_of_v
<
VariadicAdaptor
,
DerivedVariadic
>
,
VariadicAdaptor
,
DerivedVariadic
>
;
using
vector_pointer_type
=
std
::
conditional_t
<
IsConst
,
container_private_type
const
*
,
container_private_type
*>
;
using
derived_value_type
=
typename
DerivedVariadic
::
value_type
;
friend
container_private_type
;
vector_pointer_type
vec_
;
...
...
experimental/include/scalfmm/meta/traits.hpp
View file @
2194e395
...
...
@@ -13,6 +13,13 @@
#include
<scalfmm/meta/is_valid.hpp>
#include
<xsimd/types/xsimd_base.hpp>
// forward declare particle
namespace
scalfmm
::
container
{
template
<
typename
PositionType
,
std
::
size_t
PositionDim
,
typename
InputsType
,
std
::
size_t
NInputs
,
typename
OutputsType
,
std
::
size_t
MOutputs
,
typename
...
Variables
>
struct
particle
;
}
// Traits
namespace
scalfmm
::
meta
{
...
...
@@ -310,6 +317,13 @@ namespace scalfmm::meta
template
<
typename
T
,
std
::
size_t
N
>
struct
is_array
<
std
::
array
<
T
,
N
>>
:
std
::
true_type
{};
template
<
typename
...
Ts
>
inline
constexpr
bool
is_array_v
=
is_array
<
Ts
...
>::
value
;
template
<
typename
T
>
struct
is_particle
:
std
::
false_type
{};
template
<
typename
PositionType
,
std
::
size_t
PositionDim
,
typename
InputsType
,
std
::
size_t
NInputs
,
typename
OutputsType
,
std
::
size_t
MOutputs
,
typename
...
Variables
>
struct
is_particle
<
container
::
particle
<
PositionType
,
PositionDim
,
InputsType
,
NInputs
,
OutputsType
,
MOutputs
,
Variables
...
>>
:
std
::
true_type
{};
template
<
typename
T
>
inline
static
constexpr
bool
is_particle_v
=
is_particle
<
T
>::
value
;
}
// namespace scalfmm::meta
#endif
experimental/include/scalfmm/meta/utils.hpp
View file @
2194e395
...
...
@@ -16,6 +16,7 @@
#include
<tuple>
#include
<type_traits>
#include
<utility>
#include
"scalfmm/meta/traits.hpp"
// Forward declaration for traits support
namespace
scalfmm
::
container
...
...
@@ -505,5 +506,18 @@ namespace scalfmm::meta
}
}
};
template
<
typename
ParticleOrTuple
>
auto
inline
as_tuple
(
ParticleOrTuple
&&
p
)
{
if
constexpr
(
is_particle_v
<
std
::
decay_t
<
ParticleOrTuple
>>
)
{
return
std
::
forward
<
ParticleOrTuple
>
(
p
).
as_tuple
();
}
else
if
constexpr
(
is_tuple_v
<
std
::
decay_t
<
ParticleOrTuple
>>
)
{
return
std
::
forward
<
ParticleOrTuple
>
(
p
);
}
}
}
// namespace scalfmm::meta
#endif // SCALFMM_META_UTILS_HPP
experimental/include/scalfmm/tree/group_tree.hpp
View file @
2194e395
...
...
@@ -14,6 +14,7 @@
#include
<numeric>
#include
<tuple>
#include
<type_traits>
#include
<utility>
#include
<vector>
#include
"scalfmm/operators/generic/tags.hpp"
...
...
@@ -23,6 +24,7 @@
#include
"scalfmm/tree/interaction_list.hpp"
#include
"scalfmm/tree/utils.hpp"
#include
"scalfmm/utils/sort.hpp"
#include
"scalfmm/meta/utils.hpp"
namespace
scalfmm
::
component
{
...
...
@@ -477,7 +479,7 @@ namespace scalfmm::component
auto
jump_to_particle
=
begin_container
;
std
::
advance
(
jump_to_particle
,
source_index
);
// copy the particle
*
leaf_container_begin
=
*
jump_to_particle
;
*
leaf_container_begin
=
meta
::
as_tuple
(
*
jump_to_particle
)
;
proxy_type
particle_in_leaf
(
*
leaf_container_begin
);
// set the outputs to zero
for
(
std
::
size_t
ii
{
0
};
ii
<
particle_type
::
outputs_size
;
++
ii
)
...
...
@@ -517,7 +519,7 @@ namespace scalfmm::component
,
m_box
(
box
)
{
static_assert
(
std
::
is_same_v
<
typename
ParticleContainer
::
particl
e_type
,
particle_type
>
,
std
::
is_same_v
<
typename
ParticleContainer
::
valu
e_type
,
particle_type
>
,
"group_tree : Particles contain in leafs are not the same as the ones in the container passed "
"as argument to this constructor."
);
...
...
experimental/include/scalfmm/utils/sort.hpp
View file @
2194e395
...
...
@@ -43,7 +43,7 @@ namespace scalfmm
{
std
::
get
<
1
>
(
tuple_of_indexes
[
part
])
=
part
;
std
::
get
<
0
>
(
tuple_of_indexes
[
part
])
=
scalfmm
::
index
::
get_morton_index
(
particle_container
.
position
(
part
),
box
,
level
);
scalfmm
::
index
::
get_morton_index
(
particle_container
.
at
(
part
).
position
(),
box
,
level
);
}
if
(
!
data_already_sorted
)
{
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment