1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125 | // *****************************************************************************
/*!
\file src/Transfer/TransferDetails.hpp
\copyright 2020 Charmworks, Inc.
All rights reserved. See the LICENSE file for details.
\brief Chare class declaration for mesh transfer workers holding part of a
mesh
\details Chare class declaration for mesh transfer workers holding part of a
mesh.
*/
// *****************************************************************************
#ifndef TransferDetails_h
#define TransferDetails_h
#include "Types.hpp"
#include "PUPUtil.hpp"
#include "UnsMesh.hpp"
#include "CommMap.hpp"
#include "Fields.hpp"
#include "NoWarning/transferdetails.decl.h"
namespace exam2m {
class PotentialCollision {
public:
std::size_t source_index, dest_index;
CkVector3d point;
void pup(PUP::er& p) { p | source_index; p | dest_index; p | point; }<--- Parameter 'p' can be declared with const
};
class SolutionData {
public:
std::size_t dest_index;
std::vector< tk::real > solution;
void pup(PUP::er& p) { p | dest_index; p | solution; }<--- Parameter 'p' can be declared with const
};
//! TransferDetails chare array holding part of a mesh
class TransferDetails : public CBase_TransferDetails {
public:
//! Constructor
explicit TransferDetails( CkArrayID p, MeshData d, CkCallback cb );
#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wundefined-func-template"
#endif
//! Migrate constructor
// cppcheck-suppress uninitMemberVar
explicit TransferDetails( CkMigrateMessage* ) {}
#if defined(__clang__)
#pragma clang diagnostic pop
#endif
//! Set the source mesh data
void setSourceTets( std::vector< std::size_t>* inpoel,
tk::UnsMesh::Coords* coords,
const tk::Fields& u );
//! Set the destination mesh data
void setDestPoints( tk::UnsMesh::Coords* coords,
tk::Fields& u,
CkCallback cb );
//! Process potential collisions in the destination mesh
void processCollisions( CProxy_TransferDetails proxy,
int nchare,
int offset,
int nColls,
Collision* colls );
//! Identify actual collisions in the source mesh
void determineActualCollisions( CProxy_TransferDetails proxy,
int index,
int nColls,
PotentialCollision* colls ) const;
//! Transfer the interpolated solution data back to destination mesh
void transferSolution( const std::vector< SolutionData >& soln );
/** @name Charm++ pack/unpack serializer member functions */
///@{
//! \brief Pack/Unpack serialize member function
//! \param[in,out] p Charm++'s PUP::er serializer object reference
void pup( PUP::er &p ) override {
p | m_firstchunk;
}
//! \brief Pack/Unpack serialize operator|
//! \param[in,out] p Charm++'s PUP::er serializer object reference
//! \param[in,out] i TransferDetails object reference
friend void operator|( PUP::er& p, TransferDetails& i ) { i.pup(p); }
//@}
private:
//! The ID of my first chunk (used for collision detection library)
int m_firstchunk;
//! Pointer to element connectivity
std::vector< std::size_t >* m_inpoel;
//! Pointer to point coordinates
tk::UnsMesh::Coords* m_coord;
//! Pointer to solution in mesh nodes
tk::Fields* m_u;
//! The number of messages sent by the dest mesh
int m_numsent;
//! The number of messages received by the dest mesh
int m_numreceived;
//! Called once the transfer is complete (m_numsent == m_numreceived)
CkCallback m_donecb;
//! Initialize dest mesh solution with background data
void background();
//! Contribute vertex information to the collsion detection library
void collideVertices();
//! Contribute tet information to the collision detection library
void collideTets() const;
};
} // exam2m::
#endif // TransferDetails_h
|