Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Sbalzarini Lab
S
Software
P
Parallel Computing
OpenFPM
openfpm_data
Commits
cfcc55c9
Commit
cfcc55c9
authored
Mar 14, 2017
by
incardon
Browse files
Merge branch 'Release_0.9.0' into Refactor_HDF5_IO
parents
74142cb4
06f82493
Changes
7
Hide whitespace changes
Inline
Side-by-side
src/Grid/grid_base_implementation.hpp
View file @
cfcc55c9
...
...
@@ -336,7 +336,8 @@ public:
/*! \brief Get the object that provide memory
*
* An external allocator is useful with allocator like PreAllocHeapMem
* to have contiguous in memory vectors.
* to have contiguous in memory vectors. Or to force the system to retain
* memory
*
* \tparam S memory type
*
...
...
src/Grid/grid_key.hpp
View file @
cfcc55c9
...
...
@@ -30,6 +30,19 @@ public:
inline
grid_key_dx
()
{}
//! Constructor from initializer list
inline
grid_key_dx
(
std
::
initializer_list
<
long
int
>
p1
)
{
size_t
i
=
0
;
for
(
long
int
x
:
p1
)
{
set_d
(
i
,
x
);
i
++
;
if
(
i
>=
dim
)
break
;
}
}
//! Constructor from an other key
inline
grid_key_dx
(
const
grid_key_dx
<
dim
>
&
key
)
:
grid_key_dx
(
key
.
k
)
...
...
src/Grid/grid_sm.hpp
View file @
cfcc55c9
...
...
@@ -706,6 +706,21 @@ public:
}
}
/*! \brief Produce a string from the object
*
* \return string
*
*/
std
::
string
toString
()
const
{
std
::
stringstream
str
;
for
(
size_t
i
=
0
;
i
<
N
;
i
++
)
str
<<
"sz["
<<
i
<<
"]="
<<
size
(
i
)
<<
" "
;
return
str
.
str
();
}
//! It simply mean that all the classes grid are friend of all its specialization
template
<
unsigned
int
,
typename
>
friend
class
grid_sm
;
};
...
...
src/NN/CellList/CellListFast.hpp
View file @
cfcc55c9
...
...
@@ -40,7 +40,7 @@ class wrap_unordered_map<boost::multiprecision::float128,val>
#endif
/*! \brief Calculate the the Neighborhood for symmetric interactions
/*! \brief Calculate the the Neighborhood for symmetric interactions
CSR scheme
*
* \param cNN calculated cross neighborhood
* \param div Number of divisions in each direction
...
...
@@ -107,6 +107,101 @@ template<unsigned int dim> void NNcalc_csr(openfpm::vector<std::pair<grid_key_dx
}
};
/*! \brief Calculate the the Neighborhood for symmetric interactions
*
* \param cNN calculated cross neighborhood
* \param div Number of divisions in each direction
*
*/
template
<
unsigned
int
dim
>
void
NNcalc_sym
(
openfpm
::
vector
<
grid_key_dx
<
dim
>>
&
cNN
)
{
// Calculate the NNc_full array, it is a structure to get the neighborhood array
// compile-time array {0,0,0,....} {2,2,2,...} {1,1,1,...}
typedef
typename
generate_array
<
size_t
,
dim
,
Fill_zero
>::
result
NNzero
;
typedef
typename
generate_array
<
size_t
,
dim
,
Fill_two
>::
result
NNtwo
;
typedef
typename
generate_array
<
size_t
,
dim
,
Fill_one
>::
result
NNone
;
// Generate the sub-grid iterator
size_t
div
[
dim
];
// Calculate the divisions
for
(
size_t
i
=
0
;
i
<
dim
;
i
++
)
div
[
i
]
=
4
;
grid_sm
<
dim
,
void
>
gs
(
div
);
grid_key_dx_iterator_sub
<
dim
>
gr_sub3
(
gs
,
NNzero
::
data
,
NNtwo
::
data
);
grid_key_dx
<
dim
>
src_
;
// Source cell
for
(
size_t
i
=
0
;
i
<
dim
;
i
++
)
src_
.
set_d
(
i
,
1
);
size_t
middle
=
gs
.
LinId
(
src_
);
// Calculate the symmetric array
while
(
gr_sub3
.
isNext
())
{
auto
dst
=
gr_sub3
.
get
();
if
((
long
int
)
middle
>
gs
.
LinId
(
dst
))
{
++
gr_sub3
;
continue
;
}
cNN
.
add
(
dst
-
src_
);
++
gr_sub3
;
}
};
/*! \brief Calculate the Neighborhood cells
*
* \param cNN calculated cross neighborhood
* \param div Number of divisions in each direction
*
*/
template
<
unsigned
int
dim
>
void
NNcalc_full
(
openfpm
::
vector
<
grid_key_dx
<
dim
>>
&
cNN
)
{
// Calculate the NNc_full array, it is a structure to get the neighborhood array
// compile-time array {0,0,0,....} {2,2,2,...} {1,1,1,...}
typedef
typename
generate_array
<
size_t
,
dim
,
Fill_zero
>::
result
NNzero
;
typedef
typename
generate_array
<
size_t
,
dim
,
Fill_two
>::
result
NNtwo
;
typedef
typename
generate_array
<
size_t
,
dim
,
Fill_one
>::
result
NNone
;
// Generate the sub-grid iterator
size_t
div
[
dim
];
// Calculate the divisions
for
(
size_t
i
=
0
;
i
<
dim
;
i
++
)
div
[
i
]
=
4
;
grid_sm
<
dim
,
void
>
gs
(
div
);
grid_key_dx_iterator_sub
<
dim
>
gr_sub3
(
gs
,
NNzero
::
data
,
NNtwo
::
data
);
grid_key_dx
<
dim
>
src_
;
// Source cell
for
(
size_t
i
=
0
;
i
<
dim
;
i
++
)
src_
.
set_d
(
i
,
1
);
// Calculate the symmetric crs array
while
(
gr_sub3
.
isNext
())
{
auto
dst
=
gr_sub3
.
get
();
cNN
.
add
(
dst
-
src_
);
++
gr_sub3
;
}
};
#define STARTING_NSLOT 16
/*! \brief Class for FAST cell list implementation
...
...
@@ -177,6 +272,9 @@ protected:
private:
//! empty stub vector
openfpm
::
vector
<
grid_key_dx
<
dim
>>
stub
;
//! Number of slot for each cell
size_t
slot
;
...
...
@@ -980,6 +1078,39 @@ public:
return
cln
;
}
/*! \brief Get the Neighborhood iterator for symmetric interactions
*
* This iterator work independently that the vector has been create with
* the option BIND_DEC_TO_GHOST, the only requirement is that the ghost
* is full. Does not require ghost_put
*
* \param cell cell id
* \param v vector of neighborhood cells
*
* \return An aiterator across the neighborhood particles
*
*/
/* template<unsigned int impl, typename vector>
inline CellNNIteratorSym<dim,CellList<dim,T,FAST,transform,base>,RUNTIME,impl>
getNNIteratorSym(Point<dim,T> & p,
const vector & v)
{
auto & dec = v.getDecomposition();
grid_key_dx<dim> cellg = this->getGridCell(p);
size_t map_cell = dec.get_mapped_cell(cellg);
CellNNIteratorSym<dim,CellList<dim,T,FAST,transform,base>,RUNTIME,impl> cln(cell,
p,
&dec.getDomainCellNNSym().get(map_cell).NN_subsub.get(0),
dec.getDomainCellNNSym().NN_subsub.size(),
*this,
v.getPosVector());
return cln;
}*/
/*! \brief Get the symmetric neighborhood
*
* \return the symmetric neighborhood
...
...
src/NN/CellList/CellNNIteratorRuntime.hpp
View file @
cfcc55c9
...
...
@@ -208,9 +208,17 @@ public:
* \param cl Cell structure
*
*/
inline
CellNNIteratorSym
(
size_t
cell
,
size_t
p
,
const
long
int
*
NNc
,
size_t
NNc_size
,
Cell
&
cl
,
const
openfpm
::
vector
<
Point
<
dim
,
typename
Cell
::
stype
>>
&
v
)
inline
CellNNIteratorSym
(
size_t
cell
,
size_t
p
,
const
long
int
*
NNc
,
size_t
NNc_size
,
Cell
&
cl
,
const
openfpm
::
vector
<
Point
<
dim
,
typename
Cell
::
stype
>>
&
v
)
:
CellNNIterator
<
dim
,
Cell
,
RUNTIME
,
impl
>
(
cell
,
NNc
,
NNc_size
,
cl
),
p
(
p
),
v
(
v
)
{
if
(
this
->
NNc_id
>=
this
->
NNc_size
)
return
;
selectValid
();
}
...
...
src/NN/CellList/ParticleItCRS_Cells.hpp
View file @
cfcc55c9
...
...
@@ -8,7 +8,7 @@
#ifndef OPENFPM_DATA_SRC_NN_CELLLIST_PARTICLEITCRS_CELLS_HPP_
#define OPENFPM_DATA_SRC_NN_CELLLIST_PARTICLEITCRS_CELLS_HPP_
#include "CellNNIterator
Runtime
.hpp"
#include "CellNNIterator.hpp"
#include "CellList_util.hpp"
/*! \brief sub-sub-domain
...
...
@@ -237,7 +237,12 @@ public:
if
(
dom_or_anom
==
0
)
return
typename
CellListType
::
SymNNIterator
(
dom_cell
.
get
(
cid
),
*
start
,
NNc_sym
,
openfpm
::
math
::
pow
(
3
,
dim
)
/
2
+
1
,
cli
,
v
);
else
return
typename
CellListType
::
SymNNIterator
(
anom_dom_cell
.
get
(
cid
).
subsub
,
*
start
,
&
anom_dom_cell
.
get
(
cid
).
NN_subsub
.
get
(
0
),
anom_dom_cell
.
get
(
cid
).
NN_subsub
.
size
(),
cli
,
v
);
return
typename
CellListType
::
SymNNIterator
(
anom_dom_cell
.
get
(
cid
).
subsub
,
*
start
,
&
anom_dom_cell
.
get
(
cid
).
NN_subsub
.
get
(
0
),
anom_dom_cell
.
get
(
cid
).
NN_subsub
.
size
(),
cli
,
v
);
}
/*! \brief Get the neighborhood iterator according to the CRS scheme Multi-phase case
...
...
src/Vector/map_vector.hpp
View file @
cfcc55c9
...
...
@@ -232,7 +232,6 @@ namespace openfpm
// Implementation of packer and unpacker for vector
#include "vector_pack_unpack.ipp"
/*! \brief Return the size of the vector
*
* \return the size
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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