A demo using parasolid to test its SSI, evaluation and other functions.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

105 lines
2.7 KiB

#ifndef PARASOLIDDEMO_CASE_READER_H
#define PARASOLIDDEMO_CASE_READER_H
#include <iostream>
#include "boost/algorithm/string.hpp"
#include "vector"
using namespace std;
class Srf {
public:
double *vertex;
int dim_u, dim_v;
int ptDim;
int degree_u, degree_v;
int knots_num_u, knots_num_v;
double *knots_u, *knots_v;
int *knots_mult_u, *knots_mult_v;
Srf() {
vertex = nullptr;
knots_u = nullptr;
knots_v = nullptr;
knots_mult_u = nullptr;
knots_mult_v = nullptr;
}
~Srf() {
delete[] vertex;
delete[] knots_u;
delete[] knots_v;
delete[] knots_mult_u;
delete[] knots_mult_v;
}
void printSrf() {
printf("dim_u: %d, dim_v: %d\n", dim_u, dim_v);
printf("degree_u: %d, degree_v: %d\n", degree_u, degree_v);
printf("knots_num_u: %d, knots_num_v: %d\n", knots_num_u, knots_num_v);
printVertex();
printKnots();
printKnotsMult();
}
void printVertex() const {
printf("vertex: {\n");
for(int i = 0; i < dim_u; i++)
for(int j = 0; j < dim_v; j++)
printf("%f %f %f %f\n", vertex[(i * dim_v + j) * ptDim],
vertex[(i * dim_v + j) * ptDim + 1],
vertex[(i * dim_v + j) * ptDim + 2],
vertex[(i * dim_v + j) * ptDim + 3]);
printf("}\n");
}
void printKnots() const {
printf("knots_u: {\n");
for(int i = 0; i < knots_num_u; i++)
printf("%f ", knots_u[i]);
printf("\n}\n");
printf("knots_v: {\n");
for(int i = 0; i < knots_num_v; i++)
printf("%f ", knots_v[i]);
printf("\n}\n");
}
void printKnotsMult() const {
printf("knots_mult_u: {\n");
for(int i = 0; i < knots_num_u; i++)
printf("%d ", knots_mult_u[i]);
printf("\n}\n");
printf("knots_mult_v: {\n");
for(int i = 0; i < knots_num_v; i++)
printf("%d ", knots_mult_v[i]);
printf("\n}\n");
}
};
class CaseReader {
public:
Srf srf1;
Srf srf2;
explicit CaseReader(const string &filePath, int ptDim = 4);
explicit CaseReader(const string &filePath1, const string &filePath2, int ptDim = 4);
~CaseReader();
string handleFile(const string &filePath);
void initVertices1(const string &str);
void getPtsFromStr1(string &srfData, Srf &srf);
void initVertices2(const string &str, Srf &srf);
double *getPtsFromStr2(string &srfData);
static vector<string> extractSubStr(const string &str, const string &regexExpr);
};
#endif //PARASOLIDDEMO_CASE_READER_H