18 #ifndef __itkFFTWGlobalConfiguration_h
19 #define __itkFFTWGlobalConfiguration_h
24 #if defined(USE_FFTWF) || defined(USE_FFTWD)
28 #include "itksys/SystemTools.hxx"
29 #include "itksys/SystemInformation.hxx"
63 #define FFTWPathSep "\\"
65 #define FFTWPathSep "/"
72 virtual std::string GenerateWisdomFilename(
const std::string baseCacheDirectory)
const = 0;
82 void SetWisdomFilename(
const std::string wfn)
84 this->m_WisdomFilename=wfn;
86 virtual std::string GenerateWisdomFilename(
const std::string itkNotUsed(baseCacheDirectory) )
const
88 return this->m_WisdomFilename;
97 virtual std::string GenerateWisdomFilename(
const std::string baseCacheDirectory)
const
99 return baseCacheDirectory+
FFTWPathSep+
".itksimple.wisdom";
106 virtual std::string GenerateWisdomFilename(
const std::string baseCacheDirectory)
const
109 itksys::SystemInformation hostInfo;
110 hostInfo.RunOSCheck();
111 return baseCacheDirectory+
FFTWPathSep +
".itkwisdomfftw"+
FFTWPathSep+
".itk_"+hostInfo.GetHostname()+
".wisdom";
120 m_UseOSRelease(false),
121 m_UseOSVersion(false),
122 m_UseOSPlatform(true),
123 m_UseOSBitSize(true),
124 m_UseNumberOfProcessors(true),
125 m_UseVendorString(true),
126 m_UseVendorID(false),
130 m_UseSteppingCode(true)
133 virtual std::string GenerateWisdomFilename(
const std::string baseCacheDirectory)
const
136 itksys::SystemInformation hardwareInfo;
137 hardwareInfo.RunCPUCheck();
138 hardwareInfo.RunOSCheck();
139 hardwareInfo.RunMemoryCheck();
140 std::stringstream OSD(
"");
142 if( this->m_UseOSName )
144 OSD << hardwareInfo.GetOSName() <<
"_";
146 if( this->m_UseOSRelease )
148 OSD << hardwareInfo.GetOSRelease() <<
"_";
150 if( this->m_UseOSVersion )
152 OSD << hardwareInfo.GetOSVersion() <<
"_";
154 if( this->m_UseOSPlatform )
156 OSD << hardwareInfo.GetOSPlatform() <<
"_";
158 if( this->m_UseOSBitSize )
160 const char *
const bitsizeString=( hardwareInfo.Is64Bits() ) ?
"64_":
"32_";
161 OSD << bitsizeString;
163 if( this->m_UseNumberOfProcessors )
165 OSD << hardwareInfo.GetNumberOfLogicalCPU() <<
"x"<< hardwareInfo.GetNumberOfPhysicalCPU() <<
"_";
167 if( this->m_UseVendorString )
169 OSD << hardwareInfo.GetVendorString() <<
"_";
171 if( this->m_UseVendorID )
173 OSD << hardwareInfo.GetVendorID() <<
"_";
175 if( this->m_UseTypeID )
177 OSD << hardwareInfo.GetTypeID() <<
"_";
179 if( this->m_UseFamilyID )
181 OSD << hardwareInfo.GetFamilyID() <<
"_";
183 if( this->m_UseModelID )
185 OSD << hardwareInfo.GetModelID() <<
"_";
187 if( this->m_UseSteppingCode )
189 OSD << hardwareInfo.GetSteppingCode();
192 std::string noSpaceStr=OSD.str();
194 noSpaceStr.erase(std::remove_if(noSpaceStr.begin(), noSpaceStr.end(),::isspace), noSpaceStr.end());
271 return GetInstance()->m_Lock;
278 static void SetNewWisdomAvailable(
const bool & v )
280 GetInstance()->m_NewWisdomAvailable = v;
282 static bool GetNewWisdomAvailable()
284 return GetInstance()->m_NewWisdomAvailable;
296 static void SetPlanRigor(
const int & v )
299 GetPlanRigorName( v );
300 GetInstance()->m_PlanRigor = v;
304 static int GetPlanRigor()
306 return GetInstance()->m_PlanRigor;
308 static void SetPlanRigor(
const std::string & name )
310 SetPlanRigor( GetPlanRigorValue( name ) );
314 static int GetPlanRigorValue(
const std::string & name );
317 static std::string GetPlanRigorName(
const int & value );
326 static void SetReadWisdomCache(
const bool & v )
328 GetInstance()->m_ReadWisdomCache = v;
331 static bool GetReadWisdomCache()
333 return GetInstance()->m_ReadWisdomCache;
343 static void SetWriteWisdomCache(
const bool & v )
345 GetInstance()->m_WriteWisdomCache = v;
348 static bool GetWriteWisdomCache()
350 return GetInstance()->m_WriteWisdomCache;
360 static void SetWisdomCacheBase(
const std::string & v )
362 GetInstance()->m_WisdomCacheBase = v;
365 static std::string GetWisdomCacheBase()
367 return GetInstance()->m_WisdomCacheBase;
397 static std::string GetWisdomFileDefaultBaseName();
400 static bool ImportWisdomFileDouble(
const std::string &fname );
401 static bool ExportWisdomFileDouble(
const std::string &fname );
405 static bool ImportWisdomFileFloat(
const std::string &fname );
406 static bool ExportWisdomFileFloat(
const std::string &fname );
410 static bool ImportDefaultWisdomFileDouble();
411 static bool ExportDefaultWisdomFileDouble();
415 static bool ImportDefaultWisdomFileFloat();
416 static bool ExportDefaultWisdomFileFloat();
424 static Pointer GetInstance();
430 itkFactorylessNewMacro(Self);
433 void operator=(
const Self &);