https://mooseframework.inl.gov
Functions
AbaqusUtils.C File Reference

Go to the source code of this file.

Functions

void getnumcpus_ (int *num)
 
void getrank_ (int *rank)
 
MPI_Comm get_communicator ()
 
int getnumthreads_ ()
 
int get_thread_id_ ()
 
void getoutdir_ (char *dir, int *len)
 
void getjobname_ (char *dir, int *len)
 
void stdb_abqerr_ (int *lop, char *format, int *intv, double *realv, char *charv, int format_len)
 
intSMAIntArrayCreate (int id, int len, int val)
 
double * SMAFloatArrayCreate (int id, int len, Real val)
 
intSMALocalIntArrayCreate (int id, int len, int val)
 
double * SMALocalFloatArrayCreate (int id, int len, Real val)
 
intSMAIntArrayAccess (int id)
 
double * SMAFloatArrayAccess (int id)
 
intSMALocalIntArrayAccess (int id)
 
double * SMALocalFloatArrayAccess (int id)
 
std::size_t SMAIntArraySize (int id)
 
std::size_t SMAFloatArraySize (int id)
 
std::size_t SMALocalIntArraySize (int id)
 
std::size_t SMALocalFloatArraySize (int id)
 
void SMAIntArrayDelete (int id)
 
void SMAFloatArrayDelete (int id)
 
void SMALocalIntArrayDelete (int id)
 
void SMALocalFloatArrayDelete (int id)
 
void MutexInit (int id)
 
void MutexLock (int id)
 
void MutexUnlock (int id)
 

Function Documentation

◆ get_communicator()

MPI_Comm get_communicator ( )

Definition at line 43 of file AbaqusUtils.C.

44 {
46  return communicator->get();
47 }
static const libMesh::Parallel::Communicator * getCommunicator()
Definition: AbaqusUtils.h:35
DIE A HORRIBLE DEATH HERE typedef MPI_Comm communicator

◆ get_thread_id_()

int get_thread_id_ ( )

Definition at line 58 of file AbaqusUtils.C.

Referenced by uexternaldb_().

59 {
60  ParallelUniqueId puid;
61  return puid.id;
62 }

◆ getjobname_()

void getjobname_ ( char *  dir,
int len 
)

Definition at line 104 of file AbaqusUtils.C.

105 {
106  auto job_name = AbaqusUtils::getJobName();
107  *len = job_name.length();
108  for (int i = 0; i < 256; ++i)
109  dir[i] = i < *len ? job_name[i] : ' ';
110 }
static std::string getJobName()
Definition: AbaqusUtils.h:28

◆ getnumcpus_()

void getnumcpus_ ( int num)

Definition at line 29 of file AbaqusUtils.C.

30 {
32  *num = communicator->size();
33 }
static const libMesh::Parallel::Communicator * getCommunicator()
Definition: AbaqusUtils.h:35
DIE A HORRIBLE DEATH HERE typedef MPI_Comm communicator

◆ getnumthreads_()

int getnumthreads_ ( )

Definition at line 52 of file AbaqusUtils.C.

Referenced by AbaqusUtils::smaInitialize(), and uexternaldb_().

53 {
54  return libMesh::n_threads();
55 }
unsigned int n_threads()

◆ getoutdir_()

void getoutdir_ ( char *  dir,
int len 
)

Definition at line 95 of file AbaqusUtils.C.

96 {
97  auto output_dir = AbaqusUtils::getOutputDir();
98  *len = output_dir.length();
99  for (int i = 0; i < 256; ++i)
100  dir[i] = i < *len ? output_dir[i] : ' ';
101 }
static std::string getOutputDir()
Definition: AbaqusUtils.h:27

◆ getrank_()

void getrank_ ( int rank)

Definition at line 36 of file AbaqusUtils.C.

