Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
ScalFMM
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
5
Issues
5
List
Boards
Labels
Milestones
Packages
Packages
Container Registry
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
solverstack
ScalFMM
Commits
a9eb639d
Commit
a9eb639d
authored
Mar 30, 2015
by
Quentin Khan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added FRealtype everywhere
parent
6986a133
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
37 additions
and
28 deletions
+37
-28
Examples/CostZones.hpp
Examples/CostZones.hpp
+12
-8
Examples/FChebBalanceSymKernel.hpp
Examples/FChebBalanceSymKernel.hpp
+5
-5
Examples/FFmmAlgorithmThreadBalanced.hpp
Examples/FFmmAlgorithmThreadBalanced.hpp
+8
-4
Examples/loadFMAAndRunFMM.cpp
Examples/loadFMAAndRunFMM.cpp
+7
-6
Examples/loadFMAAndRunFMMUtils.hpp
Examples/loadFMAAndRunFMMUtils.hpp
+5
-5
No files found.
Examples/CostZones.hpp
View file @
a9eb639d
#ifndef _COSTZONES_HPP_
#define _COSTZONES_HPP_
#include <vector>
/**
* \author Quentin Khan
* \brief Cell with a cost memory for balance computations.
...
...
@@ -40,8 +42,8 @@ public:
* Add a cost to the cell.
* \warning Can be used on const cells !
*/
long
int
addCost
(
int
addC
ost
)
const
{
_cost
+=
addC
ost
;
long
int
addCost
(
int
c
ost
)
const
{
_cost
+=
c
ost
;
return
_cost
;
}
};
...
...
@@ -61,8 +63,10 @@ public:
template
<
typename
OctreeClass
,
typename
CellClass
>
class
CostZones
{
public:
using
BoundClass
=
std
::
pair
<
MortonIndex
,
int
>
;
/// Initial value for empty bounds.
const
std
::
pair
<
int
,
int
>
_boundInit
{
-
1
,
0
};
const
BoundClass
_boundInit
{
-
1
,
0
};
protected:
/// The iterator to move through the tree.
...
...
@@ -86,7 +90,7 @@ protected:
* \details This means there are at most _treeHeight elements in the inner
* vectors.
*/
std
::
vector
<
std
::
vector
<
std
::
pair
<
int
,
int
>
>
>
_zonebounds
;
std
::
vector
<
std
::
vector
<
BoundClass
>
>
_zonebounds
;
/// \brief Enumeration to specify the children to move to during the in-order
/// traversal.
...
...
@@ -104,7 +108,7 @@ public:
_nbZones
(
nbZones
),
_treeHeight
(
tree
->
getHeight
()
),
_zones
(
1
,
std
::
vector
<
std
::
pair
<
int
,
CellClass
*>
>
(
)),
_zonebounds
(
1
,
std
::
vector
<
std
::
pair
<
int
,
int
>
>
(
_treeHeight
,
_boundInit
))
_zonebounds
(
1
,
std
::
vector
<
BoundClass
>
(
_treeHeight
,
_boundInit
))
{}
/**
...
...
@@ -123,7 +127,7 @@ public:
* See CostZones#_zonebounds.
* \return The computed zone bounds.
*/
const
std
::
vector
<
std
::
vector
<
std
::
pair
<
int
,
int
>
>
>&
getZoneBounds
()
const
{
const
std
::
vector
<
std
::
vector
<
BoundClass
>
>&
getZoneBounds
()
const
{
return
_zonebounds
;
}
...
...
@@ -236,7 +240,7 @@ private:
*/
void
addCurrentCell
()
{
CellClass
*
cell
=
_it
.
getCurrentCell
();
int
cellCost
=
cell
->
getCost
();
long
int
cellCost
=
cell
->
getCost
();
if
(
cellCost
!=
0
)
{
if
(
_currentCost
+
cellCost
<
_zones
.
size
()
*
_totalCost
/
_nbZones
+
1
)
{
...
...
@@ -259,7 +263,7 @@ private:
std
::
vector
<
std
::
pair
<
int
,
CellClass
*>
>
(
1
,
{
_it
.
level
(),
cell
}));
// Add a new inferior bound
_zonebounds
.
push_back
(
std
::
vector
<
std
::
pair
<
int
,
int
>
>
(
_treeHeight
,
_boundInit
));
std
::
vector
<
BoundClass
>
(
_treeHeight
,
_boundInit
));
_zonebounds
.
back
()[
_it
.
level
()].
first
=
_it
.
getCurrentGlobalIndex
();
_zonebounds
.
back
()[
_it
.
level
()].
second
=
1
;
}
...
...
Examples/FChebBalanceSymKernel.hpp
View file @
a9eb639d
...
...
@@ -374,9 +374,9 @@ private:
void
precomputeSVD
(
const
MatrixKernelClass
*
const
MatrixKernel
,
const
double
Epsilon
)
{
// interpolation points of source (Y) and target (X) cell
FPoint
X
[
nnodes
],
Y
[
nnodes
];
FPoint
<
FReal
>
X
[
nnodes
],
Y
[
nnodes
];
// set roots of target cell (X)
FChebTensor
<
ORDER
>::
setRoots
(
FPoint
(
0.
,
0.
,
0.
),
FReal
(
2.
),
X
);
FChebTensor
<
FReal
,
ORDER
>::
setRoots
(
FPoint
<
FReal
>
(
0.
,
0.
,
0.
),
FReal
(
2.
),
X
);
// temporary matrix
FReal
*
U
=
new
FReal
[
nnodes
*
nnodes
];
...
...
@@ -392,15 +392,15 @@ private:
for
(
int
k
=
0
;
k
<=
j
;
++
k
)
{
// assemble matrix
const
FPoint
cy
(
FReal
(
2.
*
i
),
FReal
(
2.
*
j
),
FReal
(
2.
*
k
));
FChebTensor
<
ORDER
>::
setRoots
(
cy
,
FReal
(
2.
),
Y
);
const
FPoint
<
FReal
>
cy
(
FReal
(
2.
*
i
),
FReal
(
2.
*
j
),
FReal
(
2.
*
k
));
FChebTensor
<
FReal
,
ORDER
>::
setRoots
(
cy
,
FReal
(
2.
),
Y
);
for
(
unsigned
int
n
=
0
;
n
<
nnodes
;
++
n
)
for
(
unsigned
int
m
=
0
;
m
<
nnodes
;
++
m
)
U
[
n
*
nnodes
+
m
]
=
MatrixKernel
->
evaluate
(
X
[
m
],
Y
[
n
]);
// applying weights ////////////////////////////////////////
FReal
weights
[
nnodes
];
FChebTensor
<
ORDER
>::
setRootOfWeights
(
weights
);
FChebTensor
<
FReal
,
ORDER
>::
setRootOfWeights
(
weights
);
for
(
unsigned
int
n
=
0
;
n
<
nnodes
;
++
n
)
{
FBlas
::
scal
(
nnodes
,
weights
[
n
],
U
+
n
,
nnodes
);
// scale rows
FBlas
::
scal
(
nnodes
,
weights
[
n
],
U
+
n
*
nnodes
);
// scale cols
...
...
Examples/FFmmAlgorithmThreadBalanced.hpp
View file @
a9eb639d
...
...
@@ -28,6 +28,8 @@
#include "../Src/Core/FCoreCommon.hpp"
#include "CostZones.hpp"
#include <vector>
#include <omp.h>
...
...
@@ -82,8 +84,10 @@ class FFmmAlgorithmThreadBalanced : public FAbstractAlgorithm, public FAlgorithm
const
int
MaxThreads
;
///< The maximum number of threads.
const
int
OctreeHeight
;
///< The height of the given tree.
using
ZoneBoundClass
=
typename
CostZones
<
OctreeClass
,
CellClass
>::
BoundClass
;
/// The vector containing the costzones
const
std
::
vector
<
std
::
vector
<
std
::
pair
<
int
,
int
>
>>&
costzones
;
const
std
::
vector
<
std
::
vector
<
ZoneBoundClass
>>&
costzones
;
public:
...
...
@@ -104,7 +108,7 @@ public:
*/
FFmmAlgorithmThreadBalanced
(
OctreeClass
*
const
inTree
,
KernelClass
*
const
inKernel
,
const
std
::
vector
<
std
::
vector
<
std
::
pair
<
int
,
int
>
>>&
const
std
::
vector
<
std
::
vector
<
ZoneBoundClass
>>&
inCostzones
)
:
tree
(
inTree
)
,
kernels
(
nullptr
),
...
...
@@ -217,7 +221,7 @@ protected:
std
::
cerr
<<
"Defining iterators"
<<
std
::
endl
;
// Find iterators to leaf portion of each zone.
for
(
std
::
vector
<
std
::
pair
<
int
,
int
>
>
zone
:
costzones
)
{
for
(
std
::
vector
<
ZoneBoundClass
>
zone
:
costzones
)
{
iterVector
.
push_back
(
std
::
pair
<
TreeIterator
,
int
>
(
octreeIterator
,
// Iterator to the current cell
...
...
@@ -295,7 +299,7 @@ protected:
{
std
::
vector
<
std
::
pair
<
TreeIterator
,
int
>
>
tempVect
;
// Find iterators to leaf portion of each zone.
for
(
std
::
vector
<
std
::
pair
<
int
,
int
>
>
zone
:
costzones
)
{
for
(
std
::
vector
<
ZoneBoundClass
>
zone
:
costzones
)
{
tempVect
.
push_back
(
std
::
pair
<
TreeIterator
,
int
>
(
octreeIterator
,
// Iterator to the current cell
...
...
Examples/loadFMAAndRunFMM.cpp
View file @
a9eb639d
...
...
@@ -16,6 +16,7 @@
#include <string>
using
FReal
=
double
;
#include "Files/FFmaGenericLoader.hpp"
#include "Files/FRandomLoader.hpp"
#include "Containers/FOctree.hpp"
...
...
@@ -49,16 +50,16 @@
#define ORDER 7
using
CellClass
=
FCostCell
<
FTestCell
>
;
using
ContainerClass
=
FTestParticleContainer
;
using
LeafClass
=
FSimpleLeaf
<
ContainerClass
>
;
using
OctreeClass
=
FOctree
<
CellClass
,
ContainerClass
,
LeafClass
>
;
using
ContainerClass
=
FTestParticleContainer
<
FReal
>
;
using
LeafClass
=
FSimpleLeaf
<
FReal
,
ContainerClass
>
;
using
OctreeClass
=
FOctree
<
FReal
,
CellClass
,
ContainerClass
,
LeafClass
>
;
using
MatrixKernelClass
=
FInterpMatrixKernelR
;
using
MatrixKernelClass
=
FInterpMatrixKernelR
<
FReal
>
;
using
BalanceKernelClass
=
FChebBalanceSymKernel
<
CellClass
,
ContainerClass
,
MatrixKernelClass
,
ORDER
,
OctreeClass
>
;
using
KernelClass
=
FTestKernels
<
CellClass
,
ContainerClass
>
;
using
KernelClass
=
FTestKernels
<
CellClass
,
ContainerClass
>
;
template
<
template
<
typename
...
>
class
T
,
class
KernelClassT
>
using
FmmClass
=
T
<
OctreeClass
,
CellClass
,
ContainerClass
,
KernelClassT
,
LeafClass
>
;
...
...
@@ -74,7 +75,7 @@ int main(int argc, char** argv)
/* Creating tree and insterting particles *********************************/
FFmaGenericLoader
loader
(
args
.
inFileName
().
c_str
());
FFmaGenericLoader
<
FReal
>
loader
(
args
.
inFileName
().
c_str
());
//FRandomLoader loader(20, 1, FPoint(0.5,0.5,0.5), 1);
OctreeClass
tree
(
args
.
treeHeight
(),
args
.
subTreeHeight
(),
...
...
Examples/loadFMAAndRunFMMUtils.hpp
View file @
a9eb639d
...
...
@@ -23,7 +23,7 @@ void writeZones(const loadFMAAndRunFMMArgs& args, const CostZones <OctreeClass,C
const
int
treeHeight
=
args
.
treeHeight
();
auto
zones
=
costzones
.
getZones
();
int
zoneCount
=
zones
.
size
();
//args.zoneCount();
long
unsigned
int
zoneCount
=
zones
.
size
();
//args.zoneCount();
std
::
cout
<<
"Writing "
<<
zoneCount
<<
" zones."
<<
std
::
endl
;
...
...
@@ -73,10 +73,10 @@ void writeZones(const loadFMAAndRunFMMArgs& args, const CostZones <OctreeClass,C
* \param loader The loader to load from.
*/
template
<
class
OctreeClass
>
void
loadTree
(
OctreeClass
&
tree
,
FFmaGenericLoader
&
loader
)
void
loadTree
(
OctreeClass
&
tree
,
FFmaGenericLoader
<
FReal
>
&
loader
)
{
FReal
physicalValue
;
FPoint
particlePosition
;
FPoint
<
FReal
>
particlePosition
;
// insertion
for
(
int
idxPart
=
0
;
idxPart
<
loader
.
getNumberOfParticles
()
;
++
idxPart
)
{
loader
.
fillParticle
(
&
particlePosition
,
&
physicalValue
);
...
...
@@ -86,9 +86,9 @@ void loadTree(OctreeClass& tree, FFmaGenericLoader& loader)
template
<
class
OctreeClass
>
void
loadTree
(
OctreeClass
&
tree
,
FRandomLoader
&
loader
)
void
loadTree
(
OctreeClass
&
tree
,
FRandomLoader
<
FReal
>
&
loader
)
{
FPoint
particlePosition
;
FPoint
<
FReal
>
particlePosition
;
// insertion
for
(
int
idxPart
=
0
;
idxPart
<
loader
.
getNumberOfParticles
()
;
++
idxPart
)
{
loader
.
fillParticle
(
&
particlePosition
);
...
...
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