xref: /petsc/src/sys/utils/arch.c (revision 609bdbee21ea3be08735c64dbe00a9ab27759925)
1 
2 #include <petscsys.h>         /*I  "petscsys.h"  I*/
3 
4 /*@C
5      PetscGetArchType - Returns a standardized architecture type for the machine
6      that is executing this routine.
7 
8      Not Collective
9 
10      Input Parameter:
11 .    slen - length of string buffer
12 
13      Output Parameter:
14 .    str - string area to contain architecture name, should be at least
15            10 characters long. Name is truncated if string is not long enough.
16 
17      Level: developer
18 
19      Concepts: machine type
20      Concepts: architecture
21 
22    Fortran Version:
23    In Fortran this routine has the format
24 
25 $       character*(10) str
26 $       call PetscGetArchType(str,ierr)
27 
28 .seealso: PetscGetUserName(),PetscGetHostName()
29 @*/
30 PetscErrorCode  PetscGetArchType(char str[],size_t slen)
31 {
32   PetscErrorCode ierr;
33 
34   PetscFunctionBegin;
35 #if defined(PETSC_ARCH)
36   ierr = PetscStrncpy(str,PETSC_ARCH,slen-1);CHKERRQ(ierr);
37 
38   str[slen-1] = 0;
39 #else
40 #error "$PETSC_ARCH/include/petscconf.h is missing PETSC_ARCH"
41 #endif
42   PetscFunctionReturn(0);
43 }
44 
45