Debian Codegraph @

tools/physicalModeling/mesh2faust/vega/libraries/include/volumetricMeshParser.h

raw symbols SCIP
1 /*************************************************************************
2 * *
3 * Vega FEM Simulation Library Version 3.1 *
4 * *
5 * "volumetricMesh" library , Copyright (C) 2007 CMU, 2009 MIT, 2016 USC *
6 * All rights reserved. *
7 * *
8 * Code author: Jernej Barbic *
9 * http://www.jernejbarbic.com/code *
10 * *
11 * Research: Jernej Barbic, Fun Shing Sin, Daniel Schroeder, *
12 * Doug L. James, Jovan Popovic *
13 * *
14 * Funding: National Science Foundation, Link Foundation, *
15 * Singapore-MIT GAMBIT Game Lab, *
16 * Zumberge Research and Innovation Fund at USC *
17 * *
18 * This library is free software; you can redistribute it and/or *
19 * modify it under the terms of the BSD-style license that is *
20 * included with this library in the file LICENSE.txt *
21 * *
22 * This library is distributed in the hope that it will be useful, *
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the file *
25 * LICENSE.TXT for more details. *
26 * *
27 *************************************************************************/
28
29 #ifndef _VOLUMETRICMESHPARSER_H_
30 #define _VOLUMETRICMESHPARSER_H_
31
32 #include <stdio.h>
33 #include <stdlib.h>
34 #include <vector>
35 using namespace std;
36
37 /*
38 A parser for the volumetric mesh text file format.
39 Note: the end user never needs to use this class directly.
40 See volumetricMesh.h .
41 */
42
43 class VolumetricMeshParser
44 {
45 public:
46
47 VolumetricMeshParser(const char * includeToken = NULL); // pass NULL for normal usage
48 ~VolumetricMeshParser();
49
50 int open(const char * filename);
51
52 // return the next line, s must be externally allocated string
53 // if last line, return will be NULL
54 char * getNextLine(char * s, int numRetainedSpaces=0, int removeWhitespace=1);
55
56 void rewindToStart();
57 void close();
58
59 static void upperCase(char * s);
60 static void removeWhitespace(char * s, int numRetainedSpaces=0); // any whitespace equal in length or longer to "numRetainedSpaces" is shrunk to "numRetainedSpaces" and retained
61 static void beautifyLine(char * s, int numRetainedSpaces, int removeWhitespace=1); // strip whitespace + removes trailing "\n"
62
63 protected:
64 FILE * fin;
65 vector< FILE* > fileStack;
66 //int fileStackDepth;
67
68 char directoryName[4096];
69
70 char includeToken[96]; // normally "*INCLUDE "
71 int includeTokenLength; // normally 9
72 };
73
74 #endif
75