37 {
39  *rank = communicator->rank();
40 }
static const libMesh::Parallel::Communicator * getCommunicator()
Definition: AbaqusUtils.h:35
DIE A HORRIBLE DEATH HERE typedef MPI_Comm communicator

◆ MutexInit()

void MutexInit ( int  id)

Definition at line 386 of file AbaqusUtils.C.

Referenced by uexternaldb_().

387 {
389 }
static void mutexInit(std::size_t n)
Mutex API.
Definition: AbaqusUtils.C:358

◆ MutexLock()

void MutexLock ( int  id)

Definition at line 392 of file AbaqusUtils.C.

Referenced by uexternaldb_().

393 {
395 }
static void mutexLock(std::size_t n)
Definition: AbaqusUtils.C:370

◆ MutexUnlock()

void MutexUnlock ( int  id)

Definition at line 398 of file AbaqusUtils.C.

Referenced by uexternaldb_().

399 {
401 }
static void mutexUnlock(std::size_t n)
Definition: AbaqusUtils.C:378

◆ SMAFloatArrayAccess()

double* SMAFloatArrayAccess ( int  id)

Definition at line 261 of file AbaqusUtils.C.

Referenced by uexternaldb_().

262 {
263  auto it = AbaqusUtils::getSMAIterator(AbaqusUtils::_sma_float_array, id, "SMAFloatArrayAccess");
264  return it->second.data();
265 }
static std::map< int, std::vector< T > >::iterator getSMAIterator(std::map< int, std::vector< T >> &array, int id, const std::string &function)
get data vector iterator with error checking
Definition: AbaqusUtils.h:72
static std::map< int, std::vector< Real > > _sma_float_array
Definition: AbaqusUtils.h:53

◆ SMAFloatArrayCreate()

double* SMAFloatArrayCreate ( int  id,
int  len,
Real  val 
)

Definition at line 223 of file AbaqusUtils.C.

224 {
225  auto ib = AbaqusUtils::_sma_float_array.emplace(id, std::vector<Real>(len, val));
226  if (ib.second == false)
227  mooseError("Error creating threaded storage in SMAFloatArrayCreate");
228  return ib.first->second.data();
229 }
void mooseError(Args &&... args)
static std::map< int, std::vector< Real > > _sma_float_array
Definition: AbaqusUtils.h:53

◆ SMAFloatArrayDelete()

void SMAFloatArrayDelete ( int  id)

Definition at line 329 of file AbaqusUtils.C.

Referenced by uexternaldb_().

330 {
331  auto it = AbaqusUtils::getSMAIterator(AbaqusUtils::_sma_float_array, id, "SMAFloatArrayDelete");
333 }
static std::map< int, std::vector< T > >::iterator getSMAIterator(std::map< int, std::vector< T >> &array, int id, const std::string &function)
get data vector iterator with error checking
Definition: AbaqusUtils.h:72
static std::map< int, std::vector< Real > > _sma_float_array
Definition: AbaqusUtils.h:53

◆ SMAFloatArraySize()

std::size_t SMAFloatArraySize ( int  id)

Definition at line 295 of file AbaqusUtils.C.

Referenced by uexternaldb_().

296 {
297  auto it = AbaqusUtils::getSMAIterator(AbaqusUtils::_sma_float_array, id, "SMAFloatArraySize");
298  return it->second.size();
299 }
static std::map< int, std::vector< T > >::iterator getSMAIterator(std::map< int, std::vector< T >> &array, int id, const std::string &function)
get data vector iterator with error checking
Definition: AbaqusUtils.h:72
static std::map< int, std::vector< Real > > _sma_float_array
Definition: AbaqusUtils.h:53

◆ SMAIntArrayAccess()

int* SMAIntArrayAccess ( int  id)

Definition at line 254 of file AbaqusUtils.C.

Referenced by uexternaldb_().

