xref: /petsc/src/sys/utils/arch.c (revision bfe80ac4a46d58cb7760074b25f5e81b2f541d8a)
1 #include <petscsys.h> /*I  "petscsys.h"  I*/
2 
3 /*@C
4   PetscGetArchType - Returns the $PETSC_ARCH that was used for this configuration of PETSc
5 
6   Not Collective
7 
8   Input Parameter:
9 . slen - length of string buffer
10 
11   Output Parameter:
12 . str - string area to contain architecture name, should be at least 10 characters long. Name is truncated if string is not long enough.
13 
14   Level: developer
15 
16   Note:
17   This name is arbitrary and need not correspond to the physical hardware or the software running on the system.
18 
19   Fortran Note:
20 .vb
21   character*(128) str
22   call PetscGetArchType(str,ierr)
23 .ve
24 
25 .seealso: `PetscGetUserName()`, `PetscGetHostName()`
26 @*/
27 PetscErrorCode PetscGetArchType(char str[], size_t slen)
28 {
29   PetscFunctionBegin;
30 #if defined(PETSC_ARCH)
31   PetscCall(PetscStrncpy(str, PETSC_ARCH, slen - 1));
32 #else
33   #error "$PETSC_ARCH/include/petscconf.h is missing PETSC_ARCH"
34 #endif
35   PetscFunctionReturn(PETSC_SUCCESS);
36 }
37