Commit 430ff6e7 authored by Christophe Geuzaine's avatar Christophe Geuzaine

Merge branch 'HighOrderVizu' into 'master'

High order export for LIN_2, TRI_2, TET_2

See merge request !47
parents c7c3a213 34e0d83d
Pipeline #1866 passed with stage
in 24 minutes and 58 seconds
......@@ -10,6 +10,7 @@
#include <math.h>
#include "Pos_Element.h"
#include "GeoData.h"
#include "GeoEntity.h"
#include "Get_Geometry.h"
#include "Get_DofOfElement.h"
#include "Cal_Value.h"
......@@ -353,10 +354,10 @@ void Cut_PostElement(struct PostElement * PE, struct Geo_Element * GE,
void Fill_PostElement(struct Geo_Element * GE, List_T * PE_L,
int Index, int Depth, int Skin, List_T * EvaluationPoints_L,
int DecomposeInSimplex)
int DecomposeInSimplex, int HighOrder)
{
struct PostElement * PE ;
int Nbr_EP, i_EP;
int Nbr_EP, i_EP, Type, NbrNodes;
if(!Depth){
......@@ -386,94 +387,130 @@ void Fill_PostElement(struct Geo_Element * GE, List_T * PE_L,
switch(GE->Type){
case POINT :
PE = Create_PostElement(Index, POINT, 1, 1) ; /* node 1 */
PE->NumNodes[0] = GE->NumNodes[0] ;
PE->u[0] = 0. ; PE->v[0] = 0. ; PE->w[0] = 0. ;
POS_CUT_FILL ;
break ;
PE = Create_PostElement(Index, POINT, 1, 1) ; /* node 1 */
PE->NumNodes[0] = GE->NumNodes[0] ;
PE->u[0] = 0. ; PE->v[0] = 0. ; PE->w[0] = 0. ;
POS_CUT_FILL ;
break ;
case LINE :
case LINE_2 :
PE = Create_PostElement(Index, LINE, 2, 1) ; /* nodes 1 2 */
PE->NumNodes[0] = GE->NumNodes[0] ;
PE->NumNodes[1] = GE->NumNodes[1] ;
PE->u[0] =-1. ; PE->v[0] = 0. ; PE->w[0] = 0. ;
PE->u[1] = 1. ; PE->v[1] = 0. ; PE->w[1] = 0. ;
POS_CUT_FILL ;
break ;
Type = (HighOrder) ? LINE_2 : LINE;
NbrNodes = (HighOrder) ? NbrNodes_Line_2 : NbrNodes_Line;
PE = Create_PostElement(Index, Type, NbrNodes, 1) ;
for(int i=0; i<NbrNodes; i++){
PE->NumNodes[i] = GE->NumNodes[i] ;
PE->u[i] = Nodes_Line_2[i][0] ;
PE->v[i] = Nodes_Line_2[i][1] ;
PE->w[i] = Nodes_Line_2[i][2] ;
}
POS_CUT_FILL ;
break ;
case LINE :
PE = Create_PostElement(Index, LINE, 2, 1) ; /* nodes 1 2 */
PE->NumNodes[0] = GE->NumNodes[0] ;
PE->NumNodes[1] = GE->NumNodes[1] ;
PE->u[0] =-1. ; PE->v[0] = 0. ; PE->w[0] = 0. ;
PE->u[1] = 1. ; PE->v[1] = 0. ; PE->w[1] = 0. ;
POS_CUT_FILL ;
break ;
case TRIANGLE :
case TRIANGLE_2 :
PE = Create_PostElement(Index, TRIANGLE, 3, 1) ; /* nodes 1 2 3 */
PE->NumNodes[0] = GE->NumNodes[0] ;
PE->NumNodes[1] = GE->NumNodes[1] ;
PE->NumNodes[2] = GE->NumNodes[2] ;
PE->u[0] = 0. ; PE->v[0] = 0. ; PE->w[0] = 0. ;
PE->u[1] = 1. ; PE->v[1] = 0. ; PE->w[1] = 0. ;
PE->u[2] = 0. ; PE->v[2] = 1. ; PE->w[2] = 0. ;
POS_CUT_FILL ;
break ;
Type = (HighOrder) ? TRIANGLE_2 : TRIANGLE;
NbrNodes = (HighOrder) ? NbrNodes_Triangle_2 : NbrNodes_Triangle;
PE = Create_PostElement(Index, Type, NbrNodes, 1) ;
for(int i=0; i<NbrNodes; i++){
PE->NumNodes[i] = GE->NumNodes[i] ;
PE->u[i] = Nodes_Triangle_2[i][0] ;
PE->v[i] = Nodes_Triangle_2[i][1] ;
PE->w[i] = Nodes_Triangle_2[i][2] ;
}
POS_CUT_FILL ;
break ;
case TRIANGLE :
PE = Create_PostElement(Index, TRIANGLE, 3, 1) ; /* nodes 1 2 3 */
PE->NumNodes[0] = GE->NumNodes[0] ;
PE->NumNodes[1] = GE->NumNodes[1] ;
PE->NumNodes[2] = GE->NumNodes[2] ;
PE->u[0] = 0. ; PE->v[0] = 0. ; PE->w[0] = 0. ;
PE->u[1] = 1. ; PE->v[1] = 0. ; PE->w[1] = 0. ;
PE->u[2] = 0. ; PE->v[2] = 1. ; PE->w[2] = 0. ;
POS_CUT_FILL ;
break ;
case QUADRANGLE :
case QUADRANGLE_2 :
case QUADRANGLE_2_8N:
if(DecomposeInSimplex){
PE = Create_PostElement(Index, TRIANGLE, 3, 1); /* nodes 1 2 4 */
PE->NumNodes[0] = GE->NumNodes[0] ;
PE->NumNodes[1] = GE->NumNodes[1] ;
PE->NumNodes[2] = GE->NumNodes[3] ;
PE->u[0] =-1. ; PE->v[0] =-1. ; PE->w[0] = 0. ;
PE->u[1] = 1. ; PE->v[1] =-1. ; PE->w[1] = 0. ;
PE->u[2] =-1. ; PE->v[2] = 1. ; PE->w[2] = 0. ;
POS_CUT_FILL;
if(DecomposeInSimplex){
PE = Create_PostElement(Index, TRIANGLE, 3, 1); /* nodes 1 2 4 */
PE->NumNodes[0] = GE->NumNodes[0] ;
PE->NumNodes[1] = GE->NumNodes[1] ;
PE->NumNodes[2] = GE->NumNodes[3] ;
PE->u[0] =-1. ; PE->v[0] =-1. ; PE->w[0] = 0. ;
PE->u[1] = 1. ; PE->v[1] =-1. ; PE->w[1] = 0. ;
PE->u[2] =-1. ; PE->v[2] = 1. ; PE->w[2] = 0. ;
POS_CUT_FILL;
PE = Create_PostElement(Index, TRIANGLE, 3, 1); /* nodes 2 3 4 */
PE->NumNodes[0] = GE->NumNodes[1] ;
PE->NumNodes[1] = GE->NumNodes[2] ;
PE->NumNodes[2] = GE->NumNodes[3] ;
PE->u[0] = 1. ; PE->v[0] =-1. ; PE->w[0] = 0. ;
PE->u[1] = 1. ; PE->v[1] = 1. ; PE->w[1] = 0. ;
PE->u[2] =-1. ; PE->v[2] = 1. ; PE->w[2] = 0. ;
POS_CUT_FILL;
}
else{
if (!EvaluationPoints_L) {
PE = Create_PostElement(Index, QUADRANGLE, 4, 1) ; /* nodes 1 2 3 4 */
PE->NumNodes[0] = GE->NumNodes[0] ;
PE->NumNodes[1] = GE->NumNodes[1] ;
PE->NumNodes[2] = GE->NumNodes[2] ;
PE->NumNodes[3] = GE->NumNodes[3] ;
PE->u[0] = -1. ; PE->v[0] = -1. ; PE->w[0] = 0. ;
PE->u[1] = 1. ; PE->v[1] = -1. ; PE->w[1] = 0. ;
PE->u[2] = 1. ; PE->v[2] = 1. ; PE->w[2] = 0. ;
PE->u[3] = -1. ; PE->v[3] = 1. ; PE->w[3] = 0. ;
}
else { /* Only for Quadrangles now, to be extended... */
Nbr_EP = List_Nbr(EvaluationPoints_L)/3;
PE = Create_PostElement(Index, QUADRANGLE, Nbr_EP, 1) ;
for (i_EP=0 ; i_EP<Nbr_EP ; i_EP++) {
List_Read(EvaluationPoints_L, i_EP*3+0, &PE->u[i_EP]);
List_Read(EvaluationPoints_L, i_EP*3+1, &PE->v[i_EP]);
List_Read(EvaluationPoints_L, i_EP*3+2, &PE->w[i_EP]);
}
}
POS_CUT_FILL ;
}
break ;
PE = Create_PostElement(Index, TRIANGLE, 3, 1); /* nodes 2 3 4 */
PE->NumNodes[0] = GE->NumNodes[1] ;
PE->NumNodes[1] = GE->NumNodes[2] ;
PE->NumNodes[2] = GE->NumNodes[3] ;
PE->u[0] = 1. ; PE->v[0] =-1. ; PE->w[0] = 0. ;
PE->u[1] = 1. ; PE->v[1] = 1. ; PE->w[1] = 0. ;
PE->u[2] =-1. ; PE->v[2] = 1. ; PE->w[2] = 0. ;
POS_CUT_FILL;
}
else{
if (!EvaluationPoints_L) {
PE = Create_PostElement(Index, QUADRANGLE, 4, 1) ; /* nodes 1 2 3 4 */
PE->NumNodes[0] = GE->NumNodes[0] ;
PE->NumNodes[1] = GE->NumNodes[1] ;
PE->NumNodes[2] = GE->NumNodes[2] ;
PE->NumNodes[3] = GE->NumNodes[3] ;
PE->u[0] = -1. ; PE->v[0] = -1. ; PE->w[0] = 0. ;
PE->u[1] = 1. ; PE->v[1] = -1. ; PE->w[1] = 0. ;
PE->u[2] = 1. ; PE->v[2] = 1. ; PE->w[2] = 0. ;
PE->u[3] = -1. ; PE->v[3] = 1. ; PE->w[3] = 0. ;
}
else { /* Only for Quadrangles now, to be extended... */
Nbr_EP = List_Nbr(EvaluationPoints_L)/3;
PE = Create_PostElement(Index, QUADRANGLE, Nbr_EP, 1) ;
for (i_EP=0 ; i_EP<Nbr_EP ; i_EP++) {
List_Read(EvaluationPoints_L, i_EP*3+0, &PE->u[i_EP]);
List_Read(EvaluationPoints_L, i_EP*3+1, &PE->v[i_EP]);
List_Read(EvaluationPoints_L, i_EP*3+2, &PE->w[i_EP]);
}
}
POS_CUT_FILL ;
}
break ;
case TETRAHEDRON_2 :
Type = (HighOrder) ? TETRAHEDRON_2 : TETRAHEDRON;
NbrNodes = (HighOrder) ? NbrNodes_Tetrahedron_2 : NbrNodes_Tetrahedron;
PE = Create_PostElement(Index, Type, NbrNodes, 1) ;
for(int i=0; i<NbrNodes; i++){
PE->NumNodes[i] = GE->NumNodes[i] ;
PE->u[i] = Nodes_Tetrahedron_2[i][0] ;
PE->v[i] = Nodes_Tetrahedron_2[i][1] ;
PE->w[i] = Nodes_Tetrahedron_2[i][2] ;
}
POS_CUT_FILL ;
break ;
case TETRAHEDRON :
case TETRAHEDRON_2 :
PE = Create_PostElement(Index, TETRAHEDRON, 4, 1) ; /* nodes 1 2 3 4 */
PE->NumNodes[0] = GE->NumNodes[0] ;
PE->NumNodes[1] = GE->NumNodes[1] ;
PE->NumNodes[2] = GE->NumNodes[2] ;
PE->NumNodes[3] = GE->NumNodes[3] ;
PE->u[0] = 0. ; PE->v[0] = 0. ; PE->w[0] = 0. ;
PE->u[1] = 1. ; PE->v[1] = 0. ; PE->w[1] = 0. ;
PE->u[2] = 0. ; PE->v[2] = 1. ; PE->w[2] = 0. ;
PE->u[3] = 0. ; PE->v[3] = 0. ; PE->w[3] = 1. ;
POS_CUT_FILL;
break ;
PE = Create_PostElement(Index, TETRAHEDRON, 4, 1) ; /* nodes 1 2 3 4 */
PE->NumNodes[0] = GE->NumNodes[0] ;
PE->NumNodes[1] = GE->NumNodes[1] ;
PE->NumNodes[2] = GE->NumNodes[2] ;
PE->NumNodes[3] = GE->NumNodes[3] ;
PE->u[0] = 0. ; PE->v[0] = 0. ; PE->w[0] = 0. ;
PE->u[1] = 1. ; PE->v[1] = 0. ; PE->w[1] = 0. ;
PE->u[2] = 0. ; PE->v[2] = 1. ; PE->w[2] = 0. ;
PE->u[3] = 0. ; PE->v[3] = 0. ; PE->w[3] = 1. ;
POS_CUT_FILL;
break ;
case HEXAHEDRON :
if(DecomposeInSimplex){
......
......@@ -27,7 +27,7 @@ struct PostElement * PartialCopy_PostElement(struct PostElement *PostElement);
void Fill_PostElement(struct Geo_Element *GE, List_T *PostElement_L,
int Index, int Depth, int Skin, List_T * EvaluationPoints_L,
int DecomposeInSimplex) ;
int DecomposeInSimplex, int HighOrder) ;
void Cut_PostElement(struct PostElement * PE, struct Geo_Element * GE,
List_T * PE_L, int Index, int Depth, int Skin,
int DecomposeInSimplex) ;
......
......@@ -31,7 +31,7 @@
extern struct Problem Problem_S ;
extern struct CurrentData Current ;
extern int Flag_BIN ;
extern int Flag_BIN, Flag_GMSH_VERSION;
extern FILE *PostStream ;
......@@ -338,7 +338,7 @@ void Pos_PrintOnElementsOf(struct PostQuantity *NCPQ_P,
Fill_PostElement(Element.GeoElement, PostElement_L, iGeo,
Depth, PSO_P->Skin,
PSO_P->EvaluationPoints,
DecomposeInSimplex) ;
DecomposeInSimplex, 0) ;
}
Message::ProgressMeter(iGeo + 1, NbrGeo, "Post-processing (Generate)");
if(Message::GetErrorCount()) break;
......@@ -406,10 +406,11 @@ void Pos_PrintOnElementsOf(struct PostQuantity *NCPQ_P,
(Group_P->Type == ELEMENTLIST &&
Check_IsEntityInExtendedGroup(Group_P, Element.GeoElement->Num, 0))
) {
int HighOrder = (PSO_P->Format == FORMAT_GMSH && (PSO_P->StoreInField >= 0 || PSO_P->StoreInMeshBasedField >= 0 || Flag_GMSH_VERSION == 2 || Flag_BIN)) ? 1 : 0;
Fill_PostElement(Element.GeoElement, PostElement_L, iGeo,
PSO_P->Depth, PSO_P->Skin,
PSO_P->EvaluationPoints,
DecomposeInSimplex) ;
DecomposeInSimplex, HighOrder) ;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment