25 #ifndef NEUTRAL_READER_H
26 #define NEUTRAL_READER_H
28 #include "../Rocsurf/include/surfbasic.h"
46 int read_mesh(
const char *fname,
const std::string &wname) {
47 std::ifstream is( fname);
49 std::cerr <<
"Error: Could not open file " << fname << std::endl;
57 std::cout <<
"Reading file " << fname << std::endl;
62 }
while ( !is.eof() && std::string(
buf).find(
"NUMNP")==std::string::npos);
64 std::cerr <<
"Buf is now \"" <<
buf <<
"\" before getting nn" << std::endl;
66 int t1, t2, t3, t4, nn, ne;
67 std::sscanf(
buf,
"%d %d %d %d %d %d", &nn, &ne, &t1, &t2, &t3, &t4);
72 }
while ( !is.eof() && std::string(
buf).find(
"NODAL")==std::string::npos);
74 std::cout <<
"Reading " << nn <<
" nodes and "
75 << ne <<
" triangles " << std::endl;
81 }
while ( !is.eof() && std::string(
buf).find(
"ELEMENTS")==std::string::npos);
90 if ( is.eof()) {
return; }
97 SURF::Point_3<double> *ps;
100 for (
int i=0;
i<nn; ++
i) {
104 std::sscanf(
buf,
"%d %lf %lf %lf", &t1, &ps[
i][0], &ps[i][1], &ps[i][2]);
113 SURF::Vector_3<int> *es;
116 for (
int i=0;
i<ne; ++
i) {
120 std::sscanf(
buf,
"%d %d %d %d %d %d", &t1, &t2, &t3,
121 &es[
i][0], &es[i][1], &es[i][2]);
#define COM_assertion(EX)
Error checking utility similar to the assert macro of the C language.
void COM_set_size(const char *wa_str, int pane_id, int size, int ng=0)
Set sizes of for a specific attribute.
void read_pane_elems(std::istream &is, const std::string &wname, int ne)
int read_mesh(const char *fname, const std::string &wname)
void get_nextline(std::istream &is, char *str)
void COM_new_window(const char *wname, MPI_Comm c=MPI_COMM_NULL)
void COM_allocate_array(const char *wa_str, int pane_id=0, void **addr=NULL, int strd=0, int cap=0)
Allocate space for an attribute on a specific pane and return the address by setting addr...
int COM_get_window_handle(const char *wname)
void read_pane_coors(std::istream &is, const std::string &wname, int nn)
#define COM_EXTERN_MODULE(moduleName)