File: solveSetup.c

package info (click to toggle)
spooles 2.2-9
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 19,012 kB
  • sloc: ansic: 146,834; csh: 3,615; makefile: 2,040; perl: 74
file content (82 lines) | stat: -rw-r--r-- 2,259 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/*  solveSetup.c  */

#include "../BridgeMT.h"

/*--------------------------------------------------------------------*/
/*
   -----------------------------------------------
   purpose -- to setup for the parallel solve

   return value ---
      1 -- normal return
     -1 -- bridge is NULL
     -2 -- frontmtx is NULL
     -3 -- frontmtx has not yet been postprocessed

   created -- 98sep24, cca
   -----------------------------------------------
*/
int
BridgeMT_solveSetup (
   BridgeMT   *bridge
) {
double     t1, t2 ;
FILE       *msgFile ;
FrontMtx   *frontmtx ;
int        msglvl ;
SolveMap   *solvemap ;
/*
   ---------------
   check the input
   ---------------
*/
MARKTIME(t1) ;
if ( bridge == NULL ) {
   fprintf(stderr, "\n\n error in BridgeMT_solveSetup()"
           "\n bridge is NULL\n") ;
   return(-1) ;
}
if ( (frontmtx = bridge->frontmtx) == NULL ) {
   fprintf(stderr, "\n\n error in BridgeMT_solveSetup()"
           "\n frontmtx is NULL\n") ;
   return(-2) ;
}
if ( ! FRONTMTX_IS_2D_MODE(frontmtx) ) {
   fprintf(stderr, "\n\n error in BridgeMT_solveSetup()"
           "\n frontmtx must be in 2-D mode\n") ;
   return(-2) ;
}
msglvl  = bridge->msglvl  ;
msgFile = bridge->msgFile ;
if ( (solvemap = bridge->solvemap) == NULL ) {
   solvemap = bridge->solvemap = SolveMap_new() ;
} else {
   SolveMap_clearData(solvemap) ;
}
if (  FRONTMTX_IS_NONSYMMETRIC(frontmtx)
   && FRONTMTX_IS_PIVOTING(frontmtx) ) {
   SolveMap_ddMap(solvemap, SPOOLES_NONSYMMETRIC, 
                  frontmtx->upperblockIVL, frontmtx->lowerblockIVL,
                  bridge->nthread, bridge->ownersIV, frontmtx->tree,
                  bridge->seed, msglvl, msgFile) ;
} else {
   SolveMap_ddMap(solvemap, SPOOLES_SYMMETRIC, 
                  frontmtx->upperblockIVL, NULL,
                  bridge->nthread, bridge->ownersIV, frontmtx->tree,
                  bridge->seed, msglvl, msgFile) ;
}
MARKTIME(t2) ;
bridge->cpus[11] = t2 - t1 ;
if ( msglvl > 1 ) {
   fprintf(msgFile, "\n\n solve map created") ;
   fflush(msgFile) ;
}
if ( msglvl > 3 ) {
   fprintf(msgFile, "\n\n SolveMap") ;
   SolveMap_writeForHumanEye(solvemap, msgFile) ;
   fflush(msgFile) ;
}

return(1) ; }   

/*--------------------------------------------------------------------*/