https://mooseframework.inl.gov
mutex_test.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://mooseframework.inl.gov
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
10 /***************************************************************************************
11 ** UMAT, FOR ABAQUS/STANDARD INCORPORATING ISOTROPIC ELASTICITY **
12 ***************************************************************************************/
13 
14 #include "SMAAspUserSubroutines.h"
15 #include "SMAAspUserUtilities.h"
16 #include "MooseError.h"
17 
18 using namespace libMesh;
19 
21 
22 extern "C" void
23 uexternaldb_(int * LOP,
24  int * /* LRESTART */,
25  Real /* TIME */[],
26  Real * /* DTIME */,
27  int * /* KSTEP */,
28  int * /* KINC */)
29 {
30  switch (*LOP)
31  {
32  // beginning of the simulation
33  case 0:
34  {
35  MutexInit(2);
36  MutexLock(2);
38  MutexUnlock(2);
39  break;
40  }
41 
42  // beginning of the timestep
43  case 1:
44  {
45  for (int i = 0; i < 1000; ++i)
46  {
47  MutexLock(2);
49  MutexUnlock(2);
50  }
51  break;
52  }
53 
54  // end of the simulation
55  case 3:
56  {
57  if (get_thread_id_() == 0)
58  Moose::out << "sum = " << mutex_test_global_thread_counter << ".\n";
59  break;
60  }
61  }
62 }
void MutexInit(int id)
Definition: AbaqusUtils.C:386
int get_thread_id_()
Definition: AbaqusUtils.C:58
Real mutex_test_global_thread_counter
Definition: mutex_test.C:20
The following methods are specializations for using the Parallel::packed_range_* routines for a vecto...
void MutexUnlock(int id)
Definition: AbaqusUtils.C:398
void uexternaldb_(int *LOP, int *, Real [], Real *, int *, int *)
Definition: mutex_test.C:23
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void MutexLock(int id)
Definition: AbaqusUtils.C:392