Skip to content
Snippets Groups Projects
Commit a53a7b9e authored by Koen Hillewaert's avatar Koen Hillewaert
Browse files

reading periodic information from the mesh file

parent 9528c867
No related branches found
No related tags found
No related merge requests found
...@@ -126,7 +126,7 @@ void readMSHPeriodicNodes(FILE *fp, GModel *gm) ...@@ -126,7 +126,7 @@ void readMSHPeriodicNodes(FILE *fp, GModel *gm)
fgetpos(fp, &pos); fgetpos(fp, &pos);
if(fscanf(fp, "%s", token) != 1) return; if(fscanf(fp, "%s", token) != 1) return;
if(strcmp(token, "Affine") == 0) { if(strcmp(token, "Affine") == 0) {
std::vector<double> tfo; std::vector<double> tfo(16);
for(int i = 0; i < 16; i++){ for(int i = 0; i < 16; i++){
if(fscanf(fp, "%lf", &tfo[i]) != 1) return; if(fscanf(fp, "%lf", &tfo[i]) != 1) return;
} }
......
...@@ -31,6 +31,8 @@ ...@@ -31,6 +31,8 @@
extern void writeMSHPeriodicNodes (FILE *fp, std::vector<GEntity*> &entities); extern void writeMSHPeriodicNodes (FILE *fp, std::vector<GEntity*> &entities);
extern void readMSHPeriodicNodes(FILE *fp, GModel *gm);
static bool getVertices(int num, int *indices, std::map<int, MVertex*> &map, static bool getVertices(int num, int *indices, std::map<int, MVertex*> &map,
std::vector<MVertex*> &vertices) std::vector<MVertex*> &vertices)
{ {
...@@ -690,6 +692,29 @@ int GModel::_readMSH2(const std::string &name) ...@@ -690,6 +692,29 @@ int GModel::_readMSH2(const std::string &name)
_storePhysicalTagsInEntities(i, physicals[i]); _storePhysicalTagsInEntities(i, physicals[i]);
_createGeometryOfDiscreteEntities() ; _createGeometryOfDiscreteEntities() ;
// copying periodic information from the mesh
rewind(fp);
while(1) {
while(str[0] != '$'){
if(!fgets(str, sizeof(str), fp) || feof(fp))
break;
}
if(!strncmp(&str[1], "Periodic",8)) {
readMSHPeriodicNodes(fp,this);
break;
}
do {
if(!fgets(str, sizeof(str), fp) || feof(fp))
break;
} while(str[0] != '$');
}
fclose(fp); fclose(fp);
return postpro ? 2 : 1; return postpro ? 2 : 1;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment