MCPcopy Create free account
hub / github.com/AcademySoftwareFoundation/openvdb / initialize

Function initialize

openvdb/openvdb/openvdb.cc:65–112  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

63template <typename MapT> struct RegisterMap { inline void operator()() { MapT::registerMap(); } };
64
65void
66initialize()
67{
68 if (sIsInitialized.load(std::memory_order_acquire)) return;
69 std::lock_guard<std::mutex> lock(GetInitMutex());
70 if (sIsInitialized.load(std::memory_order_acquire)) return; // Double-checked lock
71
72 logging::initialize();
73
74 // Register metadata.
75 Metadata::clearRegistry();
76 MetaTypes::foreach<RegisterMeta>();
77
78 // Register maps
79 math::MapRegistry::clear();
80 MapTypes::foreach<RegisterMap>();
81
82 // Register common grid types.
83 GridBase::clearRegistry();
84 GridTypes::foreach<RegisterGrid>();
85
86 // Register types associated with point index grids.
87 Metadata::registerType(typeNameAsString<PointIndex32>(), Int32Metadata::createMetadata);
88 Metadata::registerType(typeNameAsString<PointIndex64>(), Int64Metadata::createMetadata);
89
90 // Register types associated with point data grids.
91 points::internal::initialize();
92
93#ifdef OPENVDB_USE_BLOSC
94 blosc_init();
95 if (blosc_set_compressor("lz4") < 0) {
96 OPENVDB_LOG_WARN("Blosc LZ4 compressor is unavailable");
97 }
98 /// @todo blosc_set_nthreads(int nthreads);
99#endif
100
101#ifdef __ICC
102// Disable ICC "assignment to statically allocated variable" warning.
103// This assignment is mutex-protected and therefore thread-safe.
104__pragma(warning(disable:1711))
105#endif
106
107 sIsInitialized.store(true, std::memory_order_release);
108
109#ifdef __ICC
110__pragma(warning(default:1711))
111#endif
112}
113
114
115void

Callers 7

SetUpMethod · 0.50
mainFunction · 0.50
mainFunction · 0.50
runOpenVDBFunction · 0.50
mainFunction · 0.50
mainFunction · 0.50
mainFunction · 0.50

Calls 3

clearFunction · 0.50
registerTypeFunction · 0.50
loadMethod · 0.45

Tested by 1

SetUpMethod · 0.40