https://mooseframework.inl.gov
Loading...
Searching...
No Matches
Functions
SMAAspUserUtilities.h File Reference

Go to the source code of this file.

Functions

int getnumthreads_ ()
 
int get_thread_id_ ()
 
void getoutdir_ (char *dir, int *len)
 
void getjobname_ (char *dir, int *len)
 
void getnumcpus_ (int *num)
 
void getrank_ (int *rank)
 
MPI_Comm get_communicator ()
 
void stdb_abqerr_ (int *lop, char *format, int *intv, double *realv, char *charv, int format_len)
 

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.

59{
61 return puid.id;
62}

Referenced by uexternaldb_(), and uexternaldb_().

◆ 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}

◆ getnumthreads_()

int getnumthreads_ ( )

Definition at line 52 of file AbaqusUtils.C.

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

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

◆ 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}

◆ 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:
178 mooseError(message);
179 break;
180
181 default:
182 mooseError("Invalid LOP code passed to STDB_ABQERR: ", *lop);
183 break;
184 }
185}
void mooseError(Args &&... args)
std::string mooseMsgFmt(const std::string &msg, const std::string &title, const std::string &color)