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