255 {
256  auto it = AbaqusUtils::getSMAIterator(AbaqusUtils::_sma_int_array, id, "SMAIntArrayAccess");
257  return it->second.data();
258 }
static std::map< int, std::vector< T > >::iterator getSMAIterator(std::map< int, std::vector< T >> &array, int id, const std::string &function)
get data vector iterator with error checking
Definition: AbaqusUtils.h:72
static std::map< int, std::vector< int > > _sma_int_array
Shared Memory Arrays.
Definition: AbaqusUtils.h:52

◆ SMAIntArrayCreate()

int* SMAIntArrayCreate ( int  id,
int  len,
int  val 
)

Definition at line 214 of file AbaqusUtils.C.

Referenced by uexternaldb_().

215 {
216  auto ib = AbaqusUtils::_sma_int_array.emplace(id, std::vector<int>(len, val));
217  if (ib.second == false)
218  mooseError("Error creating threaded storage in SMAIntArrayCreate");
219  return ib.first->second.data();
220 }
void mooseError(Args &&... args)
static std::map< int, std::vector< int > > _sma_int_array
Shared Memory Arrays.
Definition: AbaqusUtils.h:52

◆ SMAIntArrayDelete()

void SMAIntArrayDelete ( int  id)

Definition at line 322 of file AbaqusUtils.C.

Referenced by uexternaldb_().

323 {
324  auto it = AbaqusUtils::getSMAIterator(AbaqusUtils::_sma_int_array, id, "SMAIntArrayDelete");
325  AbaqusUtils::_sma_int_array.erase(it);
326 }
static std::map< int, std::vector< T > >::iterator getSMAIterator(std::map< int, std::vector< T >> &array, int id, const std::string &function)
get data vector iterator with error checking
Definition: AbaqusUtils.h:72
static std::map< int, std::vector< int > > _sma_int_array
Shared Memory Arrays.
Definition: AbaqusUtils.h:52

◆ SMAIntArraySize()

std::size_t SMAIntArraySize ( int  id)

Definition at line 288 of file AbaqusUtils.C.

Referenced by uexternaldb_().

289 {
290  auto it = AbaqusUtils::getSMAIterator(AbaqusUtils::_sma_int_array, id, "SMAIntArraySize");
291  return it->second.size();
292 }
static std::map< int, std::vector< T > >::iterator getSMAIterator(std::map< int, std::vector< T >> &array, int id, const std::string &function)
get data vector iterator with error checking
Definition: AbaqusUtils.h:72
static std::map< int, std::vector< int > > _sma_int_array
Shared Memory Arrays.
Definition: AbaqusUtils.h:52

◆ SMALocalFloatArrayAccess()

double* SMALocalFloatArrayAccess ( int  id)

Definition at line 277 of file AbaqusUtils.C.

Referenced by uexternaldb_().

278 {
280  "SMALocalFloatArrayAccess");
281  auto it = AbaqusUtils::getSMAIterator(array, id, "SMALocalFloatArrayAccess");
282  return it->second.data();
283 }
static std::map< int, std::vector< T > >::iterator getSMAIterator(std::map< int, std::vector< T >> &array, int id, const std::string &function)
get data vector iterator with error checking
Definition: AbaqusUtils.h:72
static std::vector< std::map< int, std::vector< Real > > > _sma_local_float_array
Definition: AbaqusUtils.h:55
static std::map< int, std::vector< T > > & getSMAThreadArray(std::vector< std::map< int, std::vector< T >>> &local_array, const std::string &function)
get thread local array
Definition: AbaqusUtils.h:84

◆ SMALocalFloatArrayCreate()

double* SMALocalFloatArrayCreate ( int  id,
int  len,
Real  val 
)

Definition at line 242 of file AbaqusUtils.C.

243 {
246  "SMALocalFloatArrayCreate")[id];
247  array.assign(len, val);
248  return array.data();
249 }
static void smaInitialize()
thread storage initialization
Definition: AbaqusUtils.C:188
static std::vector< std::map< int, std::vector< Real > > > _sma_local_float_array
Definition: AbaqusUtils.h:55
static std::map< int, std::vector< T > > & getSMAThreadArray(std::vector< std::map< int, std::vector< T >>> &local_array, const std::string &function)
get thread local array
Definition: AbaqusUtils.h:84

