Memosa-FVM  0.2
ScalarArrayWriter< T > Class Template Reference

#include <ArrayWriter.h>

Inheritance diagram for ScalarArrayWriter< T >:
Collaboration diagram for ScalarArrayWriter< T >:

Public Types

typedef T ElementType
 
typedef Array< ElementTypeArrayType
 
typedef NumTypeTraits< T >
::T_BuiltIn 
T_BuiltIn
 

Public Member Functions

 ScalarArrayWriter (const bool binary, const int vectorComponent, const int atypeComponent)
 
void write (FILE *fp, const Array< T > &array, const int iBeg, int count, const Array< bool > *mask=0)
 
- Public Member Functions inherited from ArrayWriter
 ArrayWriter (const bool binary, const int vectorComponent, const int atypeComponent)
 
virtual ~ArrayWriter ()
 
template<class T >
void writeFloats (FILE *fp, const T *data, const int count, const int stride, const Array< bool > *mask=0)
 

Additional Inherited Members

- Protected Attributes inherited from ArrayWriter
const bool _binary
 
const int _vectorComponent
 
const int _atypeComponent
 

Detailed Description

template<class T>
class ScalarArrayWriter< T >

Definition at line 48 of file ArrayWriter.h.

Member Typedef Documentation

template<class T>
typedef Array<ElementType> ScalarArrayWriter< T >::ArrayType

Definition at line 52 of file ArrayWriter.h.

template<class T>
typedef T ScalarArrayWriter< T >::ElementType

Definition at line 51 of file ArrayWriter.h.

template<class T>
typedef NumTypeTraits<T>::T_BuiltIn ScalarArrayWriter< T >::T_BuiltIn

Definition at line 53 of file ArrayWriter.h.

Constructor & Destructor Documentation

template<class T>
ScalarArrayWriter< T >::ScalarArrayWriter ( const bool  binary,
const int  vectorComponent,
const int  atypeComponent 
)
inline

Definition at line 55 of file ArrayWriter.h.

56  :
57  ArrayWriter(binary,vectorComponent,atypeComponent)
58  {}
ArrayWriter(const bool binary, const int vectorComponent, const int atypeComponent)
Definition: ArrayWriter.h:15

Member Function Documentation

template<class T>
void ScalarArrayWriter< T >::write ( FILE *  fp,
const Array< T > &  array,
const int  iBeg,
int  count,
const Array< bool > *  mask = 0 
)
inline

Definition at line 60 of file ArrayWriter.h.

References ArrayWriter::_atypeComponent, Array< T >::getData(), Array< T >::getLength(), and ArrayWriter::writeFloats().

Referenced by FluentDataExporter< T >::writeScalarField().

63  {
64  const int length = array.getLength();
65  if (count == -1)
66  count = length;
67  else if (count+iBeg > length)
68  throw CException("invalid count ");
69 
70  ElementType *dataArray = (ElementType*)(array.getData());
71 
72  T_BuiltIn *data = (T_BuiltIn*)(dataArray+iBeg);
73 
74  int stride = 1;
75 
76 #ifdef USING_ATYPE_TANGENT
77  if ((_atypeComponent == 0) || (_atypeComponent == 1))
78  {
79  data += _atypeComponent;
80  stride = 2;
81  }
82  else
83  throw CException("invalid component for Tangent");
84 
85 #endif
86  writeFloats(fp,data,count,stride,mask);
87  }
NumTypeTraits< T >::T_BuiltIn T_BuiltIn
Definition: ArrayWriter.h:53
void writeFloats(FILE *fp, const T *data, const int count, const int stride, const Array< bool > *mask=0)
Definition: ArrayWriter.h:25
const int _atypeComponent
Definition: ArrayWriter.h:44
virtual void * getData() const
Definition: Array.h:275
int getLength() const
Definition: Array.h:87

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