15 FILE *fp =
Fopen(name.c_str(),
"r");
17 Msg::Error(
"Unable to open file '%s'", name.c_str());
22 if(fscanf(fp,
"%d", &numBlocks) != 1 || numBlocks <= 0) {
27 std::vector<int> Ni(numBlocks), Nj(numBlocks), Nk(numBlocks);
28 for(
int n = 0; n < numBlocks; n++)
29 if(fscanf(fp,
"%d %d %d", &Ni[n], &Nj[n], &Nk[n]) != 3) {
34 for(
int n = 0; n < numBlocks; n++) {
40 for(
int coord = 0; coord < 3; coord++) {
41 for(
int j = 0; j < Nj[n]; j++) {
42 for(
int i = 0; i < Ni[n]; i++) {
44 if(fscanf(fp,
"%lf", &d) != 1) {
73 for(
int i = 0; i < Ni[n]; i++) {
75 for(
int j = 0; j < Nj[n]; j++) {
79 for(
int coord = 0; coord < 3; coord++) {
80 for(
int k = 0; k < Nk[n]; k++) {
81 for(
int j = 0; j < Nj[n]; j++) {
82 for(
int i = 0; i < Ni[n]; i++) {
84 if(fscanf(fp,
"%lf", &d) != 1) {
124 double scalingFactor)
126 FILE *fp =
Fopen(name.c_str(),
"w");
128 Msg::Error(
"Unable to open file '%s'", name.c_str());
134 std::vector<GFace *>
faces;
136 if((*it)->transfinite_vertices.size() &&
137 (*it)->transfinite_vertices[0].size() &&
138 ((*it)->physicals.size() || saveAll))
139 faces.push_back(*it);
141 std::vector<GRegion *>
regions;
143 if((*it)->transfinite_vertices.size() &&
144 (*it)->transfinite_vertices[0].size() &&
145 (*it)->transfinite_vertices[0][0].size() &&
146 ((*it)->physicals.size() || saveAll))
155 fprintf(fp,
"%d\n", (
int)(
faces.size() +
regions.size()));
157 for(std::size_t i = 0; i <
faces.size(); i++)
158 fprintf(fp,
"%d %d 1\n", (
int)
faces[i]->transfinite_vertices.size(),
159 (
int)
faces[i]->transfinite_vertices[0].size());
161 for(std::size_t i = 0; i <
regions.size(); i++)
162 fprintf(fp,
"%d %d %d\n", (
int)
regions[i]->transfinite_vertices.size(),
163 (
int)
regions[i]->transfinite_vertices[0].size(),
164 (
int)
regions[i]->transfinite_vertices[0][0].size());
166 for(std::size_t i = 0; i <
faces.size(); i++) {
168 for(
int coord = 0; coord < 3; coord++) {
172 double d = (coord == 0) ? v->
x() : (coord == 1) ? v->
y() : v->
z();
173 fprintf(fp,
"%.16g ", d * scalingFactor);
180 for(std::size_t i = 0; i <
regions.size(); i++) {
182 for(
int coord = 0; coord < 3; coord++) {
187 double d = (coord == 0) ? v->
x() : (coord == 1) ? v->
y() : v->
z();
188 fprintf(fp,
"%.16g ", d * scalingFactor);