36#ifndef G4GEOMSPLITTER_HH
37#define G4GEOMSPLITTER_HH
49 : totalobj(0), totalspace(0), sharedOffset(nullptr)
57 return (T *) std::realloc(
offset, totalspace *
sizeof(T));
66 if (totalobj > totalspace)
76 return (totalobj - 1);
82 std::memcpy(
offset, sharedOffset, totalspace *
sizeof(T));
90 if (
offset !=
nullptr) {
return; }
94 G4Exception(
"G4GeomSplitter::SlaveCopySubInstanceArray()",
107 if (
offset !=
nullptr) {
return; }
112 G4Exception(
"G4GeomSplitter::SlaveInitializeSubInstance()",
116 for (
G4int i=0 ; i<totalspace; ++i)
131 G4Exception(
"G4GeomSPlitter::SlaveReCopySubInstance()",
133 "Must be called after Initialisation or first Copy.");
141 if (
offset ==
nullptr) {
return; }
157 "Thread already has workspace - cannot use another.");
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
#define G4MUTEXINIT(mutex)
void SlaveReCopySubInstanceArray()
void SlaveInitializeSubInstance()
static G4GEOM_DLL G4ThreadLocal T * offset
G4int CreateSubInstance()
void SlaveCopySubInstanceArray()
T * Reallocate(G4int size)
void CopyMasterContents()
void UseWorkArea(T *newOffset)