Changeset d2d7fc
- Timestamp:
- Jul 10, 2012, 1:15:51 PM (13 years ago)
- Children:
- c96b1d
- Parents:
- ab755a
- git-author:
- Frederik Heber <heber@…> (07/08/12 20:19:46)
- git-committer:
- Frederik Heber <heber@…> (07/10/12 13:15:51)
- File:
-
- 1 edited
-
src/bin/mpqc/mpqc.cc (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/bin/mpqc/mpqc.cc
rab755a rd2d7fc 615 615 } 616 616 617 /** Parse the input configuration from char array into keyvalue container. 618 * 619 * \param parsedkv key value container to foll 620 * \param values temporary options value structure 621 * \param in_char_array char array with input file 622 * \param use_simple_input whether the format in \a in_char_array is simple (1) 623 * or object-oriented (0) 624 */ 625 void parseIntoKeyValue( 626 Ref<ParsedKeyVal> &parsedkv, 627 struct OptionValues &values, 628 char *in_char_array, 629 int use_simple_input) 630 { 631 if (use_simple_input) { 632 MPQCIn mpqcin; 633 char *simple_input_text = mpqcin.parse_string(in_char_array); 634 if (values.simple_input) { 635 ExEnv::out0() << "Generated object-oriented input file:" << endl 636 << simple_input_text 637 << endl; 638 exit(0); 639 } 640 parsedkv = new ParsedKeyVal(); 641 parsedkv->parse_string(simple_input_text); 642 delete[] simple_input_text; 643 } else { 644 parsedkv = new ParsedKeyVal(); 645 parsedkv->parse_string(in_char_array); 646 } 647 } 648 617 649 /** Parse the input file into the key value container. 618 650 * … … 622 654 * \param input input file name 623 655 * \param generic_input filename of generic input 656 * \param in_char_array char array with input file's contents on return 657 * \param use_simple_input whether the file contents is in simple format (1) 658 * or object-oriented (0) 624 659 */ 625 660 void parseInputfile( … … 628 663 struct OptionValues &values, 629 664 const char *&input, 630 const char *&generic_input 665 const char *&generic_input, 666 char *&in_char_array, 667 int &use_simple_input 631 668 ) 632 669 { 633 670 // read the input file on only node 0 634 char *in_char_array;635 671 if (grp->me() == 0) { 636 672 ifstream is(input); … … 657 693 } 658 694 659 int use_simple_input;660 695 if (generic_input && grp->me() == 0) { 661 696 MPQCIn mpqcin; … … 666 701 } 667 702 grp->bcast(use_simple_input); 668 669 if (use_simple_input) {670 MPQCIn mpqcin;671 char *simple_input_text = mpqcin.parse_string(in_char_array);672 if (values.simple_input) {673 ExEnv::out0() << "Generated object-oriented input file:" << endl674 << simple_input_text675 << endl;676 exit(0);677 }678 parsedkv = new ParsedKeyVal();679 parsedkv->parse_string(simple_input_text);680 delete[] simple_input_text;681 }682 else {683 parsedkv = new ParsedKeyVal();684 parsedkv->parse_string(in_char_array);685 }686 delete[] in_char_array;687 703 } 688 704 … … 1174 1190 // parse input into keyvalue container 1175 1191 Ref<ParsedKeyVal> parsedkv; 1176 parseInputfile(grp, parsedkv, values, input, generic_input); 1192 char *in_char_array = 0; 1193 int use_simple_input; 1194 parseInputfile(grp, parsedkv, values, input, generic_input, in_char_array, use_simple_input); 1195 parseIntoKeyValue(parsedkv, values, in_char_array, use_simple_input); 1196 delete[] in_char_array; 1177 1197 1178 1198 // prefix parsed values wit "mpqc"
Note:
See TracChangeset
for help on using the changeset viewer.
