MAIA bb96820c
Multiphysics at AIA
Loading...
Searching...
No Matches
maia::acoustic_analogy::observer_collector::ObserverDataCollector< nDim > Class Template Reference

Class that represents DG element collector. More...

#include <acaobserverdatacollector.h>

Inheritance diagram for maia::acoustic_analogy::observer_collector::ObserverDataCollector< nDim >:
[legend]
Collaboration diagram for maia::acoustic_analogy::observer_collector::ObserverDataCollector< nDim >:
[legend]

Public Types

template<class T >
using Invalid = typename maia::acoustic_analogy::observer_collector::Invalid< T >
 

Public Member Functions

constexpr ObserverDataCollector ()=default
 Default c'tor does nothing. More...
 
MFloatobserverCoordinates (const MInt id)
 Accessor for surface element coordinates. More...
 
MFloat observerCoordinates (const MInt id) const
 Accessor for surface element coordinates (const version). More...
 
MFloat observerCoordinates (const MInt id, const MInt component) const
 Accessor for surface element coordinates (const version). More...
 
MFloatvariables (const MInt id, const MInt var)
 Accessor for variables (return a reference to the start of the given variable in memory). More...
 
MFloatvariables (const MInt id)
 
MFloatvariables (const MInt id, const MInt var, const MInt sample)
 
MFloat variables (const MInt id, const MInt var, const MInt sample) const
 Accessor for variables (const version). More...
 
MFloatcomplexVariables (const MInt id, const MInt var)
 Accessor for complex variables. More...
 
MFloatcomplexVariables (const MInt id)
 
MFloatcomplexVariables (const MInt id, const MInt var, const MInt sample, const MInt component)
 
MFloat complexVariables (const MInt id, const MInt var, const MInt sample, const MInt component) const
 Accessor for complex variables (const version). More...
 
MInt noVars ()
 Return number of variables. More...
 
void setNoVars (const MInt noVars_)
 Set number of variables. More...
 
MInt noComplexVars ()
 Return number of complex variables. More...
 
void setNoComplexVars (const MInt noComplexVars_)
 Set number of complex variables. More...
 
MInt noSamples ()
 Return number of samples (i.e. number of time steps) More...
 
void setNoSamples (const MInt noSamples_)
 Set number of samples. More...
 
- Public Member Functions inherited from maia::container::Container< ObserverDataCollector< nDim >, Invalid >
constexpr Container ()=default
 Default c'tor does nothing. More...
 
constexpr MInt capacity () const
 Return capacity (i.e., maximum number of nodes) More...
 
void reset (const MInt capacity)
 Reset tree, re-create data structures with given capacity, and set size to zero. More...
 
void resize (const MInt capacity)
 Resize the container capacity. More...
 
constexpr MInt size () const
 Return size (i.e., currently used number of nodes) More...
 
void size (const MInt size_)
 Resize tree WITHOUT CONSIDERING ANY NODE CONSISTENCY! Use at own risk and remove ASAP... More...
 
void append (const MInt count)
 Append nodes to end of tree. More...
 
void append ()
 
void shrink (const MInt count)
 Remove nodes from end of tree. More...
 
void shrink ()
 
void copy (const T &source, const MInt begin, const MInt end, const MInt to)
 Copy nodes to another location without changing any parent/child/neighbor information. More...
 
void copy (const T &source, const MInt from, const MInt to)
 
void copy (const MInt begin, const MInt end, const MInt to)
 
void copy (const MInt from, const MInt to)
 
void move (const MInt begin, const MInt end, const MInt to)
 Move nodes to another location and update parent/child/neighbor information accordingly. More...
 
void move (const MInt from, const MInt to)
 
void swap (const MInt a, const MInt b)
 Swap two nodes and update parent/child/neighbor information accordingly. More...
 
void insert (const MInt begin, const MInt count)
 
void insert (const MInt id)
 
