#include <vtkInformation.h>
#include <vtkInformationVector.h>
+#define USE_SPRINTF 1
//----------------------------------------------------------------------------
vtkStandardNewMacro(VISU_Extractor);
{
vtkFloatingPointType v = theValue;
+#ifdef USE_SPRINTF
+ char aFormat[16];
+ sprintf(aFormat, "%%.%dg", theDecimals);
+ char aStr [256];
+ sprintf(aStr, aFormat, theValue);
+ v = atof(aStr);
+#else
+
#ifndef USE_OLD_ALGORITHM
- //
+ //
// VSR 19/10/2009: new algorithm does not use long long type
- //
+ //
long n1 = 0;
// calculate order of the integral part
while ( v > 1. ) {
else
while ( n2++ < 0 ) v = v * 10.;
#else
- //
- // VSR 19/10/2009: old algorithm uses long long type -
+ //
+ // VSR 19/10/2009: old algorithm uses long long type -
// causes incompatibility with some platforms (Windows?)
- //
+ //
vtkFloatingPointType aDegree = 0.0;
if (abs((long long)v) > 1)
aDegree = (long long)log10((double)abs((long long)v)) + 1;
aDegree = pow(10, aDegree);
v = ((vtkFloatingPointType)((long long)(v * aDegree))) / aDegree;
//printf("$$$ 2 v = %.20g , aDegree = %lld \n", v, (long long)aDegree);
+#endif
+
#endif
return v;
}
//----------------------------------------------------------------------------
-template<typename TValueType>
+template<typename TValueType>
void
Module2Scalars(vtkDataArray *theInputDataArray,
TValueType* theOutputPtr,
for(vtkIdType aTupleId = 0; aTupleId < theNbOfTuples; aTupleId++){
theInputDataArray->GetTuple(aTupleId, &anArray[0]);
vtkFloatingPointType aVector[3] = {anArray[0], anArray[1], anArray[2]};
- vtkFloatingPointType aScalar = sqrt(aVector[0]*aVector[0] +
- aVector[1]*aVector[1] +
+ vtkFloatingPointType aScalar = sqrt(aVector[0]*aVector[0] +
+ aVector[1]*aVector[1] +
aVector[2]*aVector[2]);
*theOutputPtr = TValueType(aScalar);
theOutputPtr++;