# | Line 25 | Line 25 | GNU General Public License for more details. | |
---|---|---|
25 | * @file ElementsTable.cpp | |
26 | * @author gezelter | |
27 | * @date 12/21/2007 | |
28 | – | * @time 11:30am |
28 | * @version 1.0 | |
29 | */ | |
30 | ||
32 | – | #include <iostream> |
31 | #include "config.h" | |
32 | + | |
33 | + | #include <iostream> |
34 | #include <cstdlib> | |
35 | #include <string> | |
36 | #include <fstream> | |
37 | #include <cstdlib> | |
38 | #include "utils/ElementsTable.hpp" | |
39 | #include "utils/simError.h" | |
40 | < | #include "io/basic_ifstrstream.hpp" |
40 | > | #include "io/ifstrstream.hpp" |
41 | ||
42 | < | #if !HAVE_STRNCASECMP |
43 | < | extern "C" int strncasecmp(const char *s1, const char *s2, size_t n); |
42 | > | #ifdef _MSC_VER |
43 | > | #define strncasecmp _strnicmp |
44 | > | #define strcasecmp _stricmp |
45 | #endif | |
46 | ||
47 | + | |
48 | #ifdef WIN32 | |
49 | #define FILE_SEP_CHAR "\\" | |
50 | #else | |
# | Line 66 | Line 68 | namespace OpenMD { | |
68 | ||
69 | ElementsTable::~ElementsTable() { | |
70 | std::vector<Element*>::iterator i; | |
71 | < | for (i = elements_.begin(); i != elements_.end(); i++) |
71 | > | for (i = elements_.begin(); i != elements_.end(); ++i) |
72 | delete *i; | |
73 | } | |
74 | ||
75 | void ElementsTable::ParseLine(const char *line) { | |
76 | int num, maxbonds; | |
77 | < | char symbol[5]; |
77 | > | char symbol[6]; |
78 | char name[256]; | |
79 | RealType Rcov,Rvdw,mass, elNeg, ionize, elAffin; | |
80 | RealType red, green, blue; | |
# | Line 267 | Line 269 | namespace OpenMD { | |
269 | Init(); | |
270 | ||
271 | std::vector<Element*>::iterator i; | |
272 | < | for (i = elements_.begin();i != elements_.end();i++) |
272 | > | for (i = elements_.begin();i != elements_.end(); ++i) |
273 | if (!strncasecmp(sym,(*i)->GetSymbol(),2)) | |
274 | return((*i)->GetAtomicNum()); | |
275 | ||
# | Line 324 | Line 326 | namespace OpenMD { | |
326 | simError(); | |
327 | } | |
328 | ||
329 | < | char charBuffer[BUFF_SIZE]; |
329 | > | |
330 | if ((*ifsP)) { | |
331 | + | char charBuffer[BUFF_SIZE]; |
332 | while(ifsP->getline(charBuffer,BUFF_SIZE)) | |
333 | ParseLine(charBuffer); | |
334 | < | |
334 | > | |
335 | if (ifs1) | |
336 | ifs1.close(); | |
337 | if (ifs2) |
– | Removed lines |
+ | Added lines |
< | Changed lines |
> | Changed lines |