void erase (const MInt begin, const MInt end)
 Erase nodes in range [begin, end) and update parent/child/neighbor information. More...
 
void erase (const MInt id)
 
void removeAndShift (const MInt begin, const MInt end)
 
void removeAndShift (const MInt id)
 
void removeAndFill (const MInt begin, const MInt end)
 
void removeAndFill (const MInt id)
 
void clear ()
 Clear tree by invalidating all nodes and setting size to zero. More...
 
ObserverDataCollector< nDim > & derived ()
 
const ObserverDataCollector< nDim > & derived () const
 
void rawCopy (const T &source, const MInt begin, const MInt end, const MInt to)
 Copy range of nodes [begin, end) to range starting at 'to'. More...
 
void rawCopy (const T &source, const MInt from, const MInt to)
 
void deleteConnectivity (const MInt NotUsed(begin), const MInt NotUsed(end))
 
void moveConnectivity (const MInt NotUsed(begin), const MInt NotUsed(end), const MInt NotUsed(to))
 
void moveConnectivity (const MInt from, const MInt to)
 
constexpr MInt dummy () const
 

Private Types

using Base = maia::container::Container< ObserverDataCollector< nDim >, Invalid >
 
template<class T >
using Storage = typename Base::template Storage< T >
 

Private Member Functions

void reset ()
 Reset, re-create data structures with given capacity, and set size to zero. More...
 
void invalidate (const MInt begin, const MInt end)
 Erase range of nodes such that they contain no sensible values anymore. More...
 
template<class Functor , class T >
void rawCopyGeneric (Functor &&c, const T &source, const MInt begin, const MInt end, const MInt destination)
 Helper function for rawCopy(). Destination may refer to beginning or end of target range. More...
 

Private Attributes

MInt m_noVars = -1
 
MInt m_noComplexVars = -1
 
MInt m_noSamples = -1
 
Storage< MFloatm_observerCoordinates {}
 
Storage< MFloatm_variables {}
 
Storage< MFloatm_complexVariables {}
 

Static Private Attributes

static constexpr MInt s_maxNoVars = 10
 Maximum number of variables (in the time domain) More...
 
static constexpr MInt s_maxNoComplexVars = 5
 Maximum number of complex variables (in the frequency domain) More...
 
static constexpr MInt s_maxNoSamples = 1048576
 Maximum number of samples. More...
 

Friends

class maia::container::Container< ObserverDataCollector< nDim >, Invalid >
 

Additional Inherited Members

- Protected Types inherited from maia::container::Container< ObserverDataCollector< nDim >, Invalid >
using Storage = std::vector< T >
 
- Protected Member Functions inherited from maia::container::Container< ObserverDataCollector< nDim >, Invalid >
virtual void resize ()
 
void resetStorage (const MInt n, Storage< T > &c)
 Create new container with given size and replace original one. More...
 
void resizeStorage (const MInt n, Storage< T > &c)
 Resize container with given size. More...
 
void fill_invalid (Container_ &c, const MInt begin, const MInt end, const MInt solverSize=1, const T value=Invalid< T >::value())
 
void copyData (const Container_ &source, Container_ &target, Functor &&f, const MInt begin, const MInt end, const MInt dest, const MInt solverSize=1)
 Copy [begin, end) range with given solver size from source to dest position of target. More...
 
MBool isValidId (const MInt id) const
 Return whether given id refers to a valid node (auxiliary method). More...
 

Detailed Description

template<MInt nDim>
class maia::acoustic_analogy::observer_collector::ObserverDataCollector< nDim >

Definition at line 111 of file acaobserverdatacollector.h.

Member Typedef Documentation

◆ Base

◆ Invalid

Definition at line 124 of file acaobserverdatacollector.h.

◆ Storage

template<MInt nDim>
template<class T >
using maia::acoustic_analogy::observer_collector::ObserverDataCollector< nDim >::Storage = typename Base::template Storage<T>
private

Definition at line 119 of file acaobserverdatacollector.h.

Constructor & Destructor Documentation

◆ ObserverDataCollector()

template<MInt nDim>
constexpr maia::acoustic_analogy::observer_collector::ObserverDataCollector< nDim >::ObserverDataCollector ( )
constexprdefault

Member Function Documentation

◆ complexVariables() [1/4]

template<MInt nDim>
MFloat & maia::acoustic_analogy::observer_collector::ObserverDataCollector< nDim >::complexVariables ( const MInt  id)
inline

Definition at line 147 of file acaobserverdatacollector.h.

147{ return complexVariables(id, 0); };
MFloat & complexVariables(const MInt id, const MInt var)
Accessor for complex variables.

◆ complexVariables() [2/4]

template<MInt nDim>
MFloat & maia::acoustic_analogy::observer_collector::ObserverDataCollector< nDim >::complexVariables ( const MInt  id,
const MInt  var 
)

Definition at line 302 of file acaobserverdatacollector.h.

302 {
303// Prevent accidental compilation without support for SoA layout
304#ifdef ACACOLLECTOR_SOA_MEMORY_LAYOUT
305#error Missing implementation for structure-of-arrays memory layout.
306#endif
307 ENSURE_VALID_ID_ACCESSOR(id);
308 ENSURE_VALID_VARIABLE_ID_ACCESSOR(var);
309 return m_complexVariables[id * 2 * noComplexVars() * noSamples() + var * 2 * noSamples()];
310}
MInt noSamples()
Return number of samples (i.e. number of time steps)

◆ complexVariables() [3/4]

template<MInt nDim>
MFloat & maia::acoustic_analogy::observer_collector::ObserverDataCollector< nDim >::complexVariables ( const MInt  id,
const MInt  var,
const MInt  sample,
const MInt  component 
)

NOTE: the following complexariables accessors might be very inefficient to use in a loop e.g. over all samples and should only be used during the development of the method. Accessor for complex variables.

Definition at line 317 of file acaobserverdatacollector.h.

318 {
319// Prevent accidental compilation without support for SoA layout
320#ifdef ACACOLLECTOR_SOA_MEMORY_LAYOUT
321#error Missing implementation for structure-of-arrays memory layout.
322#endif
323 ENSURE_VALID_ID_ACCESSOR(id);
324 ENSURE_VALID_VARIABLE_ID_ACCESSOR(var);
325 ENSURE_VALID_SAMPLE_ID_ACCESSOR(sample);
326 return m_complexVariables[id * 2 * noComplexVars() * noSamples() + var * 2 * noSamples() + 2 * sample + component];
327}

◆ complexVariables() [4/4]

template<MInt nDim>
MFloat maia::acoustic_analogy::observer_collector::ObserverDataCollector< nDim >::complexVariables ( const MInt  id,
const MInt  var,
const MInt  sample,
const MInt  component 
) const

Definition at line 330 of file acaobserverdatacollector.h.

331 {
332// Prevent accidental compilation without support for SoA layout
333#ifdef ACACOLLECTOR_SOA_MEMORY_LAYOUT
334#error Missing implementation for structure-of-arrays memory layout.
335#endif
336 ENSURE_VALID_ID_ACCESSOR(id);
337 ENSURE_VALID_VARIABLE_ID_ACCESSOR(var);
338 ENSURE_VALID_SAMPLE_ID_ACCESSOR(sample);
339 return m_complexVariables[id * 2 * noComplexVars() * noSamples() + var * 2 * noSamples() + 2 * sample + component];
340}

◆ invalidate()

template<MInt nDim>
void maia::acoustic_analogy::observer_collector::ObserverDataCollector< nDim >::invalidate ( const MInt  begin,
const MInt  end 
)
private

Definition at line 345 of file acaobserverdatacollector.h.

