8 #include "fei_fstream.hpp"
10 #include "fei_utils.hpp"
11 #include "snl_fei_Utils.hpp"
12 #include "fei_MatrixReducer.hpp"
13 #include "fei_Matrix_Impl.hpp"
14 #include "fei_LinearSystemCore.hpp"
15 #include "fei_ParameterSet.hpp"
17 #include "fei_version.h"
19 #ifdef FEI_HAVE_TIME_H
24 const char* fei_VERSION::version()
26 static int times_called = 0;
28 static std::string static_fei_version_string;
30 if (times_called == 0) {
31 FEI_OSTRINGSTREAM osstr;
33 osstr << FEI_MAJOR_VERSION <<
"."
34 << FEI_MINOR_VERSION <<
"."
37 static_fei_version_string = osstr.str();
42 return( static_fei_version_string.c_str() );
48 double cpu_seconds = 0.0;
50 #ifdef FEI_HAVE_TIME_H
51 cpu_seconds = (1.0*clock())/CLOCKS_PER_SEC;
60 if (str ==
"STATS" || str ==
"fei::STATS") {
63 else if (str ==
"BRIEF_LOGS" || str ==
"fei::BRIEF_LOGS") {
64 return fei::BRIEF_LOGS;
66 else if (str ==
"MATRIX_FILES" || str ==
"fei::MATRIX_FILES") {
67 return fei::MATRIX_FILES;
69 else if (str ==
"FULL_LOGS" || str ==
"fei::FULL_LOGS") {
70 return fei::FULL_LOGS;
72 else if (str ==
"ALL" || str ==
"fei::ALL") {
84 fei::MatrixReducer* matred =
dynamic_cast<fei::MatrixReducer*
>(matptr);
85 if (matred != NULL) matptr = matred->getTargetMatrix().get();
90 if (mat_lsc != NULL) {
99 std::vector<int>& nodes,
100 std::vector<int>& elem_offsets)
107 std::map<int,fei::ConnectivityBlock*>& cBlocks =
109 std::map<int,fei::ConnectivityBlock*>::iterator
110 iter = cBlocks.begin(),
111 iter_end = cBlocks.end();
113 for(; iter != iter_end; ++iter) {
122 num_nodes += num_elems*pattern->
getNumIDs();
125 nodes.resize(num_nodes);
126 elem_offsets.resize(num_elems+1);
128 iter = cBlocks.begin(),
129 iter_end = cBlocks.end();
133 int elem_counter = 0;
139 for(; iter != iter_end; ++iter) {
150 for(
unsigned i=0; i<cblk_nodes.size(); ++i) {
151 nodes[node_offset++] = nodeRecords->getRecordWithLocalID(cblk_nodes[i])->getID();
154 for(
int i=0; i<ne; ++i) {
155 elem_offsets[elem_counter++] = elem_offset;
160 elem_offsets[elem_counter] = elem_offset;
165 const char*
const* charstrings,
166 std::vector<std::string>& stdstrings)
168 stdstrings.resize(0);
169 for(
int i=0; i<numStrings; ++i) {
170 if (charstrings[i] != NULL) {
171 std::string tempstr(charstrings[i]);
172 stdstrings.push_back(tempstr);
180 const char**& charPtrs)
182 numStrings = stdstrings.size();
183 charPtrs = numStrings > 0 ?
new const char*[numStrings] : NULL;
185 for(
int i=0; i<numStrings; ++i) {
186 charPtrs[i] = stdstrings[i].c_str();
192 const char* separator_string,
195 std::vector<std::string>::iterator
196 s_iter = stdstrings.begin(),
197 s_end = stdstrings.end();
200 double doubleval = 0.0;
201 const char* charstring_key = NULL;
202 const char* charstring_val = NULL;
206 for(; s_iter != s_end; ++s_iter) {
207 snl_fei::separate_string((*s_iter).c_str(), separator_string,
208 charstring_key, key_len, charstring_val, val_len);
213 std::string keystr(charstring_key, key_len);
217 paramset.
add(vparam,
false);
221 std::string valstr(charstring_val);
223 if (valstr ==
"true" || valstr ==
"True" || valstr ==
"TRUE") {
225 paramset.
add(bparam,
false);
229 if (valstr ==
"false" || valstr ==
"False" || valstr ==
"FALSE") {
231 paramset.
add(bparam,
false);
235 FEI_ISTRINGSTREAM isstr(valstr);
239 std::string::size_type i = valstr.find(
".");
240 std::string::size_type valstrsize = valstr.size();
242 if (i < valstrsize) {
246 paramset.
add(dparam,
false);
256 paramset.
add(iparam,
false);
263 fei::Param sparam(keystr.c_str(), charstring_val);
264 paramset.
add(sparam,
false);
271 std::vector<std::string>& paramStrings)
273 paramStrings.resize(0);
276 iter = paramset->
begin(),
277 iter_end = paramset->
end();
279 for(; iter != iter_end; ++iter) {
283 FEI_OSTRINGSTREAM osstr;
287 case fei::Param::STRING:
290 case fei::Param::DOUBLE:
293 case fei::Param::INT:
296 case fei::Param::VOID:
298 case fei::Param::BOOL:
300 else osstr <<
" false";
306 paramStrings.push_back(osstr.str());
void strings_to_char_ptrs(std::vector< std::string > &stdstrings, int &numStrings, const char **&charPtrs)
void char_ptrs_to_strings(int numStrings, const char *const *charstrings, std::vector< std::string > &stdstrings)
ParamType getType() const
const std::map< int, int > & getConnectivityIDs() const
void convert_ParameterSet_to_strings(const fei::ParameterSet *paramset, std::vector< std::string > ¶mStrings)
fei::OutputLevel string_to_output_level(const std::string &str)
bool getBoolValue() const
virtual std::map< int, fei::ConnectivityBlock * > & getConnectivityBlocks()=0
double getDoubleValue() const
std::vector< int > & getRowConnectivities()
virtual fei::SharedPtr< fei::VectorSpace > getRowSpace()=0
void add(const Param ¶m, bool maintain_unique_keys=true)
LinearSystemCore * get_LinearSystemCore(fei::Matrix *matrix)
fei::SharedPtr< T > getMatrix()
void parse_strings(std::vector< std::string > &stdstrings, const char *separator_string, fei::ParameterSet ¶mset)
const std::string & getStringValue() const
const std::string & getName() const
const_iterator end() const
void getConnectivityArrays(fei::MatrixGraph &matrixGraph, std::vector< int > &nodes, std::vector< int > &elem_offsets)
int getRecordCollection(int idType, snl_fei::RecordCollection *&records)
const_iterator begin() const
const fei::Pattern * getRowPattern() const