◆ SMALocalFloatArrayDelete()

void SMALocalFloatArrayDelete ( int  id)

Definition at line 345 of file AbaqusUtils.C.

Referenced by uexternaldb_().

346 {
348  "SMALocalFloatArrayDelete");
349  auto it = AbaqusUtils::getSMAIterator(array, id, "SMALocalFloatArrayDelete");
350  array.erase(it);
351 }
static std::map< int, std::vector< T > >::iterator getSMAIterator(std::map< int, std::vector< T >> &array, int id, const std::string &function)
get data vector iterator with error checking
Definition: AbaqusUtils.h:72
static std::vector< std::map< int, std::vector< Real > > > _sma_local_float_array
Definition: AbaqusUtils.h:55
static std::map< int, std::vector< T > > & getSMAThreadArray(std::vector< std::map< int, std::vector< T >>> &local_array, const std::string &function)
get thread local array
Definition: AbaqusUtils.h:84

◆ SMALocalFloatArraySize()

std::size_t SMALocalFloatArraySize ( int  id)

Definition at line 311 of file AbaqusUtils.C.

Referenced by uexternaldb_().

312 {
313  auto & array =
315  auto it = AbaqusUtils::getSMAIterator(array, id, "SMALocalFloatArraySize");
316  return it->second.size();
317 }
static std::map< int, std::vector< T > >::iterator getSMAIterator(std::map< int, std::vector< T >> &array, int id, const std::string &function)
get data vector iterator with error checking
Definition: AbaqusUtils.h:72
static std::vector< std::map< int, std::vector< Real > > > _sma_local_float_array
Definition: AbaqusUtils.h:55
static std::map< int, std::vector< T > > & getSMAThreadArray(std::vector< std::map< int, std::vector< T >>> &local_array, const std::string &function)
get thread local array
Definition: AbaqusUtils.h:84

◆ SMALocalIntArrayAccess()

int* SMALocalIntArrayAccess ( int  id)

Definition at line 268 of file AbaqusUtils.C.

Referenced by uexternaldb_().

269 {
270  auto & array =
272  auto it = AbaqusUtils::getSMAIterator(array, id, "SMALocalIntArrayAccess");
273  return it->second.data();
274 }
static std::map< int, std::vector< T > >::iterator getSMAIterator(std::map< int, std::vector< T >> &array, int id, const std::string &function)
get data vector iterator with error checking
Definition: AbaqusUtils.h:72
static std::vector< std::map< int, std::vector< int > > > _sma_local_int_array
Definition: AbaqusUtils.h:54
static std::map< int, std::vector< T > > & getSMAThreadArray(std::vector< std::map< int, std::vector< T >>> &local_array, const std::string &function)
get thread local array
Definition: AbaqusUtils.h:84

◆ SMALocalIntArrayCreate()

int* SMALocalIntArrayCreate ( int  id,
int  len,
int  val 
)

Definition at line 232 of file AbaqusUtils.C.

Referenced by uexternaldb_().

233 {
236  "SMALocalIntArrayCreate")[id];
237  array.assign(len, val);
238  return array.data();
239 }
static void smaInitialize()
thread storage initialization
Definition: AbaqusUtils.C:188
static std::vector< std::map< int, std::vector< int > > > _sma_local_int_array
Definition: AbaqusUtils.h:54
static std::map< int, std::vector< T > > & getSMAThreadArray(std::vector< std::map< int, std::vector< T >>> &local_array, const std::string &function)
get thread local array
Definition: AbaqusUtils.h:84

◆ SMALocalIntArrayDelete()

void SMALocalIntArrayDelete ( int  id)

Definition at line 336 of file AbaqusUtils.C.

