FEI Version of the Day
fei_impl_utils.hpp
00001 #ifndef _fei_impl_utils_hpp_
00002 #define _fei_impl_utils_hpp_
00003 
00004 /*--------------------------------------------------------------------*/
00005 /*    Copyright 2008 Sandia Corporation.                              */
00006 /*    Under the terms of Contract DE-AC04-94AL85000, there is a       */
00007 /*    non-exclusive license for use of this work by or on behalf      */
00008 /*    of the U.S. Government.  Export of this program may require     */
00009 /*    a license from the United States Government.                    */
00010 /*--------------------------------------------------------------------*/
00011 
00012 #include <fei_macros.hpp>
00013 #include <fei_fwd.hpp>
00014 #include <fei_mpi.h>
00015 
00016 #include <Teuchos_ParameterList.hpp>
00017 
00018 #include <string>
00019 #include <vector>
00020 #include <map>
00021 
00022 
00025 namespace fei {
00026 
00030 namespace impl_utils {
00031 
00039 void find_offsets(const std::vector<int>& sources,
00040                   const std::vector<int>& targets,
00041                   std::vector<int>& offsets);
00042 
00043 size_t num_bytes_FillableMat(const fei::FillableMat& mat);
00044 
00045 void pack_FillableMat(const fei::FillableMat& mat, char* buffer);
00046 
00051 void unpack_FillableMat(const char* data_begin, const char* data_end,
00052                         fei::FillableMat& mat,
00053                         bool clear_mat_on_entry = true,
00054                         bool overwrite_entries = true);
00055 
00057 bool unpack_CSRMat(const char* buffer_begin, const char* buffer_end, fei::CSRMat& mat);
00058 
00059 size_t num_bytes_indices_coefs(const std::vector<int>& indices,
00060                         const std::vector<double>& coefs);
00061 
00062 void pack_indices_coefs(const std::vector<int>& indices,
00063                         const std::vector<double>& coefs,
00064                         std::vector<char>& buffer,
00065                         bool resize_buffer=true);
00066 
00067 void unpack_indices_coefs(const std::vector<char>& buffer,
00068                           std::vector<int>& indices,
00069                           std::vector<double>& coefs);
00070 
00071 void separate_BC_eqns(const fei::FillableMat& mat,
00072                     std::vector<int>& bcEqns,
00073                     std::vector<double>& bcVals);
00074 
00075 void create_col_to_row_map(const fei::FillableMat& mat,
00076                            std::multimap<int,int>& crmap);
00077 
00078 int remove_couplings(fei::FillableMat& mat);
00079 
00080 void global_union(MPI_Comm comm,
00081                   const fei::FillableMat& localMatrix,
00082                   fei::FillableMat& globalUnionMatrix);
00083 
00084 void global_union(MPI_Comm comm,
00085                   const fei::CSVec& localVec,
00086                   fei::CSVec& globalUnionVec);
00087 
00088 void translate_to_reduced_eqns(const fei::Reducer& reducer, fei::CSRMat& mat);
00089 
00090 void translate_to_reduced_eqns(const fei::Reducer& reducer, fei::CSVec& vec);
00091 
00092 void add_to_graph(const fei::CSRMat& inmat, fei::Graph& graph);
00093 
00094 void add_to_matrix(const fei::CSRMat& inmat, bool sum_into, fei::Matrix& matrix);
00095 
00096 }//namespace impl_utils
00097 }//namespace fei
00098 
00099 #endif
00100 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends