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