345 {
346// Prevent accidental compilation without support for SoA layout
347#ifdef ACACOLLECTOR_SOA_MEMORY_LAYOUT
348#error Missing implementation for structure-of-arrays memory layout.
349#endif
350
351 const MInt varSize = noVars() * noSamples();
352 const MInt complexVarSize = 2 * noComplexVars() * noSamples();
353
354 // Observer coordinates
355 fill_invalid(m_observerCoordinates, begin, end, nDim);
356
357 // Variables
358 fill_invalid(m_variables, begin, end, varSize);
359
360 // Complex variables
361 fill_invalid(m_complexVariables, begin, end, complexVarSize);
362}
void fill_invalid(Container_ &c, const MInt begin, const MInt end, const MInt solverSize=1, const T value=Invalid< T >::value())
Definition: container.h:131
int32_t MInt
Definition: maiatypes.h:62

◆ noComplexVars()

◆ noSamples()

◆ noVars()

◆ observerCoordinates() [1/3]

template<MInt nDim>
MFloat & maia::acoustic_analogy::observer_collector::ObserverDataCollector< nDim >::observerCoordinates ( const MInt  id)

Definition at line 229 of file acaobserverdatacollector.h.

229 {
230// Prevent accidental compilation without support for SoA layout
231#ifdef ACACOLLECTOR_SOA_MEMORY_LAYOUT
232#error Missing implementation for structure-of-arrays memory layout.
233#endif
234 ENSURE_VALID_ID_ACCESSOR(id);
235 return m_observerCoordinates[id * nDim];
236}

◆ observerCoordinates() [2/3]

template<MInt nDim>
MFloat maia::acoustic_analogy::observer_collector::ObserverDataCollector< nDim >::observerCoordinates ( const MInt  id) const

Definition at line 239 of file acaobserverdatacollector.h.

239 {
240// Prevent accidental compilation without support for SoA layout
241#ifdef ACACOLLECTOR_SOA_MEMORY_LAYOUT
242#error Missing implementation for structure-of-arrays memory layout.
243#endif
244 ENSURE_VALID_ID_ACCESSOR(id);
245 return m_observerCoordinates[id * nDim];
246}

◆ observerCoordinates() [3/3]

template<MInt nDim>
MFloat maia::acoustic_analogy::observer_collector::ObserverDataCollector< nDim >::observerCoordinates ( const MInt  id,
const MInt  component 
) const

Definition at line 249 of file acaobserverdatacollector.h.

249 {
250// Prevent accidental compilation without support for SoA layout
251#ifdef ACACOLLECTOR_SOA_MEMORY_LAYOUT
252#error Missing implementation for structure-of-arrays memory layout.
253#endif
254 ENSURE_VALID_ID_ACCESSOR(id);
255 return m_observerCoordinates[id * nDim + component];
256}

◆ rawCopyGeneric()

template<MInt nDim>
template<class Functor , class T >
void maia::acoustic_analogy::observer_collector::ObserverDataCollector< nDim >::rawCopyGeneric ( Functor &&  c,
const T &  source,
const MInt  begin,
const MInt  end,
const MInt  destination 
)
private

Definition at line 368 of file acaobserverdatacollector.h.

369 {
370// Prevent accidental compilation without support for SoA layout
371#ifdef ACACOLLECTOR_SOA_MEMORY_LAYOUT
372#error Missing implementation for structure-of-arrays memory layout.
373#endif
374
375 const MInt varSize = noVars() * noSamples();
376 const MInt complexVarSize = 2 * noComplexVars() * noSamples();
377
378 // Observer coordinates
379 copyData(source.m_observerCoordinates, m_observerCoordinates, c, begin, end, destination, nDim);
380
381 // Variables
382 copyData(source.m_variables, m_variables, c, begin, end, destination, varSize);
383
384 // Variables
385 copyData(source.m_complexVariables, m_complexVariables, c, begin, end, destination, complexVarSize);
386}
void copyData(const Container_ &source, Container_ &target, Functor &&f, const MInt begin, const MInt end, const MInt dest, const MInt solverSize=1)
Copy [begin, end) range with given solver size from source to dest position of target.
Definition: container.h:138

