11 std::vector<MVertex *> &vertices)
13 for(
int i = 0; i < num; i++) {
14 if(indices[i] < 0 || indices[i] > (
int)(vec.size() - 1)) {
19 vertices.push_back(vec[indices[i]]);
28 FILE *fp =
Fopen(name.c_str(),
"r");
30 Msg::Error(
"Unable to open file '%s'", name.c_str());
34 int numNodes, numElements, dummy;
35 if(fscanf(fp,
"%d %d %d", &numNodes, &numElements, &dummy) != 3) {
40 if(!numNodes || !numElements) {
46 Msg::Info(
"%d nodes, %d elements", numNodes, numElements);
48 std::vector<MVertex *> vertexVector;
49 std::map<int, std::vector<MElement *> > elements[1];
51 vertexVector.resize(numNodes);
52 for(
int i = 0; i < numNodes; i++) {
54 if(fscanf(fp,
"%lf %lf %lf", &x, &y, &
z) != 3)
break;
55 vertexVector[i] =
new MVertex(x, y,
z);
58 for(
int i = 0; i < numElements; i++) {
60 if(fscanf(fp,
"%d", &N) != 1)
break;
63 if(fscanf(fp,
"%d %d %d", &n[0], &n[1], &n[2]) != 3)
break;
64 for(
int i = 0; i < 3; i++) n[i]--;
69 default:
Msg::Error(
"Unknown element type in .geom reader");
break;
73 for(
int i = 0; i < (int)(
sizeof(elements) /
sizeof(elements[0])); i++)