/usr/include/trilinos/snl_fei_Utils.hpp is in libtrilinos-dev 10.4.0.dfsg-1ubuntu2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 | /*--------------------------------------------------------------------*/
/* Copyright 2005 Sandia Corporation. */
/* Under the terms of Contract DE-AC04-94AL85000, there is a */
/* non-exclusive license for use of this work by or on behalf */
/* of the U.S. Government. Export of this program may require */
/* a license from the United States Government. */
/*--------------------------------------------------------------------*/
#ifndef _snl_fei_Utils_hpp_
#define _snl_fei_Utils_hpp_
#include <fei_fwd.hpp>
#include <fei_mpi.h>
#include <fei_SharedPtr.hpp>
namespace fei {
class CSVec;
class Matrix;
}
#include <vector>
#include <map>
#include <string>
namespace snl_fei {
/** Given a search key, and a list of strings, search the list of strings
looking for a string that starts with the search key. i.e., a string
such that key is a leading substring. If found, return a pointer to
that string.<br>
Important Note: The returned pointer should be treated as read-only. It
is not a separate copy of the string being pointed to.
@param key String to be searched for.
@param numParams Number of strings to be searched.
@param paramStrings List of strings to be searched.
@return search-result Pointer to the entry in paramStrings that has key
as a leading substring, or NULL if key is not found.
*/
const char* getParam(const char* key,
int numParams,
const char* const* paramStrings);
/** Given a search key, and a list of strings containing key-value pairs,
search the list of strings looking for one that starts with the search
key. i.e., a string such that key is a leading substring. If found,
return a pointer to the value portion of that key-value pair.<br>
Important Note: The returned pointer should be treated as read-only. It
is not a separate copy of the string being pointed to.
@param key String to be searched for.
@param numParams Number of strings to be searched.
@param paramStrings List of strings to be searched.
@param separator Optional argument, defaults to ' ' (space). This is
the character that is the separator between keys and values in the
parameter strings.
@return search-result Pointer to the entry in paramStrings that has key
as a leading substring, or NULL if key is not found.
*/
const char* getParamValue(const char* key,
int numParams,
const char* const* paramStrings,
char separator=' ');
/** Given a search key, and a vector of strings containing key-value pairs,
search the strings looking for one that starts with the search
key. i.e., a string such that key is a leading substring. If found,
return a pointer to the value portion of that key-value pair.<br>
Important Note: The returned pointer should be treated as read-only. It
is not a separate copy of the string being pointed to.
@param key String to be searched for.
@param params vector of strings to be searched.
@param separator Optional separator char, defaults to space
@return search-result Pointer to the entry in paramStrings that has key
as a leading substring, or NULL if key is not found.
*/
const char* getParamValue(const char* key,
std::vector<std::string>& params,
char separator=' ');
/** Given a search key, and a list of strings containing key-value pairs,
search the list of strings looking for one that starts with the search
key. i.e., a string such that key is a leading substring. If found,
return a pointer to the value portion of that key-value pair.<br>
Important Note: The returned pointer should be treated as read-only. It
is not a separate copy of the string being pointed to.
@param key String to be searched for.
@param numParams Number of strings to be searched.
@param paramStrings List of strings to be searched.
@param foundOffset offset at which key was found in paramStrings. If not
found, then this parameter is set to -1.
@param separator Optional argument, defaults to ' ' (space). This is
the character that is the separator between keys and values in the
parameter strings.
@return search-result Pointer to the entry in paramStrings that has key
as a leading substring, or NULL if key is not found.
*/
const char* getParamValue(const char* key,
int numParams,
const char* const* paramStrings,
int& foundOffset,
char separator=' ');
/** Get the integer value of a named key-value pair from an array of strings.
*/
int getIntParamValue(const char* key,
int numParams,
const char*const* params,
int& paramValue);
/** Get the double-precision value of a named key-value pair from an array of
strings.
*/
int getDoubleParamValue(const char* key,
int numParams,
const char*const* params,
double& paramValue);
/** Get the double-precision value of a named key-value pair from a vector of
strings.
*/
int getDoubleParamValue(const char* key,
std::vector<std::string>& params,
double& paramValue);
/** Given a search key, and a list of strings, search the list of strings
looking for a string that starts with the search key. i.e., a string
such that key is a leading substring. If found, return a pointer to
that string, and also provide the offset of the location in
'paramStrings' at which it was found.<br>
Important Note: The returned pointer should be treated as read-only. It
is not a separate copy of the string being pointed to.
This method is case-sensitive.
@param key String to be searched for.
@param numParams Number of strings to be searched.
@param paramStrings List of strings to be searched.
@param foundOffset offset at which key was found in paramStrings. If not
found, then this parameter is set to -1.
@return search-result Pointer to the entry in paramStrings that has key
as a leading substring, or NULL if key is not found.
*/
const char* getParam(const char* key,
int numParams,
const char* const* paramStrings,
int& foundOffset);
/** Given a search key, and a vector of strings, search the strings
looking for a string that starts with the search key. i.e., a string
such that key is a leading substring. If found, return a pointer to
that string, and also provide the offset of the location in
'paramStrings' at which it was found.<br>
Important Note: The returned pointer should be treated as read-only. It
is not a separate copy of the string being pointed to.
This method is case-sensitive.
@param key String to be searched for.
@param paramStrings vector of strings to be searched.
@param foundOffset offset at which key was found in paramStrings. If not
found, then this parameter is set to -1.
@return search-result Pointer to the entry in paramStrings that has key
as a leading substring, or NULL if key is not found.
*/
const char* getParam(const char* key,
std::vector<std::string>& paramStrings,
int& foundOffset);
/** stored a named void pointer in a vector. (poor-man's map) */
int storeNamedAttribute(const char* name,
void* attribute,
std::vector<char*>& attributeNames,
std::vector<void*>& attributes);
/** retrived a named void pointer from a vector. (poor-man's map) */
void* retrieveNamedAttribute(const char* name,
std::vector<char*>& attributeNames,
std::vector<void*>& attributes);
/** separate a string into pieces. unsupported, for power-users only */
void separate_string(const char* input_string,
const char* substring,
const char*& before_substring,
int& len_before_substring,
const char*& after_substring,
int& len_after_substring);
/** Given a string, return the length of the leading substring, which is the
characters that precede any space, tab, equals sign, or null character.
*/
unsigned leading_substring_length(const char* string);
/** Given a parameter-string, which is assumed to contain a pair of
substrings (key-value pair) separated by a specified separator character,
return a pointer to the second substring. In other words, return a pointer
to the first character after the separator. Allows for the possibility that
the substrings are separated by more than one copy of the separator.
@param paramString String to be searched.
@param separator Optional parameter, defaults to ' ' (space).
@return result First character after separator, or NULL if separator
is not found in paramString.
*/
const char* skipSeparator(const char* paramString,
char separator=' ');
/** Merge a list of strings into a list of other strings. Maintain
uniqueness, don't merge strings that are already present.
*/
int mergeStringLists(char**& strings, int& numStrings,
const char*const* stringsToMerge, int numStringsToMerge);
/** Resolve conflicts between constraint-relations and essential (dirichlet)
boundary conditions.
*/
int resolveConflictingCRs(fei::MatrixGraph& matrixGraph,
fei::Matrix& bcEqns,
const std::vector<int>& bcEqnNumbers);
/** Do appropriate communications to gather column-portions of remotely-held
essential BCs onto local processor.
*/
int gatherRemoteEssBCs(fei::CSVec& essBCs,
fei::SparseRowGraph* remoteGraph,
fei::Matrix& matrix);
fei::SharedPtr<fei::SparseRowGraph>
mergeSparseRowGraphs(const fei::SparseRowGraph* srg1,
const fei::SparseRowGraph* srg2);
/** Copy values from a 2D "C-style" block-diagonal table (list of pointers) to
a "fortran-style" flat column-contiguous array.
*/
void copy2DBlockDiagToColumnContig(int numBlocks,
const int* blockSizes,
const double*const* values2d,
int format,
double* colcontigvalues);
/** Copy values from a 2D "C-style" table (list of pointers) to a "fortran-style"
flat column-contiguous array.
*/
void copy2DToColumnContig(int numrows,
int numcols,
const double*const* values2d,
int format,
double* colcontigvalues);
} //namespace snl_fei
#endif // _snl_fei_Utils_hpp_
|