// $Id$
// Version: $Name$
//
-// Copyright (C) 2002, 2003, 2006, 2007, 2008, 2009 by the deal.II authors
+// Copyright (C) 2002, 2003, 2006, 2007, 2008, 2009, 2011 by the deal.II authors
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Please refer
//
//---------------------------- detached_ma27.cc ---------------------------
-#include <base/config.h>
+#include <deal.II/base/config.h>
#include <hsl/hsl.h>
#include <vector>
extern "C"
-void * monitor_parent_liveness (void *monitor_data)
+void * monitor_parent_liveness (void *monitor_data)
{
const pid_t master_pid = ((MonitorData*)monitor_data)->master_pid;
const pid_t primary_pid = ((MonitorData*)monitor_data)->primary_pid;
-
+
while (true)
{
int ret = kill (master_pid, 0);
die ("Unspecified error while checking for other process!",
ret, errno, primary_pid);
}
-
+
// ok, master still running,
// take a little rest and then
// ask again
count += ret;
}
-
+
fflush (NULL);
}
ret = read (0, reinterpret_cast<char *> (t) + count,
sizeof(T) * N - count);
while ((ret<0) && (errno==EINTR));
-
+
if (ret < 0)
die ("error on client side in 'get'", ret, errno, getpid());
else
DEAL_II_NAMESPACE_CLOSE
-int main ()
+int main ()
{
using namespace dealii;
-
+
// first action is to get the pid
// of the master process, so that
// we can check whether it is still
static MonitorData monitor_data = { master_pid, getpid() };
pthread_t thread;
pthread_create (&thread, 0, &monitor_parent_liveness, &monitor_data);
-
+
// then go into the action loop...
unsigned int N, NZ, NSTEPS, LA, MAXFRT, LIW;
int IFLAG;
{
char action;
get(&action, 1, "ACTION");
-
+
switch (action)
{
case '1':
IRN.resize (NZ);
ICN.resize (NZ);
-
+
get (&IRN[0], NZ, "IRN");
get (&ICN[0], NZ, "ICN");
get (&LIW, 1, "LIW");
IW.resize (LIW);
IKEEP.resize (3*N);
IW1.resize (2*N);
-
+
// next call function
HSL::MA27::ma27ad_ (&N, &NZ, &IRN[0], &ICN[0], &IW[0], &LIW,
&IKEEP[0], &IW1[0], &NSTEPS, &IFLAG);
get (&LA, 1, "LA");
A.resize (LA);
get (&A[0], LA, "A");
-
+
HSL::MA27::ma27bd_ (&N, &NZ, &IRN[0], &ICN[0], &A[0], &LA,
&IW[0], &LIW, &IKEEP[0],
&NSTEPS, &MAXFRT, &IW1[0], &IFLAG);
IRN.swap (tmp2);
IKEEP.swap (tmp3);
};
-
+
// finally return IFLAG
put (&IFLAG, 1, "IFLAG");
break;
};
-
+
case '3':
{
&IW1[0], &NSTEPS);
put (&rhs[0], N, "RHS");
-
+
break;
};
-
-
+
+
case '4':
{
unsigned int NRLNEC;
exit (0);
break;
};
-
+
default:
die ("Invalid action key", action,
static_cast<unsigned short int>(action),
// point anyway...
}
-
+