FEI  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
fei_impl_utils.hpp
1 #ifndef _fei_impl_utils_hpp_
2 #define _fei_impl_utils_hpp_
3 
4 /*--------------------------------------------------------------------*/
5 /* Copyright 2008 Sandia Corporation. */
6 /* Under the terms of Contract DE-AC04-94AL85000, there is a */
7 /* non-exclusive license for use of this work by or on behalf */
8 /* of the U.S. Government. Export of this program may require */
9 /* a license from the United States Government. */
10 /*--------------------------------------------------------------------*/
11 
12 #include <fei_macros.hpp>
13 #include <fei_fwd.hpp>
14 #include <fei_mpi.h>
15 
17 
18 #include <string>
19 #include <vector>
20 #include <map>
21 
22 
25 namespace fei {
26 
30 namespace impl_utils {
31 
39 void find_offsets(const std::vector<int>& sources,
40  const std::vector<int>& targets,
41  std::vector<int>& offsets);
42 
43 size_t num_bytes_FillableMat(const fei::FillableMat& mat);
44 
45 void pack_FillableMat(const fei::FillableMat& mat, char* buffer);
46 
51 void unpack_FillableMat(const char* data_begin, const char* data_end,
52  fei::FillableMat& mat,
53  bool clear_mat_on_entry = true,
54  bool overwrite_entries = true);
55 
57 bool unpack_CSRMat(const char* buffer_begin, const char* buffer_end, fei::CSRMat& mat);
58 
59 size_t num_bytes_indices_coefs(const std::vector<int>& indices,
60  const std::vector<double>& coefs);
61 
62 void pack_indices_coefs(const std::vector<int>& indices,
63  const std::vector<double>& coefs,
64  std::vector<char>& buffer,
65  bool resize_buffer=true);
66 
67 void unpack_indices_coefs(const std::vector<char>& buffer,
68  std::vector<int>& indices,
69  std::vector<double>& coefs);
70 
71 void separate_BC_eqns(const fei::FillableMat& mat,
72  std::vector<int>& bcEqns,
73  std::vector<double>& bcVals);
74 
75 void create_col_to_row_map(const fei::FillableMat& mat,
76  std::multimap<int,int>& crmap);
77 
78 int remove_couplings(fei::FillableMat& mat);
79 
80 void global_union(MPI_Comm comm,
81  const fei::FillableMat& localMatrix,
82  fei::FillableMat& globalUnionMatrix);
83 
84 void global_union(MPI_Comm comm,
85  const fei::CSVec& localVec,
86  fei::CSVec& globalUnionVec);
87 
88 void translate_to_reduced_eqns(const fei::Reducer& reducer, fei::CSRMat& mat);
89 
90 void translate_to_reduced_eqns(const fei::Reducer& reducer, fei::CSVec& vec);
91 
92 void add_to_graph(const fei::CSRMat& inmat, fei::Graph& graph);
93 
94 void add_to_matrix(const fei::CSRMat& inmat, bool sum_into, fei::Matrix& matrix);
95 
96 }//namespace impl_utils
97 }//namespace fei
98 
99 #endif
100 
bool unpack_CSRMat(const char *buffer_begin, const char *buffer_end, fei::CSRMat &mat)
void find_offsets(const std::vector< int > &sources, const std::vector< int > &targets, std::vector< int > &offsets)
void unpack_FillableMat(const char *buffer_begin, const char *buffer_end, fei::FillableMat &mat, bool clear_mat_on_entry, bool overwrite_entries)