17 const T* weight)
const {
20 tString typeName=CORE_Object::getTypeName<T>();
25 if (vtkType.compare(
"")==0)
return false;
29 file <<
"<DataArray type=\""+vtkType+
"\" Name=\""<<name<<
"\" ";
31 if (dim>1) file <<
"NumberOfComponents=\""<<dim<<
"\" ";
33 file <<
"format=\"ascii\">"<<endl;
36 tUIndex i,end=endIndex,start=startIndex;
42 const T *pWeight=weight;
46 if (pWeight!=
null) w=(*pWeight);
47 tBoolean isWeightUniform=((pWeight==
null) || (nWeight<=1));
48 if ((!isWeightUniform) && (nWeight!=n))
50 "EMM_VTK::writeField",
51 "weight has incompatible size");
56 if (isWeightUniform) {
59 for(i=start;i<end;i+=inc){
69 pWeight=&weight[start];
70 for(i=start;i<end;i+=inc){
72 file<<
toVTKNumber(vtkType,( (*pWeight) * (*pArray)))<<
" ";
83 pArray=&array[dim*start];
85 if (isWeightUniform) {
86 for(i=start;i<end;i++){
94 pWeight=&weight[start];
95 for(i=start;i<end;i++){
97 file<<
toVTKNumber(vtkType,((*pWeight)*(*pArray)))<<
" ";
106 if (isWeightUniform) {
107 for(i=start;i<end;i+=inc){
108 for (k=0;k<dim;k++) {
117 pWeight=&weight[start];
118 for(i=start;i<end;i+=inc){
119 for (k=0;k<dim;k++) {
120 file<<
toVTKNumber(vtkType,((*pWeight)*(*pArray)))<<
" ";
133 file<<
"</DataArray>"<<endl;
tBoolean writeField(ofstream &file, const tString &name, const tBoolean &isUniform, const tUIndex &n, const tUSInt &dim, const tUIndex &startIndex, const tUIndex &endIndex, const tUIndex &inc, const T *array) const
write an array of T type in file
Definition: EMM_VTK.h:186
#define tUSInt
Definition: types.h:28
#define tBoolean
Definition: types.h:139
#define null
Definition: types.h:144
tString getVTKType() const
return the VTK type of the template Type
Definition: EMM_VTK.h:76
#define tUIndex
Definition: types.h:126
#define tString
Definition: types.h:135
this class describes the exceptions raised for E-MicromM package
Definition: EMM_Exception.h:14
static T toVTKNumber(const tString &vtkType, const T &value)
turn the value into vtk type
Definition: EMM_VTK.h:231