◆ reset()

template<MInt nDim>
void maia::acoustic_analogy::observer_collector::ObserverDataCollector< nDim >::reset
private

Definition at line 217 of file acaobserverdatacollector.h.

217 {
218 const MInt varSize = noVars() * noSamples();
219 const MInt complexVarSize = 2 * noComplexVars() * noSamples();
220
222 resetStorage(varSize, m_variables);
223 resetStorage(complexVarSize, m_complexVariables);
224}
void resetStorage(const MInt n, Storage< T > &c)
Create new container with given size and replace original one.
Definition: container.h:420

◆ setNoComplexVars()

template<MInt nDim>
void maia::acoustic_analogy::observer_collector::ObserverDataCollector< nDim >::setNoComplexVars ( const MInt  noComplexVars_)
inline

Definition at line 165 of file acaobserverdatacollector.h.

165 {
166 ENSURE_CONDITION(noComplexVars_ > 0 && noComplexVars_ <= s_maxNoComplexVars,
167 "Invalid number of complex variables.");
168 m_noComplexVars = noComplexVars_;
169 };
static constexpr MInt s_maxNoComplexVars
Maximum number of complex variables (in the frequency domain)

◆ setNoSamples()

template<MInt nDim>
void maia::acoustic_analogy::observer_collector::ObserverDataCollector< nDim >::setNoSamples ( const MInt  noSamples_)
inline

Definition at line 174 of file acaobserverdatacollector.h.

174 {
175 ENSURE_CONDITION(noSamples_ > 0 && noSamples_ <= s_maxNoSamples, "Invalid number of samples.");
176 m_noSamples = noSamples_;
177 };
static constexpr MInt s_maxNoSamples
Maximum number of samples.

◆ setNoVars()

template<MInt nDim>
void maia::acoustic_analogy::observer_collector::ObserverDataCollector< nDim >::setNoVars ( const MInt  noVars_)
inline

Definition at line 157 of file acaobserverdatacollector.h.

157 {
158 ENSURE_CONDITION(noVars_ > 0 && noVars_ <= s_maxNoVars, "Invalid number of variables.");
159 m_noVars = noVars_;
160 };
static constexpr MInt s_maxNoVars
Maximum number of variables (in the time domain)

◆ variables() [1/4]

template<MInt nDim>
MFloat & maia::acoustic_analogy::observer_collector::ObserverDataCollector< nDim >::variables ( const MInt  id)
inline

Definition at line 141 of file acaobserverdatacollector.h.

141{ return variables(id, 0); };
MFloat & variables(const MInt id, const MInt var)
Accessor for variables (return a reference to the start of the given variable in memory).

◆ variables() [2/4]

template<MInt nDim>
MFloat & maia::acoustic_analogy::observer_collector::ObserverDataCollector< nDim >::variables ( const MInt  id,
const MInt  var 
)

Definition at line 261 of file acaobserverdatacollector.h.

261 {
262// Prevent accidental compilation without support for SoA layout
263#ifdef ACACOLLECTOR_SOA_MEMORY_LAYOUT
264#error Missing implementation for structure-of-arrays memory layout.
265#endif
266 ENSURE_VALID_ID_ACCESSOR(id);
267 ENSURE_VALID_VARIABLE_ID_ACCESSOR(var);
268 return m_variables[id * noVars() * noSamples() + var * noSamples()];
269}

◆ variables() [3/4]

template<MInt nDim>
MFloat & maia::acoustic_analogy::observer_collector::ObserverDataCollector< nDim >::variables ( const MInt  id,
const MInt  var,
const MInt  sample 
)

NOTE: the following variables accessors might be very inefficient to use in a loop e.g. over all samples and should only be used during the development of the method. Accessor for variables.

Definition at line 276 of file acaobserverdatacollector.h.

276 {
277// Prevent accidental compilation without support for SoA layout
278#ifdef ACACOLLECTOR_SOA_MEMORY_LAYOUT
279#error Missing implementation for structure-of-arrays memory layout.
280#endif
281 ENSURE_VALID_ID_ACCESSOR(id);
282 ENSURE_VALID_VARIABLE_ID_ACCESSOR(var);
283 ENSURE_VALID_SAMPLE_ID_ACCESSOR(sample);
284 return m_variables[id * noVars() * noSamples() + var * noSamples() + sample];
285}

◆ variables() [4/4]

template<MInt nDim>
MFloat maia::acoustic_analogy::observer_collector::ObserverDataCollector< nDim >::variables ( const MInt  id,
const MInt  var,
const MInt  sample 
) const

Definition at line 288 of file acaobserverdatacollector.h.

288 {
289// Prevent accidental compilation without support for SoA layout
290#ifdef ACACOLLECTOR_SOA_MEMORY_LAYOUT
291#error Missing implementation for structure-of-arrays memory layout.
292#endif
293 ENSURE_VALID_ID_ACCESSOR(id);
294 ENSURE_VALID_VARIABLE_ID_ACCESSOR(var);
295 ENSURE_VALID_SAMPLE_ID_ACCESSOR(sample);
296 return m_variables[id * noVars() * noSamples() + var * noSamples() + sample];
297}

Friends And Related Function Documentation

◆ maia::container::Container< ObserverDataCollector< nDim >, Invalid >

template<MInt nDim>
friend class maia::container::Container< ObserverDataCollector< nDim >, Invalid >
friend

Definition at line 99 of file acaobserverdatacollector.h.

Member Data Documentation

◆ m_complexVariables

template<MInt nDim>
Storage<MFloat> maia::acoustic_analogy::observer_collector::ObserverDataCollector< nDim >::m_complexVariables {}
private

Definition at line 204 of file acaobserverdatacollector.h.

◆ m_noComplexVars

template<MInt nDim>
MInt maia::acoustic_analogy::observer_collector::ObserverDataCollector< nDim >::m_noComplexVars = -1
private

Definition at line 196 of file acaobserverdatacollector.h.

◆ m_noSamples

template<MInt nDim>
MInt maia::acoustic_analogy::observer_collector::ObserverDataCollector< nDim >::m_noSamples = -1
private

Definition at line 199 of file acaobserverdatacollector.h.

◆ m_noVars

template<MInt nDim>
MInt maia::acoustic_analogy::observer_collector::ObserverDataCollector< nDim >::m_noVars = -1
private

Definition at line 193 of file acaobserverdatacollector.h.

◆ m_observerCoordinates

template<MInt nDim>
Storage<MFloat> maia::acoustic_analogy::observer_collector::ObserverDataCollector< nDim >::m_observerCoordinates {}
private

Definition at line 202 of file acaobserverdatacollector.h.

◆ m_variables

Definition at line 203 of file acaobserverdatacollector.h.

◆ s_maxNoComplexVars

template<MInt nDim>
constexpr MInt maia::acoustic_analogy::observer_collector::ObserverDataCollector< nDim >::s_maxNoComplexVars = 5
staticconstexprprivate

Definition at line 209 of file acaobserverdatacollector.h.

◆ s_maxNoSamples

template<MInt nDim>
constexpr MInt maia::acoustic_analogy::observer_collector::ObserverDataCollector< nDim >::s_maxNoSamples = 1048576
staticconstexprprivate

Definition at line 211 of file acaobserverdatacollector.h.

◆ s_maxNoVars

template<MInt nDim>
constexpr MInt maia::acoustic_analogy::observer_collector::ObserverDataCollector< nDim >::s_maxNoVars = 10
staticconstexprprivate

Definition at line 207 of file acaobserverdatacollector.h.


The documentation for this class was generated from the following file: