19 void tokenize(std::string srcInput,std::string whitespace,std::string prefer, std::vector<std::string> & tokens) {
20 std::string input = srcInput;
21 std::vector<std::string> wsTokens;
22 std::size_t endPos = input.length()-1;
23 while(endPos<input.length()) {
24 std::size_t next = input.find_first_of(whitespace);
28 if(next!=std::string::npos) {
29 s = input.substr(0,next);
32 input = input.substr(next+1,endPos);
39 endPos = input.length()-1;
43 wsTokens.push_back(s);
46 for(
unsigned int i=0;i<wsTokens.size();i++) {
50 endPos = input.length()-1;
51 while(endPos<input.length()) {
52 std::size_t next = input.find_first_of(prefer);
54 std::string s = input;
55 if(next>0 && next<input.length()) {
58 s = input.substr(0,next);
60 input = input.substr(next,endPos);
64 s = input.substr(0,next+1);
66 input = input.substr(next+1,endPos);
71 endPos = input.length()-1;
82 std::vector<std::string>::const_iterator begin,
83 std::vector<std::string>::const_iterator end,
84 std::vector<std::string> & subBlock) {
85 std::stack<std::string> matched;
86 std::vector<std::string>::const_iterator itr;
87 for(itr=begin;itr!=end;++itr) {
89 subBlock.push_back(*itr);
92 if(*itr==
"[") matched.push(
"[");
93 else if(*itr==
"]") matched.pop();
116 std::vector<Teuchos::RCP<Xpetra::BlockReorderManager> > vecRMgr;
117 std::vector<std::string>::const_iterator itr = tokens.begin()+1;
118 while(itr!=tokens.end()-1) {
120 std::vector<std::string> subBlock;
133 for(
unsigned int i=0;i<vecRMgr.size();i++)
153 std::vector<std::string> tokens;
158 tokenize(reorder,
" \t\n",
"[]",tokens);
std::vector< std::string >::const_iterator buildSubBlock(std::vector< std::string >::const_iterator begin, std::vector< std::string >::const_iterator end, std::vector< std::string > &subBlock)
Teuchos::RCP< const Xpetra::BlockReorderManager > blockedReorderFromString(std::string reorder)
Convert a string to a block reorder manager object.
void tokenize(std::string srcInput, std::string whitespace, std::string prefer, std::vector< std::string > &tokens)
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
virtual void SetBlock(int blockIndex, int reorder)
Sets the subblock to a specific index value.
Teuchos::RCP< Xpetra::BlockReorderManager > blockedReorderFromTokens(const std::vector< std::string > &tokens)
virtual void SetNumBlocks(size_t sz)
Sets number of subblocks.
static int atoi(const std::string &str)
std::vector< Teuchos::RCP< BlockReorderManager > > children_
definitions of the subblocks
#define TEUCHOS_ASSERT(assertion_test)