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
Branches
Tags
No related merge requests found
......@@ -126,7 +126,7 @@ void readMSHPeriodicNodes(FILE *fp, GModel *gm)
fgetpos(fp, &pos);
if(fscanf(fp, "%s", token) != 1) return;
if(strcmp(token, "Affine") == 0) {
std::vector<double> tfo;
std::vector<double> tfo(16);
for(int i = 0; i < 16; i++){
if(fscanf(fp, "%lf", &tfo[i]) != 1) return;
}
......
......@@ -31,6 +31,8 @@
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,
std::vector<MVertex*> &vertices)
{
......@@ -690,6 +692,29 @@ int GModel::_readMSH2(const std::string &name)
_storePhysicalTagsInEntities(i, physicals[i]);
_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);
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