Referenced by uexternaldb_().

337 {
338  auto & array =
340  auto it = AbaqusUtils::getSMAIterator(array, id, "SMALocalIntArrayDelete");
341  array.erase(it);
342 }
static std::map< int, std::vector< T > >::iterator getSMAIterator(std::map< int, std::vector< T >> &array, int id, const std::string &function)
get data vector iterator with error checking
Definition: AbaqusUtils.h:72
static std::vector< std::map< int, std::vector< int > > > _sma_local_int_array
Definition: AbaqusUtils.h:54
static std::map< int, std::vector< T > > & getSMAThreadArray(std::vector< std::map< int, std::vector< T >>> &local_array, const std::string &function)
get thread local array
Definition: AbaqusUtils.h:84

◆ SMALocalIntArraySize()

std::size_t SMALocalIntArraySize ( int  id)

Definition at line 302 of file AbaqusUtils.C.

Referenced by uexternaldb_().

303 {
304  auto & array =
306  auto it = AbaqusUtils::getSMAIterator(array, id, "SMALocalIntArraySize");
307  return it->second.size();
308 }
static std::map< int, std::vector< T > >::iterator getSMAIterator(std::map< int, std::vector< T >> &array, int id, const std::string &function)
get data vector iterator with error checking
Definition: AbaqusUtils.h:72
static std::vector< std::map< int, std::vector< int > > > _sma_local_int_array
Definition: AbaqusUtils.h:54
static std::map< int, std::vector< T > > & getSMAThreadArray(std::vector< std::map< int, std::vector< T >>> &local_array, const std::string &function)
get thread local array
Definition: AbaqusUtils.h:84

◆ stdb_abqerr_()

void stdb_abqerr_ ( int lop,
char *  format,
int intv,
double *  realv,
char *  charv,
int  format_len 
)

Definition at line 115 of file AbaqusUtils.C.

116 {
117  std::string message;
118  unsigned int int_index = 0;
119  unsigned int real_index = 0;
120  unsigned int char_index = 0;
121 
122  for (int i = 0; i < format_len; ++i)
123  {
124  // interpret %I, %R, and %S
125  if (format[i] == '%' && i < format_len - 1)
126  {
127  auto next = format[i + 1];
128 
129  // integer output
130  if (next == 'I' || next == 'i')
131  {
132  message += std::to_string(intv[int_index++]);
133  i++;
134  continue;
135  }
136 
137  // Real output
138  if (next == 'R' || next == 'r')
139  {
140  message += std::to_string(realv[real_index++]);
141  i++;
142  continue;
143  }
144 
145  // char[8] output
146  if (next == 'S' || next == 's')
147  {
148  for (unsigned int j = 0; j < 8; ++j)
149  message += charv[char_index++];
150  i++;
151  continue;
152  }
153  }
154 
155  // append character to string
156  message += format[i];
157  }
158 
159  // output at the selected error level
160  switch (*lop)
161  {
162  case 1:
163  Moose::out << moose::internal::mooseMsgFmt(message, "** Abaqus Info **", COLOR_CYAN)
164  << std::flush;
165  break;
166 
167  case -1:
168  Moose::out << moose::internal::mooseMsgFmt(message, "** Abaqus Warning **", COLOR_YELLOW)
169  << std::flush;
170  break;
171 
172  case -2:
173  Moose::out << moose::internal::mooseMsgFmt(message, "** Abaqus Non-fatal Error **", COLOR_RED)
174  << std::flush;
175  break;
176 
177  case -3:
179  break;
180 
181  default:
182  mooseError("Invalid LOP code passed to STDB_ABQERR: ", *lop);
183  break;
184  }
185 }
void mooseError(Args &&... args)
static const std::string message
static const std::complex< double > j(0, 1)
Complex number "j" (also known as "i")
std::string mooseMsgFmt(const std::string &msg, const std::string &title, const std::string &color)