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());
270 static void Unlock();
277 static void SetNewWisdomAvailable(
const bool & v )
279 GetInstance()->m_NewWisdomAvailable = v;
281 static bool GetNewWisdomAvailable()
283 return GetInstance()->m_NewWisdomAvailable;
295 static void SetPlanRigor(
const int & v )
298 GetPlanRigorName( v );
299 GetInstance()->m_PlanRigor = v;
303 static int GetPlanRigor()
305 return GetInstance()->m_PlanRigor;
307 static void SetPlanRigor(
const std::string & name )
309 SetPlanRigor( GetPlanRigorValue( name ) );
313 static int GetPlanRigorValue(
const std::string & name );
316 static std::string GetPlanRigorName(
const int & value );
325 static void SetReadWisdomCache(
const bool & v )
327 GetInstance()->m_ReadWisdomCache = v;
330 static bool GetReadWisdomCache()
332 return GetInstance()->m_ReadWisdomCache;
342 static void SetWriteWisdomCache(
const bool & v )
344 GetInstance()->m_WriteWisdomCache = v;
347 static bool GetWriteWisdomCache()
349 return GetInstance()->m_WriteWisdomCache;
359 static void SetWisdomCacheBase(
const std::string & v )
361 GetInstance()->m_WisdomCacheBase = v;
364 static std::string GetWisdomCacheBase()
366 return GetInstance()->m_WisdomCacheBase;
396 static std::string GetWisdomFileDefaultBaseName();
399 static bool ImportWisdomFileDouble(
const std::string &fname );
400 static bool ExportWisdomFileDouble(
const std::string &fname );
404 static bool ImportWisdomFileFloat(
const std::string &fname );
405 static bool ExportWisdomFileFloat(
const std::string &fname );
409 static bool ImportDefaultWisdomFileDouble();
410 static bool ExportDefaultWisdomFileDouble();
414 static bool ImportDefaultWisdomFileFloat();
415 static bool ExportDefaultWisdomFileFloat();
423 static Pointer GetInstance();
429 itkFactorylessNewMacro(Self);
432 void operator=(
const Self &);