diff --git a/BOVReader.cxx b/BOVReader.cxx index 3de7133..4d7093d 100644 --- a/BOVReader.cxx +++ b/BOVReader.cxx @@ -35,7 +35,7 @@ using std::ostringstream; #define PATH_SEP "/" #endif -#define BOVReaderTIME +//#define BOVReaderTIME #ifdef WIN32 // these are only usefull in terminals diff --git a/CMakeLists.txt b/CMakeLists.txt index fe005a9..272ec08 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,10 +28,10 @@ include(GetDate.cmake) # identify the build set(SQTK_RELEASE "20120524") -message(STATUS "SQTK release ${SQTK_RELEASE}") -set (SQTK_BUILD) -GetDate(SQTK_BUILD) -message(STATUS "SQTK build ${SQTK_BUILD}") +set(SQTK_BUILD_DATE) +GetDate(SQTK_BUILD_DATE) +set (SQTK_VERSION "SQTK-${SQTK_RELEASE} ${CMAKE_SYSTEM} ${CMAKE_CXX_COMPILER} ${SQTK_BUILD_DATE}") +message(STATUS "SQTK version ${SQTK_VERSION}") # put the plugin inside the pv install set(SQTK_LIB_INSTALL_PATH @@ -55,6 +55,7 @@ set(SM_CXX_SOURCES vtkSQImageSource.cxx vtkSQKernelConvolution.cxx vtkSQLineSource.cxx + vtkSQLog.cxx vtkSQMedianFilter.cxx vtkSQPlaneSourceCellGenerator.cxx vtkSQPStreamTracer.cxx @@ -133,7 +134,6 @@ set(CXX_SOURCES UnstructuredGridCellCopier.cxx vtkSQHemisphereSourceConfigurationWriter.cxx vtkSQHemisphereSourceConfigurationReader.cxx - vtkSQLog.cxx vtkSQMetaDataKeys.cxx vtkSQOOCBOVReader.cxx vtkSQOOCReader.cxx @@ -334,7 +334,7 @@ endif() # Generate the plugin, servermanager and wrapped language bindings. add_paraview_plugin( - SciberQuestToolKit "${SQTK_RELEASE}.${SQTK_BUILD}" + SciberQuestToolKit "${SQTK_VERSION}" GUI_INTERFACES ${_IFACES} SERVER_MANAGER_SOURCES ${SM_CXX_SOURCES} SERVER_MANAGER_XML ${SQTK_SM_XML} diff --git a/CPUConvolutionDriver.cxx b/CPUConvolutionDriver.cxx index a1ca102..d79475b 100644 --- a/CPUConvolutionDriver.cxx +++ b/CPUConvolutionDriver.cxx @@ -6,7 +6,6 @@ Copyright 2012 SciberQuest Inc. */ - #include "CPUConvolutionDriver.h" #include "CartesianExtent.h" @@ -22,6 +21,7 @@ using std::cerr; using std::endl; #include using std::vector; +#include //#define CPUConvolutionDriverDEBUG diff --git a/GetDate.cmake b/GetDate.cmake index bf0d0ee..11460e2 100644 --- a/GetDate.cmake +++ b/GetDate.cmake @@ -6,14 +6,11 @@ # Copyright 2012 SciberQuest Inc. # macro (GetDate RESULT) + set(${RESULT} "00/00/0000") if (WIN32) - EXECUTE_PROCESS(COMMAND "date" "/T" OUTPUT_VARIABLE ${RESULT}) - string(REGEX REPLACE "(..)/(..)/..(..).*" "\\3\\2\\1" ${RESULT} ${${RESULT}}) + execute_process(COMMAND "cmd" " /C date /T" OUTPUT_VARIABLE ${RESULT}) elseif (UNIX) - EXECUTE_PROCESS(COMMAND "date" "+%d/%m/%Y" OUTPUT_VARIABLE ${RESULT}) - string(REGEX REPLACE "(..)/(..)/..(..).*" "\\3\\2\\1" ${RESULT} ${${RESULT}}) - else () - MESSAGE(SEND_ERROR "date not implemented") - SET(${RESULT} 000000) - endif () + execute_process(COMMAND "date" "+%d/%m/%Y" OUTPUT_VARIABLE ${RESULT}) + endif () + string(REGEX REPLACE "(.*)(\n|\r)$" "\\1" ${RESULT} ${${RESULT}}) endmacro () diff --git a/MPIRawArrayIO.hxx b/MPIRawArrayIO.hxx index 2e33de1..c8183cf 100644 --- a/MPIRawArrayIO.hxx +++ b/MPIRawArrayIO.hxx @@ -5,15 +5,13 @@ /___/\__/_/_.__/\__/_/ \___\_\_,_/\__/___/\__/ /___/_//_/\__(_) Copyright 2012 SciberQuest Inc. - */ #ifndef __MPIRawArrayIO_hxx #define __MPIRawArrayIO_hxx -// disbale warning about passing string literals. -#if not defined(__INTEL_COMPILER) && defined(__GNUG__) -#pragma GCC diagnostic ignored "-Wwrite-strings" -#endif +#include "CartesianExtent.h" +#include "SQMacros.h" +#include "postream.h" #ifdef SQTK_WITHOUT_MPI #define MPI_FLOAT 0 @@ -38,10 +36,6 @@ typedef void * MPI_Comm; #include #endif -#include "CartesianExtent.h" -#include "SQMacros.h" -#include "postream.h" - //============================================================================= template class DataTraits; diff --git a/MemOrder.hxx b/MemOrder.hxx index 087ff8c..42f06df 100644 --- a/MemOrder.hxx +++ b/MemOrder.hxx @@ -6,10 +6,12 @@ Copyright 2012 SciberQuest Inc. */ +#include "SQMacros.h" #include using std::vector; + //***************************************************************************** enum { REORDER_SPLIT=1, @@ -207,5 +209,4 @@ void Interleave( V[ii+q]=W[q][i]; } } -} - +} \ No newline at end of file diff --git a/Numerics.hxx b/Numerics.hxx index 0c43f22..03c39e8 100644 --- a/Numerics.hxx +++ b/Numerics.hxx @@ -18,6 +18,7 @@ using std::endl; #pragma GCC diagnostic ignored "-Wshadow" #endif +#include #include #include using std::complex; @@ -27,17 +28,7 @@ using namespace Eigen; #include "Tuple.hxx" #include "FlatIndex.h" - -// help MSVC figure which overload we need, these cases shouldn't -// come up in practice, but they are generated by the vtkTemplateMacro -inline float sqrt(char x){ return sqrt((float)x); } -inline float sqrt(unsigned char x){ return sqrt((float)x); } -inline float sqrt(int x){ return sqrt((float)x); } -inline float sqrt(unsigned int x){ return sqrt((float)x); } -inline double sqrt(long x){ return sqrt((double)x); } -inline double sqrt(unsigned long x){ return sqrt((double)x); } -inline double sqrt(long long x){ return sqrt((double)x); } -inline double sqrt(unsigned long long x){ return sqrt((double)x); } +#include "SQMacros.h" //***************************************************************************** template @@ -432,7 +423,7 @@ void Magnitude(int *I, T * V, T * mV) const int vi = 3*p; const int vj = vi + 1; const int vk = vi + 2; - mV[p]=sqrt(V[vi]*V[vi]+V[vj]*V[vj]+V[vk]*V[vk]); + mV[p]=::sqrt(V[vi]*V[vi]+V[vj]*V[vj]+V[vk]*V[vk]); } } } @@ -449,7 +440,7 @@ void Magnitude( for (size_t q=0; q comp(V); // get a tuple from the current flat index in the output @@ -1050,6 +1043,8 @@ void ScalarMedianFilter2D( // median W[wi]=V[ids[knij/2]]; } + + free(ids); } //***************************************************************************** @@ -1067,7 +1062,9 @@ void ScalarMedianFilter3D( T * __restrict__ V, T * __restrict__ W) { - unsigned long ids[knijk]; + unsigned long *ids=0; + posix_memalign((void**)ids,16,knijk*sizeof(unsigned long)); + IndirectCompare comp(V); // visit each output element @@ -1102,9 +1099,9 @@ void ScalarMedianFilter3D( // median W[wi]=V[ids[knijk/2]]; } -} - + free(ids); +} //***************************************************************************** @@ -1137,8 +1134,8 @@ void DivergenceFace(int *I, double *dX, T *V, T *mV, T *div) //cerr << "(" << vilo << ", " << vihi << ", " << vjlo << ", " << vjhi << ", " << vklo << ", " << vkhi << ")" << endl; // const double modV=mV[cId]; - // (sqrt(V[vilo]*V[vilo] + V[vjlo]*V[vjlo] + V[vklo]*V[vklo]) - // + sqrt(V[vihi]*V[vihi] + V[vjhi]*V[vjhi] + V[vkhi]*V[vkhi]))/2.0; + // (::sqrt(V[vilo]*V[vilo] + V[vjlo]*V[vjlo] + V[vklo]*V[vklo]) + // + ::sqrt(V[vihi]*V[vihi] + V[vjhi]*V[vjhi] + V[vkhi]*V[vkhi]))/2.0; div[c] =(V[vihi]-V[vilo])/dX[0]/mV[p]; div[c]+=(V[vjhi]-V[vjlo])/dX[1]/mV[p]; @@ -1576,7 +1573,7 @@ void NormalizedHelicity( // -> // |w| - const double modW=sqrt(wx*wx+wy*wy+wz*wz); + const double modW=::sqrt(wx*wx+wy*wy+wz*wz); const int vi=3*idx.Index(i,j,k); const int vj=vi+1; @@ -1585,7 +1582,7 @@ void NormalizedHelicity( // -> // |V| const double modV - = sqrt(V[vi]*V[vi]+V[vj]*V[vj]+V[vk]*V[vk]); + = ::sqrt(V[vi]*V[vi]+V[vj]*V[vj]+V[vk]*V[vk]); const int pi=_idx.Index(_i,_j,_k); @@ -1663,7 +1660,7 @@ void NormalizedHelicity( // -> // |V| const double modV - = sqrt(V[vi]*V[vi]+V[vj]*V[vj]+V[vk]*V[vk]); + = ::sqrt(V[vi]*V[vi]+V[vj]*V[vj]+V[vk]*V[vk]); // __ -> // w = \/ x V @@ -1672,7 +1669,7 @@ void NormalizedHelicity( (V[vkhi ]-V[vklo ])/dx[2]-(V[vihi+2]-V[vilo+2])/dx[0], (V[vihi+1]-V[vilo+1])/dx[0]-(V[vjhi ]-V[vjlo ])/dx[1]}; - const double modW=sqrt(w[0]*w[0]+w[1]*w[1]+w[2]*w[2]); + const double modW=::sqrt(w[0]*w[0]+w[1]*w[1]+w[2]*w[2]); // -> -> -> -> // H_n = ( V . w ) / |V||w| @@ -2902,7 +2899,7 @@ void Normalize( const int _pi=_idx.Index(_i,_j,_k); const int pi= 3*idx.Index( i, j, k); - T mv = sqrt(V[pi]*V[pi]+V[pi+1]*V[pi+1]+V[pi+2]*V[pi+2]); + T mv = ::sqrt(V[pi]*V[pi]+V[pi+1]*V[pi+1]+V[pi+2]*V[pi+2]); W[_pi ] /= mv; W[_pi+1] /= mv; diff --git a/SQMacros.h b/SQMacros.h index d17db56..0253825 100644 --- a/SQMacros.h +++ b/SQMacros.h @@ -32,7 +32,40 @@ using std::cerr; a->Delete();\ } -#define DO_PRAGMA(x) _Pragma(#x) -#define sqTODOMacro(x)\ - DO_PRAGMA(message("TODO - "#x)) +// disbale warning about passing string literals. +#if !defined(__INTEL_COMPILER) && defined(__GNUG__) +#pragma GCC diagnostic ignored "-Wwrite-strings" #endif + +#if defined(WIN32) +// quiet warnings generated by vtk template macro expansion +#pragma warning(disable : 4146) +#pragma warning(disable : 4244) +// quiet warning against posix functions +#pragma warning(disable : 4996) +// quiet warning for cast int to bool +#pragma warning(disable : 4800) + +// help MSVC figure which overload we need, these cases shouldn't +// come up in practice, but they are generated by the vtkTemplateMacro +inline float sqrt(char x){ return sqrt((float)x); } +inline float sqrt(unsigned char x){ return sqrt((float)x); } +inline float sqrt(int x){ return sqrt((float)x); } +inline float sqrt(unsigned int x){ return sqrt((float)x); } +inline double sqrt(long x){ return sqrt((double)x); } +inline double sqrt(unsigned long x){ return sqrt((double)x); } +inline double sqrt(long long x){ return sqrt((double)x); } +inline double sqrt(unsigned long long x){ return sqrt((double)x); } + +// imitate posix_memalign on windows. +#include +static +inline void posix_memalign(void **pData, size_t alignAt, size_t nBytes) +{ + *pData=_aligned_malloc(nBytes,alignAt); +} + +#define __restrict__ __restrict + +#endif +#endif \ No newline at end of file diff --git a/pqSQProcessMonitor.cxx b/pqSQProcessMonitor.cxx index 4e6d8df..63b7184 100644 --- a/pqSQProcessMonitor.cxx +++ b/pqSQProcessMonitor.cxx @@ -710,7 +710,7 @@ void pqSQProcessMonitor::PullServerConfig() HostData *serverHost; - pair ins(serverHostName,0); + pair ins(serverHostName,(HostData*)0); pair::iterator,bool> ret; ret=this->ServerHosts.insert(ins); if (ret.second) diff --git a/vtkSQAgyrotropyFilter.cxx b/vtkSQAgyrotropyFilter.cxx index 756629e..d5e82ef 100644 --- a/vtkSQAgyrotropyFilter.cxx +++ b/vtkSQAgyrotropyFilter.cxx @@ -32,12 +32,14 @@ Copyright 2012 SciberQuest Inc. #include "vtkDoubleArray.h" #include "XMLUtils.h" +#include "SQMacros.h" #include using std::min; using std::max; #include using std::string; +#include #define vtkSQAgyrotropyFilterDEBUG 0 #define vtkSQAgyrotropyFilterTIME 0 @@ -47,6 +49,7 @@ using std::string; #endif + // **************************************************************************** template void agyrotropy(T *pT, T *pV, T *pA, size_t n) @@ -100,7 +103,7 @@ void agyrotropy(T *pT, T *pV, T *pA, size_t n) d*=-1.0; } - pA[i] = 2*sqrt(d)/a; + pA[i] = 2*::sqrt(d)/a; pV+=3; pT+=9; @@ -261,4 +264,4 @@ int vtkSQAgyrotropyFilter::RequestData( void vtkSQAgyrotropyFilter::PrintSelf(ostream& os, vtkIndent indent) { this->Superclass::PrintSelf(os,indent); -} +} \ No newline at end of file diff --git a/vtkSQBOVReader.cxx b/vtkSQBOVReader.cxx index 973d99f..e3981ba 100644 --- a/vtkSQBOVReader.cxx +++ b/vtkSQBOVReader.cxx @@ -50,7 +50,7 @@ using std::max; using std::ostringstream; // #define vtkSQBOVReaderDEBUG -#define vtkSQBOVReaderTIME +// #define vtkSQBOVReaderTIME #ifdef WIN32 // for gethostname on windows. diff --git a/vtkSQBOVWriter.cxx b/vtkSQBOVWriter.cxx index 44d91c5..8a63727 100644 --- a/vtkSQBOVWriter.cxx +++ b/vtkSQBOVWriter.cxx @@ -47,8 +47,8 @@ using std::max; #include using std::ostringstream; -//#define vtkSQBOVWriterDEBUG -#define vtkSQBOVWriterTIME +// #define vtkSQBOVWriterDEBUG +// #define vtkSQBOVWriterTIME #ifdef WIN32 // for gethostname on windows. diff --git a/vtkSQHemisphereSource.cxx b/vtkSQHemisphereSource.cxx index 21f0de3..e330348 100644 --- a/vtkSQHemisphereSource.cxx +++ b/vtkSQHemisphereSource.cxx @@ -40,7 +40,7 @@ Copyright 2012 SciberQuest Inc. #include -#define vtkSQHemisphereSourceTIME +// #define vtkSQHemisphereSourceTIME //***************************************************************************** void LocateHemisphere(float *pX, size_t nx,double *C, double *N) diff --git a/vtkSQImageGhosts.cxx b/vtkSQImageGhosts.cxx index d798b2c..aa028a9 100644 --- a/vtkSQImageGhosts.cxx +++ b/vtkSQImageGhosts.cxx @@ -34,7 +34,7 @@ typedef vtkStreamingDemandDrivenPipeline vtkSDDPipeline; using vtkstd::string; // #define vtkSQImageGhostsDEBUG -#define vtkSQImageGhostsTIME +// #define vtkSQImageGhostsTIME #if defined vtkSQImageGhostsTIME #include "vtkSQLog.h" diff --git a/vtkSQImageSource.cxx b/vtkSQImageSource.cxx index baaf112..79b0442 100644 --- a/vtkSQImageSource.cxx +++ b/vtkSQImageSource.cxx @@ -29,7 +29,7 @@ typedef vtkStreamingDemandDrivenPipeline vtkSDDPipeline; using vtkstd::string; // #define vtkSQImageSourceDEBUG -#define vtkSQImageSourceTIME +// #define vtkSQImageSourceTIME #if defined vtkSQImageSourceTIME #include "vtkSQLog.h" diff --git a/vtkSQKernelConvolution.cxx b/vtkSQKernelConvolution.cxx index be8fd68..7de9cee 100644 --- a/vtkSQKernelConvolution.cxx +++ b/vtkSQKernelConvolution.cxx @@ -9,8 +9,8 @@ Copyright 2012 SciberQuest Inc. */ #include "vtkSQKernelConvolution.h" -//#define vtkSQKernelConvolutionDEBUG -#define vtkSQKernelConvolutionTIME +// #define vtkSQKernelConvolutionDEBUG +// #define vtkSQKernelConvolutionTIME #if defined vtkSQKernelConvolutionTIME #include "vtkSQLog.h" diff --git a/vtkSQLog.cxx b/vtkSQLog.cxx index 163225a..9c0114d 100644 --- a/vtkSQLog.cxx +++ b/vtkSQLog.cxx @@ -6,7 +6,6 @@ Copyright 2012 SciberQuest Inc. */ - #include "vtkSQLog.h" #include "SQMacros.h" @@ -15,8 +14,33 @@ Copyright 2012 SciberQuest Inc. #include "vtkObjectFactory.h" #include +#if !defined(WIN32) #include #include +#else +#include +#include +#include +int gettimeofday(struct timeval *tv, void *) +{ + FILETIME ft; + GetSystemTimeAsFileTime(&ft); + + __int64 tmpres = 0; + tmpres = ft.dwHighDateTime; + tmpres <<= 32; + tmpres |= ft.dwLowDateTime; + + /*converting file time to unix epoch*/ + const __int64 DELTA_EPOCH_IN_MICROSECS= 11644473600000000; + tmpres /= 10; /*convert into microseconds*/ + tmpres -= DELTA_EPOCH_IN_MICROSECS; + tv->tv_sec = (__int32)(tmpres*0.000001); + tv->tv_usec =(tmpres%1000000); + + return 0; +} +#endif #include using std::ofstream; diff --git a/vtkSQLog.h b/vtkSQLog.h index 7cc14d0..bba1b11 100644 --- a/vtkSQLog.h +++ b/vtkSQLog.h @@ -32,6 +32,7 @@ using std::ostringstream; class vtkSQLog; class LogBuffer; +//BTX //============================================================================= class vtkSQLogDestructor { @@ -44,6 +45,7 @@ class vtkSQLogDestructor private: vtkSQLog *Log; }; +//ETX //============================================================================= class vtkSQLog : public vtkObject @@ -79,10 +81,12 @@ class vtkSQLog : public vtkObject void EndEventSynch(const char *event); void EndEventSynch(int rank, const char *event); + //BTX // Description: // Insert text into the log header on the writer rank. template vtkSQLog &operator<<(const T& s); + //ETX // Description: // Clear the log. @@ -141,6 +145,7 @@ class vtkSQLog : public vtkObject ostringstream Header; }; +//BTX //----------------------------------------------------------------------------- template vtkSQLog &vtkSQLog::operator<<(const T& s) @@ -151,6 +156,6 @@ vtkSQLog &vtkSQLog::operator<<(const T& s) } return *this; } +//ETX #endif - diff --git a/vtkSQMedianFilter.cxx b/vtkSQMedianFilter.cxx index 35ecf2e..17557ae 100644 --- a/vtkSQMedianFilter.cxx +++ b/vtkSQMedianFilter.cxx @@ -5,12 +5,11 @@ /___/\__/_/_.__/\__/_/ \___\_\_,_/\__/___/\__/ /___/_//_/\__(_) Copyright 2012 SciberQuest Inc. - */ #include "vtkSQMedianFilter.h" -//#define vtkSQMedianFilterDEBUG -#define vtkSQMedianFilterTIME +// #define vtkSQMedianFilterDEBUG +// #define vtkSQMedianFilterTIME #if defined vtkSQMedianFilterTIME #include "vtkSQLog.h" @@ -41,12 +40,7 @@ Copyright 2012 SciberQuest Inc. #include "vtkPointData.h" #include "vtkCellData.h" -#ifdef WIN32 - #include -#else - #include -#endif - +#include #include using vtkstd::string; #include diff --git a/vtkSQVolumeSource.cxx b/vtkSQVolumeSource.cxx index f39557f..a14cda8 100644 --- a/vtkSQVolumeSource.cxx +++ b/vtkSQVolumeSource.cxx @@ -50,7 +50,7 @@ typedef pair::iterator,bool> MapInsert; typedef pair MapElement; // #define vtkSQVolumeSourceDEBUG -#define vtkSQVolumeSourceTIME +// #define vtkSQVolumeSourceTIME vtkCxxRevisionMacro(vtkSQVolumeSource, "$Revision: 0.0 $"); vtkStandardNewMacro(vtkSQVolumeSource); diff --git a/vtkSQVortexFilter.cxx b/vtkSQVortexFilter.cxx index e4960b6..e4a203f 100644 --- a/vtkSQVortexFilter.cxx +++ b/vtkSQVortexFilter.cxx @@ -35,8 +35,8 @@ using vtkstd::pair; #include "Numerics.hxx" -//#define vtkSQVortexFilterDEBUG -#define vtkSQVortexFilterTIME +// #define vtkSQVortexFilterDEBUG +// #define vtkSQVortexFilterTIME #ifdef WIN32 #undef vtkSQVortexFilterDEBUG