From: Wolfgang Bangerth Date: Sun, 17 Jun 2012 18:32:55 +0000 (+0000) Subject: Second set of Microsoft Windows Visual C/C++ patches by Bob Goodwin. X-Git-Tag: v8.0.0~2500 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bbd09f570d5d1f1f43bbf5b208f6193c8e37e85f;p=dealii.git Second set of Microsoft Windows Visual C/C++ patches by Bob Goodwin. git-svn-id: https://svn.dealii.org/trunk@25632 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/source/fe/fe_values.inst.in b/deal.II/source/fe/fe_values.inst.in index 12d6ca12c6..90866f797f 100644 --- a/deal.II/source/fe/fe_values.inst.in +++ b/deal.II/source/fe/fe_values.inst.in @@ -262,10 +262,10 @@ for (deal_II_dimension : DIMENSIONS) (const dealii::IndexSet&, std::vector >&) const; template - void FEValuesViews::SymmetricTensor<2,deal_II_dimension>::get_function_values + void FEValuesViews::SymmetricTensor<2,deal_II_dimension,deal_II_dimension>::get_function_values (const dealii::IndexSet&, std::vector >&) const; template - void FEValuesViews::SymmetricTensor<2,deal_II_dimension>::get_function_divergences + void FEValuesViews::SymmetricTensor<2,deal_II_dimension,deal_II_dimension>::get_function_divergences (const dealii::IndexSet&, std::vector >&) const; diff --git a/deal.II/source/lac/compressed_sparsity_pattern.cc b/deal.II/source/lac/compressed_sparsity_pattern.cc index 250b0654f3..de69bcc8f8 100644 --- a/deal.II/source/lac/compressed_sparsity_pattern.cc +++ b/deal.II/source/lac/compressed_sparsity_pattern.cc @@ -24,6 +24,9 @@ DEAL_II_NAMESPACE_OPEN +#ifdef DEAL_II_MSVC +__declspec(selectany) // weak external binding because of multiple link error +#endif const unsigned int CompressedSparsityPattern::Line::cache_size; diff --git a/deal.II/source/lac/sparse_direct.cc b/deal.II/source/lac/sparse_direct.cc index 2f37d8390d..243e0966a2 100644 --- a/deal.II/source/lac/sparse_direct.cc +++ b/deal.II/source/lac/sparse_direct.cc @@ -38,17 +38,21 @@ # define __GNUC__ 3 #endif -#include -#include -#include -#include - +#ifndef DEAL_II_MSVC +# include +# include #ifndef DEAL_II_USE_DIRECT_ERRNO_H # include #else # include #endif #include +#endif + +#include +#include +#include + DEAL_II_NAMESPACE_OPEN @@ -324,12 +328,17 @@ struct SparseDirectMA27::DetachedModeData // repeat writing until // syscall is not // interrupted - int ret; + int ret = -1; +#ifndef DEAL_II_MSVC do ret = write (server_client_pipe[1], reinterpret_cast (t) + count, sizeof(T) * N - count); while ((ret<0) && (errno==EINTR)); +#else + Assert (false, + ExcMessage ("Detached mode isn't currently implemented on Windows")); +#endif if (ret < 0) die ("error on client side in 'put'", ret, errno, child_pid); @@ -355,12 +364,17 @@ struct SparseDirectMA27::DetachedModeData unsigned int count = 0; while (count < sizeof(T)*N) { - int ret; + int ret = -1; +#ifndef DEAL_II_MSVC do - ret = read (client_server_pipe[0], - reinterpret_cast (t) + count, + ret = write (server_client_pipe[1], + reinterpret_cast (t) + count, sizeof(T) * N - count); while ((ret<0) && (errno==EINTR)); +#else + Assert (false, + ExcMessage ("Detached mode isn't currently implemented on Windows")); +#endif if (ret < 0) die ("error on client side in 'get'", ret, errno, child_pid); @@ -406,9 +420,14 @@ SparseDirectMA27::~SparseDirectMA27() // Assign the result of write // and reset the variable to // avoid compiler warnings -//TODO:[WB] Should t be used to trace errors? +#ifndef DEAL_II_MSVC +//TODO:[WB] Shouldn't t be used to trace errors? ssize_t t = write (detached_mode_data->server_client_pipe[1], "7", 1); (void)t; +#else + Assert (false, + ExcMessage ("Detached mode isn't currently implemented on Windows")); +#endif // then also delete data delete detached_mode_data; detached_mode_data = 0; @@ -460,17 +479,28 @@ SparseDirectMA27::initialize (const SparsityPattern &sp) // Assign the return value to a // variable to avoid compiler // warnings +#ifndef DEAL_II_MSVC //TODO:[WB] Use t to trace errors? int t = pipe(detached_mode_data->server_client_pipe); (void)t; - +#else + Assert (false, + ExcMessage ("Detached mode isn't currently implemented on Windows")); +#endif // fflush(NULL) is said to be a // good idea before fork() std::fflush(NULL); // now fork and create child // process +#ifndef DEAL_II_MSVC + // BG comment out until pipes are implemented in MSVC detached_mode_data->child_pid = fork(); +#else + Assert (false, + ExcMessage ("Detached mode isn't currently implemented on Windows")); +#endif + if (detached_mode_data->child_pid == 0) // child process starts here { @@ -478,6 +508,7 @@ SparseDirectMA27::initialize (const SparsityPattern &sp) // pipe to stdin, and // likewise with write end // of pipe to stdout +#ifndef DEAL_II_MSVC dup2(detached_mode_data->server_client_pipe[0], 0); close(detached_mode_data->server_client_pipe[0]); @@ -492,13 +523,19 @@ SparseDirectMA27::initialize (const SparsityPattern &sp) const char * const child_argv[] = { program_name, NULL }; execv(program_name, const_cast(child_argv)); + // usually execv does not // return. if it does, then an // error happened and we report it // herewith: - AssertThrow (false, - ExcMessage ("execv returned, which it is not supposed to do!")); - std::exit(1); + AssertThrow (false, + ExcMessage ("execv returned, which it is not supposed to do!")); + std::exit(1); + +#else + Assert (false, + ExcMessage ("Detached mode isn't currently implemented on Windows")); +#endif }; // parent process continues // here. first thing is to @@ -510,8 +547,13 @@ SparseDirectMA27::initialize (const SparsityPattern &sp) // process was somehow // terminated without sending // him this information +#ifndef DEAL_II_MSVC const pid_t parent_pid = getpid(); detached_mode_data->put (&parent_pid, 1, "parent_pid"); +#else + Assert (false, + ExcMessage ("Detached mode isn't currently implemented on Windows")); +#endif }; diff --git a/deal.II/source/lac/sparsity_pattern.cc b/deal.II/source/lac/sparsity_pattern.cc index b6fbc45a23..1f074cd815 100644 --- a/deal.II/source/lac/sparsity_pattern.cc +++ b/deal.II/source/lac/sparsity_pattern.cc @@ -29,7 +29,9 @@ DEAL_II_NAMESPACE_OPEN - +#ifdef DEAL_II_MSVC +__declspec(selectany) // Weak extern binding due to multiple link error +#endif const unsigned int SparsityPattern::invalid_entry;