Mentions légales du service
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
ScalFMM
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
solverstack
ScalFMM
Commits
c0689e69
Commit
c0689e69
authored
11 years ago
by
Olivier COULAUD
Browse files
Options
Downloads
Patches
Plain Diff
Add operator<< for debug
parent
1c492c26
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Src/Kernels/Chebyshev/FChebCell.hpp
+113
-94
113 additions, 94 deletions
Src/Kernels/Chebyshev/FChebCell.hpp
with
113 additions
and
94 deletions
Src/Kernels/Chebyshev/FChebCell.hpp
+
113
−
94
View file @
c0689e69
...
@@ -15,6 +15,7 @@
...
@@ -15,6 +15,7 @@
// ===================================================================================
// ===================================================================================
#ifndef FCHEBCELL_HPP
#ifndef FCHEBCELL_HPP
#define FCHEBCELL_HPP
#define FCHEBCELL_HPP
#include
<iostream>
#include
"../../Components/FBasicCell.hpp"
#include
"../../Components/FBasicCell.hpp"
#include
"../../Extensions/FExtendMortonIndex.hpp"
#include
"../../Extensions/FExtendMortonIndex.hpp"
...
@@ -36,110 +37,128 @@ class FChebCell : public FBasicCell
...
@@ -36,110 +37,128 @@ class FChebCell : public FBasicCell
{
{
// nnodes = ORDER^3
// nnodes = ORDER^3
// we multiply by 2 because we store the Multipole expansion end the compressed one.
// we multiply by 2 because we store the Multipole expansion end the compressed one.
static
const
int
VectorSize
=
TensorTraits
<
ORDER
>::
nnodes
*
2
;
static
const
int
VectorSize
=
TensorTraits
<
ORDER
>::
nnodes
*
2
;
FReal
multipole_exp
[
NRHS
*
NVALS
*
VectorSize
];
//< Multipole expansion
FReal
multipole_exp
[
NRHS
*
NVALS
*
VectorSize
];
//< Multipole expansion
FReal
local_exp
[
NLHS
*
NVALS
*
VectorSize
];
//< Local expansion
FReal
local_exp
[
NLHS
*
NVALS
*
VectorSize
];
//< Local expansion
public:
public:
FChebCell
(){
FChebCell
(){
memset
(
multipole_exp
,
0
,
sizeof
(
FReal
)
*
NRHS
*
NVALS
*
VectorSize
);
memset
(
multipole_exp
,
0
,
sizeof
(
FReal
)
*
NRHS
*
NVALS
*
VectorSize
);
memset
(
local_exp
,
0
,
sizeof
(
FReal
)
*
NLHS
*
NVALS
*
VectorSize
);
memset
(
local_exp
,
0
,
sizeof
(
FReal
)
*
NLHS
*
NVALS
*
VectorSize
);
}
}
~
FChebCell
()
{}
~
FChebCell
()
{}
/** Get Multipole */
/** Get Multipole */
const
FReal
*
getMultipole
(
const
int
inRhs
)
const
const
FReal
*
getMultipole
(
const
int
inRhs
)
const
{
return
this
->
multipole_exp
+
inRhs
*
VectorSize
;
{
return
this
->
multipole_exp
+
inRhs
*
VectorSize
;
}
}
/** Get Local */
/** Get Local */
const
FReal
*
getLocal
(
const
int
inRhs
)
const
{
const
FReal
*
getLocal
(
const
int
inRhs
)
const
{
return
this
->
local_exp
+
inRhs
*
VectorSize
;
return
this
->
local_exp
+
inRhs
*
VectorSize
;
}
}
/** Get Multipole */
/** Get Multipole */
FReal
*
getMultipole
(
const
int
inRhs
){
FReal
*
getMultipole
(
const
int
inRhs
){
return
this
->
multipole_exp
+
inRhs
*
VectorSize
;
return
this
->
multipole_exp
+
inRhs
*
VectorSize
;
}
}
/** Get Local */
/** Get Local */
FReal
*
getLocal
(
const
int
inRhs
){
FReal
*
getLocal
(
const
int
inRhs
){
return
this
->
local_exp
+
inRhs
*
VectorSize
;
return
this
->
local_exp
+
inRhs
*
VectorSize
;
}
}
/** To get the leading dim of a vec */
/** To get the leading dim of a vec */
int
getVectorSize
()
const
{
int
getVectorSize
()
const
{
return
VectorSize
;
return
VectorSize
;
}
}
/** Make it like the begining */
/** Make it like the begining */
void
resetToInitialState
(){
void
resetToInitialState
(){
memset
(
multipole_exp
,
0
,
sizeof
(
FReal
)
*
NRHS
*
NVALS
*
VectorSize
);
memset
(
multipole_exp
,
0
,
sizeof
(
FReal
)
*
NRHS
*
NVALS
*
VectorSize
);
memset
(
local_exp
,
0
,
sizeof
(
FReal
)
*
NLHS
*
NVALS
*
VectorSize
);
memset
(
local_exp
,
0
,
sizeof
(
FReal
)
*
NLHS
*
NVALS
*
VectorSize
);
}
}
///////////////////////////////////////////////////////
///////////////////////////////////////////////////////
// to extend FAbstractSendable
// to extend FAbstractSendable
///////////////////////////////////////////////////////
///////////////////////////////////////////////////////
template
<
class
BufferWriterClass
>
template
<
class
BufferWriterClass
>
void
serializeUp
(
BufferWriterClass
&
buffer
)
const
{
void
serializeUp
(
BufferWriterClass
&
buffer
)
const
{
buffer
.
write
(
multipole_exp
,
VectorSize
*
NVALS
*
NRHS
);
buffer
.
write
(
multipole_exp
,
VectorSize
*
NVALS
*
NRHS
);
}
}
template
<
class
BufferReaderClass
>
template
<
class
BufferReaderClass
>
void
deserializeUp
(
BufferReaderClass
&
buffer
){
void
deserializeUp
(
BufferReaderClass
&
buffer
){
buffer
.
fillArray
(
multipole_exp
,
VectorSize
*
NVALS
*
NRHS
);
buffer
.
fillArray
(
multipole_exp
,
VectorSize
*
NVALS
*
NRHS
);
}
}
template
<
class
BufferWriterClass
>
template
<
class
BufferWriterClass
>
void
serializeDown
(
BufferWriterClass
&
buffer
)
const
{
void
serializeDown
(
BufferWriterClass
&
buffer
)
const
{
buffer
.
write
(
local_exp
,
VectorSize
*
NVALS
*
NLHS
);
buffer
.
write
(
local_exp
,
VectorSize
*
NVALS
*
NLHS
);
}
}
template
<
class
BufferReaderClass
>
template
<
class
BufferReaderClass
>
void
deserializeDown
(
BufferReaderClass
&
buffer
){
void
deserializeDown
(
BufferReaderClass
&
buffer
){
buffer
.
fillArray
(
local_exp
,
VectorSize
*
NVALS
*
NLHS
);
buffer
.
fillArray
(
local_exp
,
VectorSize
*
NVALS
*
NLHS
);
}
}
///////////////////////////////////////////////////////
///////////////////////////////////////////////////////
// to extend Serializable
// to extend Serializable
///////////////////////////////////////////////////////
///////////////////////////////////////////////////////
template
<
class
BufferWriterClass
>
template
<
class
BufferWriterClass
>
void
save
(
BufferWriterClass
&
buffer
)
const
{
void
save
(
BufferWriterClass
&
buffer
)
const
{
FBasicCell
::
save
(
buffer
);
FBasicCell
::
save
(
buffer
);
buffer
.
write
(
multipole_exp
,
VectorSize
*
NVALS
*
NRHS
);
buffer
.
write
(
multipole_exp
,
VectorSize
*
NVALS
*
NRHS
);
buffer
.
write
(
local_exp
,
VectorSize
*
NVALS
*
NLHS
);
buffer
.
write
(
local_exp
,
VectorSize
*
NVALS
*
NLHS
);
}
}
template
<
class
BufferReaderClass
>
template
<
class
BufferReaderClass
>
void
restore
(
BufferReaderClass
&
buffer
){
void
restore
(
BufferReaderClass
&
buffer
){
FBasicCell
::
restore
(
buffer
);
FBasicCell
::
restore
(
buffer
);
buffer
.
fillArray
(
multipole_exp
,
VectorSize
*
NVALS
*
NRHS
);
buffer
.
fillArray
(
multipole_exp
,
VectorSize
*
NVALS
*
NRHS
);
buffer
.
fillArray
(
local_exp
,
VectorSize
*
NVALS
*
NLHS
);
buffer
.
fillArray
(
local_exp
,
VectorSize
*
NVALS
*
NLHS
);
}
}
static
constexpr
int
GetSize
(){
static
constexpr
int
GetSize
(){
return
int
(
sizeof
(
FReal
))
*
VectorSize
*
(
NRHS
+
NLHS
)
*
NVALS
;
return
int
(
sizeof
(
FReal
))
*
VectorSize
*
(
NRHS
+
NLHS
)
*
NVALS
;
}
}
// template <class StreamClass>
// const void print(StreamClass& output) const{
template
<
class
StreamClass
>
friend
StreamClass
&
operator
<<
(
StreamClass
&
output
,
const
FChebCell
<
ORDER
,
NRHS
,
NLHS
,
NVALS
>&
cell
){
// const void print() const{
output
<<
" Multipole exp NRHS "
<<
NRHS
<<
" NVALS "
<<
NVALS
<<
" VectorSize/2 "
<<
cell
.
getVectorSize
()
*
0.5
<<
std
::
endl
;
for
(
int
rhs
=
0
;
rhs
<
NRHS
;
++
rhs
)
{
const
FReal
*
pole
=
cell
.
getMultipole
(
rhs
);
for
(
int
val
=
0
;
val
<
NVALS
;
++
val
)
{
output
<<
" val : "
<<
val
<<
" exp: "
;
for
(
int
i
=
0
;
i
<
cell
.
getVectorSize
()
/
2
;
++
i
)
{
output
<<
pole
[
i
]
<<
" "
;
}
output
<<
std
::
endl
;
}
}
return
output
;
}
};
};
template
<
int
ORDER
,
int
NRHS
=
1
,
int
NLHS
=
1
,
int
NVALS
=
1
>
template
<
int
ORDER
,
int
NRHS
=
1
,
int
NLHS
=
1
,
int
NVALS
=
1
>
class
FTypedChebCell
:
public
FChebCell
<
ORDER
,
NRHS
,
NLHS
,
NVALS
>
,
public
FExtendCellType
{
class
FTypedChebCell
:
public
FChebCell
<
ORDER
,
NRHS
,
NLHS
,
NVALS
>
,
public
FExtendCellType
{
public:
public:
template
<
class
BufferWriterClass
>
template
<
class
BufferWriterClass
>
void
save
(
BufferWriterClass
&
buffer
)
const
{
void
save
(
BufferWriterClass
&
buffer
)
const
{
FChebCell
<
ORDER
,
NRHS
,
NLHS
,
NVALS
>::
save
(
buffer
);
FChebCell
<
ORDER
,
NRHS
,
NLHS
,
NVALS
>::
save
(
buffer
);
FExtendCellType
::
save
(
buffer
);
FExtendCellType
::
save
(
buffer
);
}
}
template
<
class
BufferReaderClass
>
template
<
class
BufferReaderClass
>
void
restore
(
BufferReaderClass
&
buffer
){
void
restore
(
BufferReaderClass
&
buffer
){
FChebCell
<
ORDER
,
NRHS
,
NLHS
,
NVALS
>::
restore
(
buffer
);
FChebCell
<
ORDER
,
NRHS
,
NLHS
,
NVALS
>::
restore
(
buffer
);
FExtendCellType
::
restore
(
buffer
);
FExtendCellType
::
restore
(
buffer
);
}
}
void
resetToInitialState
(){
void
resetToInitialState
(){
FChebCell
<
ORDER
,
NRHS
,
NLHS
,
NVALS
>::
resetToInitialState
();
FChebCell
<
ORDER
,
NRHS
,
NLHS
,
NVALS
>::
resetToInitialState
();
FExtendCellType
::
resetToInitialState
();
FExtendCellType
::
resetToInitialState
();
}
}
};
};
#endif //FCHEBCELL_HPP
#endif //FCHEBCELL_HPP
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