"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "Kernel/Get_DofOfElement.cpp" between
getdp-3.4.0-source.tgz and getdp-3.5.0-source.tgz

About: GetDP is a general finite element solver using mixed elements to discretize de Rham-type complexes in one, two and three dimensions.

Get_DofOfElement.cpp  (getdp-3.4.0-source.tgz):Get_DofOfElement.cpp  (getdp-3.5.0-source.tgz)
// GetDP - Copyright (C) 1997-2021 P. Dular and C. Geuzaine, University of Liege // GetDP - Copyright (C) 1997-2022 P. Dular and C. Geuzaine, University of Liege
// //
// See the LICENSE.txt file for license information. Please report all // See the LICENSE.txt file for license information. Please report all
// issues on https://gitlab.onelab.info/getdp/getdp/issues. // issues on https://gitlab.onelab.info/getdp/getdp/issues.
#include <stdlib.h> #include <stdlib.h>
#include "ProData.h" #include "ProData.h"
#include "GeoData.h" #include "GeoData.h"
#include "DofData.h" #include "DofData.h"
#include "Get_DofOfElement.h" #include "Get_DofOfElement.h"
#include "Get_ConstraintOfElement.h" #include "Get_ConstraintOfElement.h"
#include "ExtendedGroup.h" #include "ExtendedGroup.h"
#include "Cal_Quantity.h" #include "Cal_Quantity.h"
#include "Message.h" #include "Message.h"
extern struct Problem Problem_S ; extern struct Problem Problem_S;
extern struct CurrentData Current ; extern struct CurrentData Current;
extern int TreatmentStatus ; extern int TreatmentStatus;
extern double Flag_ORDER ; extern double Flag_ORDER;
extern List_T *PreResolutionIndex_L ; extern List_T *PreResolutionIndex_L;
struct BasisFunction * BasisFunction_P ; struct BasisFunction *BasisFunction_P;
int Nbr_ElementaryBF, Flag_SubSpace ; int Nbr_ElementaryBF, Flag_SubSpace;
struct Group * GroupSupport_P, * GroupEntity_P ; struct Group *GroupSupport_P, *GroupEntity_P;
/* ------------------------------------------------------------------------ */ /* ------------------------------------------------------------------------ */
/* G e t _ I n i t D o f O f E l e m e n t */ /* G e t _ I n i t D o f O f E l e m e n t */
/* ------------------------------------------------------------------------ */ /* ------------------------------------------------------------------------ */
void Get_InitDofOfElement(struct Element * Element) void Get_InitDofOfElement(struct Element *Element)
{ {
Element->ElementTrace = NULL ; Element->ElementTrace = NULL;
Element->NumLastElementForNodesCoordinates = -1 ; Element->NumLastElementForNodesCoordinates = -1;
Element->NumLastElementForGroupsOfEntities = -1 ; Element->NumLastElementForGroupsOfEntities = -1;
Element->NumLastElementForSolidAngle = -1 ; Element->NumLastElementForSolidAngle = -1;
Element->NumLastElementForSortedNodesByFacet = -1 ; Element->NumLastElementForSortedNodesByFacet = -1;
} }
/* ------------------------------------------------------------------------ */ /* ------------------------------------------------------------------------ */
/* G e t _ D o f O f E l e m e n t */ /* G e t _ D o f O f E l e m e n t */
/* ------------------------------------------------------------------------ */ /* ------------------------------------------------------------------------ */
void Get_DofOfElement(struct Element * Element, void Get_DofOfElement(struct Element *Element,
struct FunctionSpace * FunctionSpace_P, struct FunctionSpace *FunctionSpace_P,
struct QuantityStorage * QuantityStorage_P, struct QuantityStorage *QuantityStorage_P,
List_T * BasisFunctionIndex_L) List_T *BasisFunctionIndex_L)
{ {
struct BasisFunction * BasisFunction_P0 ; struct BasisFunction *BasisFunction_P0;
int Nbr_BasisFunction, Nbr_BasisFunctionAll, i_BFunction, StartingIndex, i ; int Nbr_BasisFunction, Nbr_BasisFunctionAll, i_BFunction, StartingIndex, i;
int * BasisFunctionIndex_P0 = NULL ; int *BasisFunctionIndex_P0 = NULL;
Current.Element = Element ; Current.Element = Element;
Nbr_ElementaryBF = 0 ; Nbr_ElementaryBF = 0;
/* Get the SubSpace */ /* Get the SubSpace */
Nbr_BasisFunctionAll = List_Nbr(FunctionSpace_P->BasisFunction) ; Nbr_BasisFunctionAll = List_Nbr(FunctionSpace_P->BasisFunction);
BasisFunction_P0 = (Nbr_BasisFunctionAll) ? BasisFunction_P0 =
(struct BasisFunction*)List_Pointer(FunctionSpace_P->BasisFunction, 0) : NUL (Nbr_BasisFunctionAll) ?
L ; (struct BasisFunction *)List_Pointer(FunctionSpace_P->BasisFunction, 0) :
NULL;
if (!BasisFunctionIndex_L) {
Flag_SubSpace = 0 ; if(!BasisFunctionIndex_L) {
Nbr_BasisFunction = Nbr_BasisFunctionAll ; Flag_SubSpace = 0;
Nbr_BasisFunction = Nbr_BasisFunctionAll;
} }
else { else {
Flag_SubSpace = 1 ; Flag_SubSpace = 1;
Nbr_BasisFunction = List_Nbr(BasisFunctionIndex_L) ; Nbr_BasisFunction = List_Nbr(BasisFunctionIndex_L);
BasisFunctionIndex_P0 = (Nbr_BasisFunction) ? BasisFunctionIndex_P0 =
(int*)List_Pointer(BasisFunctionIndex_L, 0) : NULL ; (Nbr_BasisFunction) ? (int *)List_Pointer(BasisFunctionIndex_L, 0) : NULL;
} }
/* Set the DofData if explicitely specified */ /* Set the DofData if explicitely specified */
switch (TreatmentStatus) { switch(TreatmentStatus) {
case STATUS_CAL : case STATUS_POS : case STATUS_CAL:
case STATUS_POS:
if(QuantityStorage_P->DefineQuantity->DofData) if(QuantityStorage_P->DefineQuantity->DofData)
FunctionSpace_P->DofData = QuantityStorage_P->DefineQuantity->DofData ; FunctionSpace_P->DofData = QuantityStorage_P->DefineQuantity->DofData;
else else
FunctionSpace_P->DofData = FunctionSpace_P->MainDofData ; FunctionSpace_P->DofData = FunctionSpace_P->MainDofData;
break; break;
} }
/* For each subset of Basis Functions */ /* For each subset of Basis Functions */
for (i = 0 ; i < Nbr_BasisFunction ; i++) { for(i = 0; i < Nbr_BasisFunction; i++) {
i_BFunction = (!Flag_SubSpace) ? i : BasisFunctionIndex_P0[i];
i_BFunction = (!Flag_SubSpace)? i : BasisFunctionIndex_P0[i] ; BasisFunction_P = BasisFunction_P0 + i_BFunction;
GroupSupport_P = (struct Group *)List_Pointer(
BasisFunction_P = BasisFunction_P0 + i_BFunction ; Problem_S.Group, BasisFunction_P->SupportIndex);
GroupSupport_P = (struct Group*)
List_Pointer(Problem_S.Group, BasisFunction_P->SupportIndex) ;
/* If the BasisFunction exists for this kind of element /* If the BasisFunction exists for this kind of element
the interpolation order is lower or equal to the maximum order allowed the interpolation order is lower or equal to the maximum order allowed
the element is in the support of the BasisFunction */ the element is in the support of the BasisFunction */
if ( ( BasisFunction_P->ElementType & Current.Element->Type ) if((BasisFunction_P->ElementType & Current.Element->Type) &&
&& (Flag_ORDER < 0. || BasisFunction_P->Order <= Flag_ORDER) &&
( Flag_ORDER < 0. || BasisFunction_P->Order <= Flag_ORDER ) ((GroupSupport_P->Type == REGIONLIST &&
&& List_Search(GroupSupport_P->InitialList, &Element->Region,
( (GroupSupport_P->Type == REGIONLIST && fcmp_int)) ||
List_Search(GroupSupport_P->InitialList, &Element->Region, fcmp_int)) (GroupSupport_P->Type == ELEMENTLIST &&
|| Check_IsEntityInExtendedGroup(GroupSupport_P, Element->Num, 0)))) {
(GroupSupport_P->Type == ELEMENTLIST && GroupEntity_P = (struct Group *)List_Pointer(
Check_IsEntityInExtendedGroup(GroupSupport_P, Element->Num, 0)) ) ) { Problem_S.Group, BasisFunction_P->EntityIndex);
GroupEntity_P = (struct Group*) switch(GroupEntity_P->FunctionType) {
List_Pointer(Problem_S.Group, BasisFunction_P->EntityIndex) ; case NODESOF:
Get_CodesOfElement(
switch (GroupEntity_P->FunctionType) { FunctionSpace_P, QuantityStorage_P, Element->GeoElement->NbrNodes,
Element->GeoElement->NumNodes, 0, i_BFunction, NODESOF, NULL);
case NODESOF : break;
Get_CodesOfElement
(FunctionSpace_P, QuantityStorage_P, case EDGESOF:
Element->GeoElement->NbrNodes, Element->GeoElement->NumNodes, case EDGESOFTREEIN:
0, i_BFunction, NODESOF, NULL) ; if(Element->GeoElement->NbrEdges == 0)
break ; Geo_CreateEdgesOfElement(Element->GeoElement);
Get_CodesOfElement(
case EDGESOF : case EDGESOFTREEIN : FunctionSpace_P, QuantityStorage_P, Element->GeoElement->NbrEdges,
if (Element->GeoElement->NbrEdges == 0) Element->GeoElement->NumEdges, 0, i_BFunction, EDGESOF, NULL);
Geo_CreateEdgesOfElement(Element->GeoElement) ; break;
Get_CodesOfElement
(FunctionSpace_P, QuantityStorage_P, case FACETSOF:
Element->GeoElement->NbrEdges, Element->GeoElement->NumEdges, case FACETSOFTREEIN:
0, i_BFunction, EDGESOF, NULL) ; if(Element->GeoElement->NbrEdges == 0)
break ; Geo_CreateEdgesOfElement(Element->GeoElement);
if(Element->GeoElement->NbrFacets == 0)
case FACETSOF : case FACETSOFTREEIN : Geo_CreateFacetsOfElement(Element->GeoElement);
if (Element->GeoElement->NbrEdges == 0) Get_CodesOfElement(
Geo_CreateEdgesOfElement(Element->GeoElement) ; FunctionSpace_P, QuantityStorage_P, Element->GeoElement->NbrFacets,
if (Element->GeoElement->NbrFacets == 0) Element->GeoElement->NumFacets, 0, i_BFunction, FACETSOF, NULL);
Geo_CreateFacetsOfElement(Element->GeoElement) ; break;
Get_CodesOfElement
(FunctionSpace_P, QuantityStorage_P, case VOLUMESOF:
Element->GeoElement->NbrFacets, Element->GeoElement->NumFacets, Get_CodesOfElement(FunctionSpace_P, QuantityStorage_P, 1,
0, i_BFunction, FACETSOF, NULL) ; &Element->GeoElement->Num, 0, i_BFunction, VOLUMESOF,
break ; NULL);
break;
case VOLUMESOF :
Get_CodesOfElement(FunctionSpace_P, QuantityStorage_P, case GROUPSOFNODESOF:
1, &Element->GeoElement->Num, Get_GroupsOfElementaryEntitiesOfElement(
0, i_BFunction, VOLUMESOF, NULL) ; Element, &StartingIndex, Element->GeoElement->NbrNodes,
break ; Element->GeoElement->NumNodes, BasisFunction_P);
Get_CodesOfElement(
case GROUPSOFNODESOF : FunctionSpace_P, QuantityStorage_P, Element->NbrGroupsOfEntities,
Get_GroupsOfElementaryEntitiesOfElement Element->NumGroupsOfEntities, StartingIndex, i_BFunction,
(Element, &StartingIndex, GROUPSOFNODESOF, Element->NumSubFunction[1]);
Element->GeoElement->NbrNodes, Element->GeoElement->NumNodes, break;
BasisFunction_P) ;
Get_CodesOfElement case GROUPSOFEDGESONNODESOF:
(FunctionSpace_P, QuantityStorage_P, if(Element->GeoElement->NbrEdges == 0)
Element->NbrGroupsOfEntities, Element->NumGroupsOfEntities, Geo_CreateEdgesOfElement(Element->GeoElement);
StartingIndex, i_BFunction, GROUPSOFNODESOF, Element->NumSubFunction[1 Get_GroupsOfEdgesOnNodesOfElement(Element, &StartingIndex);
]) ; Get_CodesOfElement(FunctionSpace_P, QuantityStorage_P,
break ; Element->NbrGroupsOfEntities,
Element->NumGroupsOfEntities, StartingIndex,
case GROUPSOFEDGESONNODESOF : i_BFunction, GROUPSOFEDGESONNODESOF, NULL);
if (Element->GeoElement->NbrEdges == 0) break;
Geo_CreateEdgesOfElement(Element->GeoElement) ;
Get_GroupsOfEdgesOnNodesOfElement(Element, &StartingIndex) ; case GROUPSOFEDGESOF:
Get_CodesOfElement if(Element->GeoElement->NbrEdges == 0)
(FunctionSpace_P, QuantityStorage_P, Geo_CreateEdgesOfElement(Element->GeoElement);
Element->NbrGroupsOfEntities, Element->NumGroupsOfEntities, Get_GroupsOfElementaryEntitiesOfElement(
StartingIndex, i_BFunction, GROUPSOFEDGESONNODESOF, NULL) ; Element, &StartingIndex, Element->GeoElement->NbrEdges,
break ; Element->GeoElement->NumEdges, BasisFunction_P);
Get_CodesOfElement(FunctionSpace_P, QuantityStorage_P,
case GROUPSOFEDGESOF : Element->NbrGroupsOfEntities,
if (Element->GeoElement->NbrEdges == 0) Element->NumGroupsOfEntities, StartingIndex,
Geo_CreateEdgesOfElement(Element->GeoElement) ; i_BFunction, GROUPSOFEDGESOF, NULL);
Get_GroupsOfElementaryEntitiesOfElement break;
(Element, &StartingIndex,
Element->GeoElement->NbrEdges, Element->GeoElement->NumEdges, case GROUPSOFFACETSOF:
BasisFunction_P) ; if(Element->GeoElement->NbrFacets == 0)
Get_CodesOfElement Geo_CreateFacetsOfElement(Element->GeoElement);
(FunctionSpace_P, QuantityStorage_P, Get_GroupsOfElementaryEntitiesOfElement(
Element->NbrGroupsOfEntities, Element->NumGroupsOfEntities, Element, &StartingIndex, Element->GeoElement->NbrFacets,
StartingIndex, i_BFunction, GROUPSOFEDGESOF, NULL) ; Element->GeoElement->NumFacets, BasisFunction_P);
break ; Get_CodesOfElement(FunctionSpace_P, QuantityStorage_P,
Element->NbrGroupsOfEntities,
case GROUPSOFFACETSOF : Element->NumGroupsOfEntities, StartingIndex,
if (Element->GeoElement->NbrFacets == 0) i_BFunction, GROUPSOFFACETSOF, NULL);
Geo_CreateFacetsOfElement(Element->GeoElement) ; break;
Get_GroupsOfElementaryEntitiesOfElement
(Element, &StartingIndex, case REGION:
Element->GeoElement->NbrFacets, Element->GeoElement->NumFacets, Get_RegionForElement(Element, &StartingIndex, BasisFunction_P);
BasisFunction_P) ; Get_CodesOfElement(FunctionSpace_P, QuantityStorage_P,
Get_CodesOfElement Element->NbrGroupsOfEntities,
(FunctionSpace_P, QuantityStorage_P, Element->NumGroupsOfEntities, StartingIndex,
Element->NbrGroupsOfEntities, Element->NumGroupsOfEntities, i_BFunction, REGION, Element->NumSubFunction[1]);
StartingIndex, i_BFunction, GROUPSOFFACETSOF, NULL) ; break;
break ;
case GROUPOFREGIONSOF:
case REGION : Get_GroupOfRegionsForElement(Element, &StartingIndex, BasisFunction_P);
Get_RegionForElement(Element, &StartingIndex, BasisFunction_P) ; Get_CodesOfElement(
Get_CodesOfElement FunctionSpace_P, QuantityStorage_P, Element->NbrGroupsOfEntities,
(FunctionSpace_P, QuantityStorage_P, Element->NumGroupsOfEntities, StartingIndex, i_BFunction,
Element->NbrGroupsOfEntities, Element->NumGroupsOfEntities, GROUPOFREGIONSOF, Element->NumSubFunction[1]);
StartingIndex, i_BFunction, REGION, Element->NumSubFunction[1]) ; break;
break ;
case GLOBAL:
case GROUPOFREGIONSOF : Get_GlobalForElement(Element, &StartingIndex, BasisFunction_P);
Get_GroupOfRegionsForElement(Element, &StartingIndex, BasisFunction_P) ; Get_CodesOfElement(FunctionSpace_P, QuantityStorage_P,
Get_CodesOfElement Element->NbrGroupsOfEntities,
(FunctionSpace_P, QuantityStorage_P, Element->NumGroupsOfEntities, StartingIndex,
Element->NbrGroupsOfEntities, Element->NumGroupsOfEntities, i_BFunction, GLOBAL, NULL);
StartingIndex, i_BFunction, GROUPOFREGIONSOF, Element->NumSubFunction break;
[1]) ;
break ;
case GLOBAL :
Get_GlobalForElement(Element, &StartingIndex, BasisFunction_P) ;
Get_CodesOfElement
(FunctionSpace_P, QuantityStorage_P,
Element->NbrGroupsOfEntities, Element->NumGroupsOfEntities,
StartingIndex, i_BFunction, GLOBAL, NULL) ;
break ;
} }
} /* if Region ... */ } /* if Region ... */
} /* for i ... */ } /* for i ... */
QuantityStorage_P->NbrElementaryBasisFunction = Nbr_ElementaryBF ; QuantityStorage_P->NbrElementaryBasisFunction = Nbr_ElementaryBF;
} }
/* ------------------------------------------------------------------------ */ /* ------------------------------------------------------------------------ */
/* G e t _ G r o u p s O f E l e m e n t a r y E n t i t i e s */ /* G e t _ G r o u p s O f E l e m e n t a r y E n t i t i e s */
/* O f E l e m e n t */ /* O f E l e m e n t */
/* ------------------------------------------------------------------------ */ /* ------------------------------------------------------------------------ */
void Get_GroupsOfElementaryEntitiesOfElement void Get_GroupsOfElementaryEntitiesOfElement(
(struct Element * Element, struct Element *Element, int *StartingIndex, int Nbr_ElementaryEntities,
int * StartingIndex, int Nbr_ElementaryEntities, int Num_ElementaryEntities[] int Num_ElementaryEntities[], struct BasisFunction *BasisFunction_P)
,
struct BasisFunction * BasisFunction_P)
{ {
/* external input/output : GroupEntity_P : In */ /* external input/output : GroupEntity_P : In */
int i, j, Num_Entity, Nbr_SubFunction, i_SF ; int i, j, Num_Entity, Nbr_SubFunction, i_SF;
struct TwoInt * Key_P ; struct TwoInt *Key_P;
if (Element->NumLastElementForGroupsOfEntities != Element->Num) { if(Element->NumLastElementForGroupsOfEntities != Element->Num) {
Element->NumLastElementForGroupsOfEntities = Element->Num ; Element->NumLastElementForGroupsOfEntities = Element->Num;
Element->NbrGroupsOfEntities = 0 ; Element->NbrGroupsOfEntities = 0;
} }
*StartingIndex = Element->NbrGroupsOfEntities ; *StartingIndex = Element->NbrGroupsOfEntities;
if (GroupEntity_P->ExtendedList == NULL) Generate_ExtendedGroup(GroupEntity_P)
;
for (i = 0 ; i < Nbr_ElementaryEntities ; i++) { if(GroupEntity_P->ExtendedList == NULL) Generate_ExtendedGroup(GroupEntity_P);
Num_Entity = abs(Num_ElementaryEntities[i]) ;
for (std::multimap<int, TwoInt>::iterator it = for(i = 0; i < Nbr_ElementaryEntities; i++) {
GroupEntity_P->ExtendedListForSearch.lower_bound(Num_Entity); Num_Entity = abs(Num_ElementaryEntities[i]);
it != GroupEntity_P->ExtendedListForSearch.upper_bound(Num_Entity); ++i
t) {
for(std::multimap<int, TwoInt>::iterator it =
GroupEntity_P->ExtendedListForSearch.lower_bound(Num_Entity);
it != GroupEntity_P->ExtendedListForSearch.upper_bound(Num_Entity);
++it) {
Key_P = &it->second; Key_P = &it->second;
j = *StartingIndex ; j = *StartingIndex;
while ((j < Element->NbrGroupsOfEntities) && while((j < Element->NbrGroupsOfEntities) &&
(Element->NumGroupsOfEntities[j] != Key_P->Int2)) j++ ; (Element->NumGroupsOfEntities[j] != Key_P->Int2))
j++;
if (!BasisFunction_P->SubFunction) {
if (j == Element->NbrGroupsOfEntities) { if(!BasisFunction_P->SubFunction) {
Element->NumSubFunction[1][j] = 0 ; if(j == Element->NbrGroupsOfEntities) {
Element->NumSubFunction[0][j] = -1 ; Element->NumSubFunction[1][j] = 0;
Element->NumGroupsOfEntities[j] = Key_P->Int2 ; Element->NumSubFunction[0][j] = -1;
Element->NbrEntitiesInGroups[Element->NbrGroupsOfEntities++] = 0 ; Element->NumGroupsOfEntities[j] = Key_P->Int2;
if(Element->NbrGroupsOfEntities >= NBR_MAX_GROUPS_IN_ELEMENT - 1){ Element->NbrEntitiesInGroups[Element->NbrGroupsOfEntities++] = 0;
if(Element->NbrGroupsOfEntities >= NBR_MAX_GROUPS_IN_ELEMENT - 1) {
Message::Error("Reached limit number of groups of entities"); Message::Error("Reached limit number of groups of entities");
return; return;
} }
} }
Element->NumEntitiesInGroups[j][Element->NbrEntitiesInGroups[j]++] = Element->NumEntitiesInGroups[j][Element->NbrEntitiesInGroups[j]++] =
(Key_P->Int1 > 0)? (i+1) : -(i+1) ; (Key_P->Int1 > 0) ? (i + 1) : -(i + 1);
} }
else { /* For SubFunctions (basis functions for a global function) */ else { /* For SubFunctions (basis functions for a global function) */
Nbr_SubFunction = List_Nbr(BasisFunction_P->SubFunction) ; Nbr_SubFunction = List_Nbr(BasisFunction_P->SubFunction);
if (j == Element->NbrGroupsOfEntities) { if(j == Element->NbrGroupsOfEntities) {
for (i_SF = 0 ; i_SF < Nbr_SubFunction ; i_SF++) { for(i_SF = 0; i_SF < Nbr_SubFunction; i_SF++) {
Element->NumSubFunction[1][j+i_SF] = i_SF ; Element->NumSubFunction[1][j + i_SF] = i_SF;
Element->NumSubFunction[0][j+i_SF] = Element->NumSubFunction[0][j + i_SF] =
*((int *)List_Pointer(BasisFunction_P->SubFunction, i_SF)) ; *((int *)List_Pointer(BasisFunction_P->SubFunction, i_SF));
if (BasisFunction_P->SubdFunction) if(BasisFunction_P->SubdFunction)
Element->NumSubFunction[2][j+i_SF] = Element->NumSubFunction[2][j + i_SF] =
*((int *)List_Pointer(BasisFunction_P->SubdFunction, i_SF)) ; *((int *)List_Pointer(BasisFunction_P->SubdFunction, i_SF));
Element->NumGroupsOfEntities[j+i_SF] = Key_P->Int2 ; Element->NumGroupsOfEntities[j + i_SF] = Key_P->Int2;
Element->NbrEntitiesInGroups[Element->NbrGroupsOfEntities++] = 0 ; Element->NbrEntitiesInGroups[Element->NbrGroupsOfEntities++] = 0;
if(Element->NbrGroupsOfEntities >= NBR_MAX_GROUPS_IN_ELEMENT - 1){ if(Element->NbrGroupsOfEntities >= NBR_MAX_GROUPS_IN_ELEMENT - 1) {
Message::Error("Reached limit number of groups of entities"); Message::Error("Reached limit number of groups of entities");
return; return;
} }
} }
} }
for (i_SF = 0 ; i_SF < Nbr_SubFunction ; i_SF++) for(i_SF = 0; i_SF < Nbr_SubFunction; i_SF++)
Element->NumEntitiesInGroups[j+i_SF][Element->NbrEntitiesInGroups[j+i_S Element
F]++] = ->NumEntitiesInGroups[j + i_SF]
(Key_P->Int1 > 0)? (i+1) : -(i+1) ; [Element->NbrEntitiesInGroups[j + i_SF]++] =
(Key_P->Int1 > 0) ? (i + 1) : -(i + 1);
} }
} }
} }
} }
/* ------------------------------------------------------------------------ */ /* ------------------------------------------------------------------------ */
/* G e t _ G r o u p s O f E d g e s O n N o d e s O f E l e m e n t */ /* G e t _ G r o u p s O f E d g e s O n N o d e s O f E l e m e n t */
/* ------------------------------------------------------------------------ */ /* ------------------------------------------------------------------------ */
void Get_GroupsOfEdgesOnNodesOfElement(struct Element * Element, void Get_GroupsOfEdgesOnNodesOfElement(struct Element *Element,
int * StartingIndex) int *StartingIndex)
{ {
/* external input/output : GroupEntity_P : In */ /* external input/output : GroupEntity_P : In */
int i, j, Num_Edge, * Num_Nodes, Num_Node ; int i, j, Num_Edge, *Num_Nodes, Num_Node;
if (Element->NumLastElementForGroupsOfEntities != Element->Num) {
Element->NumLastElementForGroupsOfEntities = Element->Num ;
Element->NbrGroupsOfEntities = 0 ;
}
*StartingIndex = Element->NbrGroupsOfEntities ;
if (GroupEntity_P->ExtendedList == NULL) Generate_ExtendedGroup(GroupEntity_P)
;
for (i = 0 ; i < Element->GeoElement->NbrEdges ; i++) { if(Element->NumLastElementForGroupsOfEntities != Element->Num) {
Num_Edge = abs(Element->GeoElement->NumEdges[i]) ; Element->NumLastElementForGroupsOfEntities = Element->Num;
if (List_Search(GroupEntity_P->ExtendedList, &Num_Edge, fcmp_int )) { Element->NbrGroupsOfEntities = 0;
}
Num_Nodes = Geo_GetNodesOfEdgeInElement(Element->GeoElement, i) ;
*StartingIndex = Element->NbrGroupsOfEntities;
Num_Node = Element->GeoElement->NumNodes[abs(Num_Nodes[0])-1] ;
j = *StartingIndex ; if(GroupEntity_P->ExtendedList == NULL) Generate_ExtendedGroup(GroupEntity_P);
while ((j < Element->NbrGroupsOfEntities) &&
(Element->NumGroupsOfEntities[j] != Num_Node)) j++ ; for(i = 0; i < Element->GeoElement->NbrEdges; i++) {
if (j == Element->NbrGroupsOfEntities) { Num_Edge = abs(Element->GeoElement->NumEdges[i]);
Element->NumGroupsOfEntities[Element->NbrGroupsOfEntities++] = Num_Node ; if(List_Search(GroupEntity_P->ExtendedList, &Num_Edge, fcmp_int)) {
if(Element->NbrGroupsOfEntities >= NBR_MAX_GROUPS_IN_ELEMENT - 1){ Num_Nodes = Geo_GetNodesOfEdgeInElement(Element->GeoElement, i);
Num_Node = Element->GeoElement->NumNodes[abs(Num_Nodes[0]) - 1];
j = *StartingIndex;
while((j < Element->NbrGroupsOfEntities) &&
(Element->NumGroupsOfEntities[j] != Num_Node))
j++;
if(j == Element->NbrGroupsOfEntities) {
Element->NumGroupsOfEntities[Element->NbrGroupsOfEntities++] = Num_Node;
if(Element->NbrGroupsOfEntities >= NBR_MAX_GROUPS_IN_ELEMENT - 1) {
Message::Error("Reached limit number of groups of entities"); Message::Error("Reached limit number of groups of entities");
return; return;
} }
Element->NbrEntitiesInGroups[j] = 0 ; Element->NbrEntitiesInGroups[j] = 0;
} }
Element->NumEntitiesInGroups[j] [Element->NbrEntitiesInGroups[j]++] = Element->NumEntitiesInGroups[j][Element->NbrEntitiesInGroups[j]++] =
(Element->GeoElement->NumEdges[i] > 0)? -(i+1) : (i+1) ; (Element->GeoElement->NumEdges[i] > 0) ? -(i + 1) : (i + 1);
/*- edge /*- edge
node 1 o--->---o node 2 => (Phi2 - Phi1) s12 ... node 1 o--->---o node 2 => (Phi2 - Phi1) s12 ...
-> minus sign associated with node 1 for positive edge from node 1 to nod -> minus sign associated with node 1 for positive edge from node 1 to node 2
e 2
*/ */
Num_Node = Element->GeoElement->NumNodes[abs(Num_Nodes[1])-1] ; Num_Node = Element->GeoElement->NumNodes[abs(Num_Nodes[1]) - 1];
j = *StartingIndex ; j = *StartingIndex;
while ((j < Element->NbrGroupsOfEntities) && while((j < Element->NbrGroupsOfEntities) &&
(Element->NumGroupsOfEntities[j] != Num_Node)) j++ ; (Element->NumGroupsOfEntities[j] != Num_Node))
if (j == Element->NbrGroupsOfEntities) { j++;
Element->NumGroupsOfEntities[Element->NbrGroupsOfEntities++] = Num_Node ; if(j == Element->NbrGroupsOfEntities) {
if(Element->NbrGroupsOfEntities >= NBR_MAX_GROUPS_IN_ELEMENT - 1){ Element->NumGroupsOfEntities[Element->NbrGroupsOfEntities++] = Num_Node;
if(Element->NbrGroupsOfEntities >= NBR_MAX_GROUPS_IN_ELEMENT - 1) {
Message::Error("Reached limit number of groups of entities"); Message::Error("Reached limit number of groups of entities");
return; return;
} }
Element->NbrEntitiesInGroups[j] = 0 ; Element->NbrEntitiesInGroups[j] = 0;
} }
Element->NumEntitiesInGroups[j] [Element->NbrEntitiesInGroups[j]++] = Element->NumEntitiesInGroups[j][Element->NbrEntitiesInGroups[j]++] =
(Element->GeoElement->NumEdges[i] > 0)? (i+1) : -(i+1) ; (Element->GeoElement->NumEdges[i] > 0) ? (i + 1) : -(i + 1);
} }
} }
} }
/* ------------------------------------------------------------------------ */ /* ------------------------------------------------------------------------ */
/* G e t _ R e g i o n F o r E l e m e n t */ /* G e t _ R e g i o n F o r E l e m e n t */
/* ------------------------------------------------------------------------ */ /* ------------------------------------------------------------------------ */
void Get_RegionForElement(struct Element * Element, int * StartingIndex, void Get_RegionForElement(struct Element *Element, int *StartingIndex,
struct BasisFunction * BasisFunction_P) struct BasisFunction *BasisFunction_P)
{ {
int Nbr_SubFunction, i_SF ; int Nbr_SubFunction, i_SF;
if (Element->NumLastElementForGroupsOfEntities != Element->Num) { if(Element->NumLastElementForGroupsOfEntities != Element->Num) {
Element->NumLastElementForGroupsOfEntities = Element->Num ; Element->NumLastElementForGroupsOfEntities = Element->Num;
Element->NbrGroupsOfEntities = 0 ; Element->NbrGroupsOfEntities = 0;
} }
*StartingIndex = Element->NbrGroupsOfEntities ; *StartingIndex = Element->NbrGroupsOfEntities;
if (!BasisFunction_P->SubFunction) { if(!BasisFunction_P->SubFunction) {
Element->NumSubFunction[1][Element->NbrGroupsOfEntities] = 0 ; Element->NumSubFunction[1][Element->NbrGroupsOfEntities] = 0;
Element->NumSubFunction[0][Element->NbrGroupsOfEntities] = -1 ; Element->NumSubFunction[0][Element->NbrGroupsOfEntities] = -1;
Element->NumGroupsOfEntities[Element->NbrGroupsOfEntities++] = Element->Regi Element->NumGroupsOfEntities[Element->NbrGroupsOfEntities++] =
on ; Element->Region;
if(Element->NbrGroupsOfEntities >= NBR_MAX_GROUPS_IN_ELEMENT - 1){ if(Element->NbrGroupsOfEntities >= NBR_MAX_GROUPS_IN_ELEMENT - 1) {
Message::Error("Reached limit number of groups of entities"); Message::Error("Reached limit number of groups of entities");
return; return;
} }
} }
else { /* For SubFunctions (basis functions for a global function) */ else { /* For SubFunctions (basis functions for a global function) */
Nbr_SubFunction = List_Nbr(BasisFunction_P->SubFunction) ; Nbr_SubFunction = List_Nbr(BasisFunction_P->SubFunction);
for (i_SF = 0 ; i_SF < Nbr_SubFunction ; i_SF++) { for(i_SF = 0; i_SF < Nbr_SubFunction; i_SF++) {
Element->NumSubFunction[1][Element->NbrGroupsOfEntities] = i_SF ; /* Index Element->NumSubFunction[1][Element->NbrGroupsOfEntities] =
SF */ i_SF; /* Index SF */
Element->NumSubFunction[0][Element->NbrGroupsOfEntities] = Element->NumSubFunction[0][Element->NbrGroupsOfEntities] =
*((int *)List_Pointer(BasisFunction_P->SubFunction, i_SF)) ; /* Index Exp *((int *)List_Pointer(BasisFunction_P->SubFunction,
ression */ i_SF)); /* Index Expression */
if (BasisFunction_P->SubdFunction) if(BasisFunction_P->SubdFunction)
Element->NumSubFunction[2][Element->NbrGroupsOfEntities] = Element->NumSubFunction[2][Element->NbrGroupsOfEntities] =
*((int *)List_Pointer(BasisFunction_P->SubdFunction, i_SF)) ; /* Index *((int *)List_Pointer(BasisFunction_P->SubdFunction,
Expression */ i_SF)); /* Index Expression */
Element->NumGroupsOfEntities[Element->NbrGroupsOfEntities++] = Element->Re Element->NumGroupsOfEntities[Element->NbrGroupsOfEntities++] =
gion ; Element->Region;
if(Element->NbrGroupsOfEntities >= NBR_MAX_GROUPS_IN_ELEMENT - 1){ if(Element->NbrGroupsOfEntities >= NBR_MAX_GROUPS_IN_ELEMENT - 1) {
Message::Error("Reached limit number of groups of entities"); Message::Error("Reached limit number of groups of entities");
return; return;
} }
} }
} }
} }
/* ------------------------------------------------------------------------ */ /* ------------------------------------------------------------------------ */
/* G e t _ G r o u p O f R e g i o n s F o r E l e m e n t */ /* G e t _ G r o u p O f R e g i o n s F o r E l e m e n t */
/* ------------------------------------------------------------------------ */ /* ------------------------------------------------------------------------ */
void Get_GroupOfRegionsForElement(struct Element * Element, int * StartingIndex void Get_GroupOfRegionsForElement(struct Element *Element, int *StartingIndex,
, struct BasisFunction *BasisFunction_P)
struct BasisFunction * BasisFunction_P)
{ {
int Nbr_SubFunction, i_SF ; int Nbr_SubFunction, i_SF;
if (Element->NumLastElementForGroupsOfEntities != Element->Num) { if(Element->NumLastElementForGroupsOfEntities != Element->Num) {
Element->NumLastElementForGroupsOfEntities = Element->Num ; Element->NumLastElementForGroupsOfEntities = Element->Num;
Element->NbrGroupsOfEntities = 0 ; Element->NbrGroupsOfEntities = 0;
} }
*StartingIndex = Element->NbrGroupsOfEntities ; *StartingIndex = Element->NbrGroupsOfEntities;
if (!BasisFunction_P->SubFunction) { if(!BasisFunction_P->SubFunction) {
Element->NumSubFunction[1][Element->NbrGroupsOfEntities] = 0 ; Element->NumSubFunction[1][Element->NbrGroupsOfEntities] = 0;
Element->NumSubFunction[0][Element->NbrGroupsOfEntities] = -1 ; Element->NumSubFunction[0][Element->NbrGroupsOfEntities] = -1;
Element->NumGroupsOfEntities[Element->NbrGroupsOfEntities++] = GroupEntity_P Element->NumGroupsOfEntities[Element->NbrGroupsOfEntities++] =
->Num ; GroupEntity_P->Num;
if(Element->NbrGroupsOfEntities >= NBR_MAX_GROUPS_IN_ELEMENT - 1){ if(Element->NbrGroupsOfEntities >= NBR_MAX_GROUPS_IN_ELEMENT - 1) {
Message::Error("Reached limit number of groups of entities"); Message::Error("Reached limit number of groups of entities");
return; return;
} }
} }
else { /* For SubFunctions (basis functions for a global function) */ else { /* For SubFunctions (basis functions for a global function) */
Nbr_SubFunction = List_Nbr(BasisFunction_P->SubFunction) ; Nbr_SubFunction = List_Nbr(BasisFunction_P->SubFunction);
for (i_SF = 0 ; i_SF < Nbr_SubFunction ; i_SF++) { for(i_SF = 0; i_SF < Nbr_SubFunction; i_SF++) {
Element->NumSubFunction[1][Element->NbrGroupsOfEntities] = i_SF ; /* Index Element->NumSubFunction[1][Element->NbrGroupsOfEntities] =
SF */ i_SF; /* Index SF */
Element->NumSubFunction[0][Element->NbrGroupsOfEntities] = Element->NumSubFunction[0][Element->NbrGroupsOfEntities] =
*((int *)List_Pointer(BasisFunction_P->SubFunction, i_SF)) ; /* Index Ex *((int *)List_Pointer(BasisFunction_P->SubFunction,
pression */ i_SF)); /* Index Expression */
if (BasisFunction_P->SubdFunction) if(BasisFunction_P->SubdFunction)
Element->NumSubFunction[2][Element->NbrGroupsOfEntities] = Element->NumSubFunction[2][Element->NbrGroupsOfEntities] =
*((int *)List_Pointer(BasisFunction_P->SubdFunction, i_SF)) ; /* Index *((int *)List_Pointer(BasisFunction_P->SubdFunction,
Expression */ i_SF)); /* Index Expression */
Element->NumGroupsOfEntities[Element->NbrGroupsOfEntities++] = GroupEntity Element->NumGroupsOfEntities[Element->NbrGroupsOfEntities++] =
_P->Num ; GroupEntity_P->Num;
if(Element->NbrGroupsOfEntities >= NBR_MAX_GROUPS_IN_ELEMENT - 1){ if(Element->NbrGroupsOfEntities >= NBR_MAX_GROUPS_IN_ELEMENT - 1) {
Message::Error("Reached limit number of groups of entities"); Message::Error("Reached limit number of groups of entities");
return; return;
} }
} }
} }
} }
/* ------------------------------------------------------------------------ */ /* ------------------------------------------------------------------------ */
/* G e t _ G l o b a l F o r E l e m e n t */ /* G e t _ G l o b a l F o r E l e m e n t */
/* ------------------------------------------------------------------------ */ /* ------------------------------------------------------------------------ */
void Get_GlobalForElement(struct Element * Element, int * StartingIndex, void Get_GlobalForElement(struct Element *Element, int *StartingIndex,
struct BasisFunction * BasisFunction_P) struct BasisFunction *BasisFunction_P)
{ {
int Nbr_Global, i, * Num_Global ; int Nbr_Global, i, *Num_Global;
if (Element->NumLastElementForGroupsOfEntities != Element->Num) { if(Element->NumLastElementForGroupsOfEntities != Element->Num) {
Element->NumLastElementForGroupsOfEntities = Element->Num ; Element->NumLastElementForGroupsOfEntities = Element->Num;
Element->NbrGroupsOfEntities = 0 ; Element->NbrGroupsOfEntities = 0;
} }
*StartingIndex = Element->NbrGroupsOfEntities ; *StartingIndex = Element->NbrGroupsOfEntities;
Nbr_Global = List_Nbr(GroupEntity_P->InitialList) ; Nbr_Global = List_Nbr(GroupEntity_P->InitialList);
Num_Global = (Nbr_Global)? (int*)List_Pointer(GroupEntity_P->InitialList, 0) : Num_Global =
NULL ; (Nbr_Global) ? (int *)List_Pointer(GroupEntity_P->InitialList, 0) : NULL;
if (BasisFunction_P->GlobalBasisFunction) { if(BasisFunction_P->GlobalBasisFunction) {
for (i = 0 ; i < Nbr_Global ; i++) { for(i = 0; i < Nbr_Global; i++) {
Element->GlobalBasisFunction[Element->NbrGroupsOfEntities ] = Element->GlobalBasisFunction[Element->NbrGroupsOfEntities] =
(struct GlobalBasisFunction *) (struct GlobalBasisFunction *)List_Pointer(
List_Pointer(BasisFunction_P->GlobalBasisFunction, i) ; BasisFunction_P->GlobalBasisFunction, i);
/* Attention: correspondance i-i si liste triee ! fait dans yacc */ /* Attention: correspondance i-i si liste triee ! fait dans yacc */
Element->NumGroupsOfEntities[Element->NbrGroupsOfEntities++] = Num_Global[ Element->NumGroupsOfEntities[Element->NbrGroupsOfEntities++] =
i] ; Num_Global[i];
if(Element->NbrGroupsOfEntities >= NBR_MAX_GROUPS_IN_ELEMENT - 1){ if(Element->NbrGroupsOfEntities >= NBR_MAX_GROUPS_IN_ELEMENT - 1) {
Message::Error("Reached limit number of groups of entities"); Message::Error("Reached limit number of groups of entities");
return; return;
} }
} }
if (TreatmentStatus == STATUS_PRE) if(TreatmentStatus == STATUS_PRE)
Get_PreResolutionForGlobalBasisFunction(Nbr_Global, *StartingIndex, Elemen Get_PreResolutionForGlobalBasisFunction(Nbr_Global, *StartingIndex,
t) ; Element);
} }
else { else {
for (i = 0 ; i < Nbr_Global ; i++) { for(i = 0; i < Nbr_Global; i++) {
Element->NumGroupsOfEntities[Element->NbrGroupsOfEntities++] = Num_Global[ Element->NumGroupsOfEntities[Element->NbrGroupsOfEntities++] =
i] ; Num_Global[i];
if(Element->NbrGroupsOfEntities >= NBR_MAX_GROUPS_IN_ELEMENT - 1){ if(Element->NbrGroupsOfEntities >= NBR_MAX_GROUPS_IN_ELEMENT - 1) {
Message::Error("Reached limit number of groups of entities"); Message::Error("Reached limit number of groups of entities");
return; return;
} }
} }
} }
} }
/* ------------------------------------------------------------------------ */ /* ------------------------------------------------------------------------ */
/* G e t _ C o d e s O f E l e m e n t */ /* G e t _ C o d e s O f E l e m e n t */
/* ------------------------------------------------------------------------ */ /* ------------------------------------------------------------------------ */
void Get_CodesOfElement(struct FunctionSpace * FunctionSpace_P, void Get_CodesOfElement(struct FunctionSpace *FunctionSpace_P,
struct QuantityStorage * QuantityStorage_P, struct QuantityStorage *QuantityStorage_P,
int Nbr_Entity, int Num_Entity[], int Nbr_Entity, int Num_Entity[], int StartingIndex,
int StartingIndex, int i_BFunction, int TypeConstraint,
int i_BFunction, int TypeConstraint, int * Num_SubFuncti int *Num_SubFunction)
on)
{ {
/* external input/output : /* external input/output :
GroupSupport_P : In GroupSupport_P : In
GroupEntity_P : In */ GroupEntity_P : In */
int i_Entity, CodeExist = 0, Code_BasisFunction ; int i_Entity, CodeExist = 0, Code_BasisFunction;
struct Dof * Dof_P = NULL; struct Dof *Dof_P = NULL;
/* 1. F o r e a c h e n t i t y t o w h i c h a b a s i s /* 1. F o r e a c h e n t i t y t o w h i c h a b a s i s
f u n c t i o n c o u l d b e a s s o c i a t e d : f u n c t i o n c o u l d b e a s s o c i a t e d :
(Node, Edge, Facet, Volume, GroupOfNodes, Region, ...) */ (Node, Edge, Facet, Volume, GroupOfNodes, Region, ...) */
for (i_Entity = StartingIndex ; i_Entity < Nbr_Entity ; i_Entity++) { for(i_Entity = StartingIndex; i_Entity < Nbr_Entity; i_Entity++) {
Code_BasisFunction = Code_BasisFunction =
BasisFunction_P->Num + (Num_SubFunction? Num_SubFunction[i_Entity] : 0) ; BasisFunction_P->Num + (Num_SubFunction ? Num_SubFunction[i_Entity] : 0);
switch (TreatmentStatus) { switch(TreatmentStatus) {
case STATUS_CAL : case STATUS_CAL:
case STATUS_POS : case STATUS_POS:
case STATUS_CST : case STATUS_CST:
if(!FunctionSpace_P->DofData){ if(!FunctionSpace_P->DofData) {
Message::Error("Empty DofData in FunctionSpace '%s' (no unknowns?)", Message::Error("Empty DofData in FunctionSpace '%s' (no unknowns?)",
FunctionSpace_P->Name); FunctionSpace_P->Name);
return; return;
} }
CodeExist = CodeExist =
((Dof_P = ((Dof_P = Dof_GetDofStruct(FunctionSpace_P->DofData, Code_BasisFunction,
Dof_GetDofStruct(FunctionSpace_P->DofData, abs(Num_Entity[i_Entity]), 0)) != NULL);
Code_BasisFunction, abs(Num_Entity[i_Entity]), 0))
!= NULL) ; if(Flag_SubSpace && CodeExist && TreatmentStatus != STATUS_POS)
CodeExist = Check_IsEntityInExtendedGroup(GroupEntity_P,
if (Flag_SubSpace && CodeExist && TreatmentStatus != STATUS_POS) abs(Num_Entity[i_Entity]), 0);
CodeExist =
Check_IsEntityInExtendedGroup(GroupEntity_P, abs(Num_Entity[i_Entity]),
0) ;
/* ... parce que le code peut ne pas exister quand sous-espace ! */ /* ... parce que le code peut ne pas exister quand sous-espace ! */
break ; break;
case STATUS_PRE : case STATUS_PRE:
CodeExist = CodeExist = Check_IsEntityInExtendedGroup(GroupEntity_P,
Check_IsEntityInExtendedGroup(GroupEntity_P, abs(Num_Entity[i_Entity]), 0 abs(Num_Entity[i_Entity]), 0);
) ; break;
break ;
default : default:
Message::Error("Unknown TreatmentStatus (%d)", TreatmentStatus); Message::Error("Unknown TreatmentStatus (%d)", TreatmentStatus);
return; return;
} }
/* 2. O n e a s s o c i a t e s a b a s i s f u n c t i o n : */ /* 2. O n e a s s o c i a t e s a b a s i s f u n c t i o n : */
if (CodeExist) { if(CodeExist) {
QuantityStorage_P->BasisFunction[Nbr_ElementaryBF].Dof = Dof_P;
QuantityStorage_P->BasisFunction[Nbr_ElementaryBF].NumEntityInElement =
i_Entity;
QuantityStorage_P->BasisFunction[Nbr_ElementaryBF].CodeBasisFunction =
Code_BasisFunction;
QuantityStorage_P->BasisFunction[Nbr_ElementaryBF].CodeEntity =
abs(Num_Entity[i_Entity]);
QuantityStorage_P->BasisFunction[Nbr_ElementaryBF].BasisFunction =
BasisFunction_P;
if(TreatmentStatus == STATUS_PRE ||
TreatmentStatus == STATUS_CST) /* Associated Contraints? */
Treatment_ConstraintForElement(FunctionSpace_P, QuantityStorage_P,
Num_Entity, i_Entity, i_BFunction,
TypeConstraint);
QuantityStorage_P->BasisFunction[Nbr_ElementaryBF].Dof Nbr_ElementaryBF++;
= Dof_P ;
QuantityStorage_P->BasisFunction[Nbr_ElementaryBF].NumEntityInElement
= i_Entity ;
QuantityStorage_P->BasisFunction[Nbr_ElementaryBF].CodeBasisFunction
= Code_BasisFunction ;
QuantityStorage_P->BasisFunction[Nbr_ElementaryBF].CodeEntity
= abs(Num_Entity[i_Entity]) ;
QuantityStorage_P->BasisFunction[Nbr_ElementaryBF].BasisFunction
= BasisFunction_P ;
if (TreatmentStatus == STATUS_PRE ||
TreatmentStatus == STATUS_CST) /* Associated Contraints? */
Treatment_ConstraintForElement(FunctionSpace_P, QuantityStorage_P,
Num_Entity, i_Entity,
i_BFunction, TypeConstraint) ;
Nbr_ElementaryBF++ ; } /* if CodeExist ... */
} /* if CodeExist ... */ } /* for i_Entity ... */
} /* for i_Entity ... */
} }
/* ------------------------------------------------------------------------ */ /* ------------------------------------------------------------------------ */
/* G e t _ D o f O f R e g i o n */ /* G e t _ D o f O f R e g i o n */
/* ------------------------------------------------------------------------ */ /* ------------------------------------------------------------------------ */
void Get_DofOfRegion(int Num_Region, void Get_DofOfRegion(int Num_Region, struct GlobalQuantity *GlobalQuantity_P,
struct GlobalQuantity * GlobalQuantity_P, struct FunctionSpace *FunctionSpace_P,
struct FunctionSpace * FunctionSpace_P, struct QuantityStorage *QuantityStorage_P)
struct QuantityStorage * QuantityStorage_P)
{ {
int CodeExist = 0, Num_BasisFunction, Num_AssociateBasisFunction ; int CodeExist = 0, Num_BasisFunction, Num_AssociateBasisFunction;
int Num_Entity = -1; int Num_Entity = -1;
struct Dof * Dof_P = NULL; struct Dof *Dof_P = NULL;
Nbr_ElementaryBF = 0 ; Nbr_ElementaryBF = 0;
BasisFunction_P = (struct BasisFunction*) BasisFunction_P = (struct BasisFunction *)List_Pointer(
List_Pointer(FunctionSpace_P->BasisFunction, FunctionSpace_P->BasisFunction, GlobalQuantity_P->ReferenceIndex);
GlobalQuantity_P->ReferenceIndex) ; GroupEntity_P =
GroupEntity_P = (struct Group*) (struct Group *)List_Pointer(Problem_S.Group, BasisFunction_P->EntityIndex);
List_Pointer(Problem_S.Group, BasisFunction_P->EntityIndex) ;
if(GroupEntity_P->Type == REGIONLIST &&
if (GroupEntity_P->Type == REGIONLIST && List_Search(GroupEntity_P->InitialList, &Num_Region, fcmp_int)) {
List_Search(GroupEntity_P->InitialList, &Num_Region, fcmp_int)) { if(GlobalQuantity_P->Type == ALIASOF) {
Num_BasisFunction = BasisFunction_P->Num;
if (GlobalQuantity_P->Type == ALIASOF) { Num_AssociateBasisFunction = 0;
Num_BasisFunction = BasisFunction_P->Num ;
Num_AssociateBasisFunction = 0 ;
} }
else { else {
Num_BasisFunction = GlobalQuantity_P->Num ; Num_BasisFunction = GlobalQuantity_P->Num;
Num_AssociateBasisFunction = BasisFunction_P->Num ; Num_AssociateBasisFunction = BasisFunction_P->Num;
} }
if (GroupEntity_P->FunctionType == GROUPOFREGIONSOF) if(GroupEntity_P->FunctionType == GROUPOFREGIONSOF)
Num_Entity = GroupEntity_P->Num; Num_Entity = GroupEntity_P->Num;
else else
Num_Entity = Num_Region; Num_Entity = Num_Region;
switch (TreatmentStatus) { switch(TreatmentStatus) {
case STATUS_CAL : case STATUS_CAL:
case STATUS_POS : case STATUS_POS:
case STATUS_CST : case STATUS_CST:
if(!FunctionSpace_P->DofData){ if(!FunctionSpace_P->DofData) {
Message::Error("Empty DofData in FunctionSpace '%s' (no unknowns?)", Message::Error("Empty DofData in FunctionSpace '%s' (no unknowns?)",
FunctionSpace_P->Name); FunctionSpace_P->Name);
return; return;
} }
CodeExist = CodeExist =
((Dof_P = Dof_GetDofStruct(FunctionSpace_P->DofData, ((Dof_P = Dof_GetDofStruct(FunctionSpace_P->DofData, Num_BasisFunction,
Num_BasisFunction, Num_Entity, 0)) != NULL) ; Num_Entity, 0)) != NULL);
break ; break;
case STATUS_PRE : case STATUS_PRE: CodeExist = 1; break;
CodeExist = 1 ; default: break;
break ;
default : break ;
} }
if (CodeExist) { if(CodeExist) {
QuantityStorage_P->BasisFunction[0].Dof = Dof_P ; QuantityStorage_P->BasisFunction[0].Dof = Dof_P;
QuantityStorage_P->BasisFunction[0].CodeBasisFunction = Num_BasisFunction QuantityStorage_P->BasisFunction[0].CodeBasisFunction = Num_BasisFunction;
; QuantityStorage_P->BasisFunction[0].CodeEntity = Num_Entity;
QuantityStorage_P->BasisFunction[0].CodeEntity = Num_Entity ;
QuantityStorage_P->BasisFunction[0].CodeAssociateBasisFunction = QuantityStorage_P->BasisFunction[0].CodeAssociateBasisFunction =
Num_AssociateBasisFunction ; Num_AssociateBasisFunction;
if (TreatmentStatus == STATUS_PRE || if(TreatmentStatus == STATUS_PRE ||
TreatmentStatus == STATUS_CST) /* Contrainte associee ? */ TreatmentStatus == STATUS_CST) /* Contrainte associee ? */
Treatment_ConstraintForRegion(GlobalQuantity_P, Treatment_ConstraintForRegion(GlobalQuantity_P, FunctionSpace_P,
FunctionSpace_P, QuantityStorage_P) ; QuantityStorage_P);
Nbr_ElementaryBF = 1 ; Nbr_ElementaryBF = 1;
} /* if CodeExist ... */ } /* if CodeExist ... */
} /* if REGIONLIST ... */ } /* if REGIONLIST ... */
QuantityStorage_P->NbrElementaryBasisFunction = Nbr_ElementaryBF ; QuantityStorage_P->NbrElementaryBasisFunction = Nbr_ElementaryBF;
} }
/* ------------------------------------------------------------------------ */ /* ------------------------------------------------------------------------ */
/* G e t _ P r e R e s o l u t i o n F o r GlobalBasisFunction */ /* G e t _ P r e R e s o l u t i o n F o r GlobalBasisFunction */
/* ------------------------------------------------------------------------ */ /* ------------------------------------------------------------------------ */
void Get_PreResolutionForGlobalBasisFunction(int Nbr_Global, int StartingIndex, void Get_PreResolutionForGlobalBasisFunction(int Nbr_Global, int StartingIndex,
struct Element * Element) struct Element *Element)
{ {
int i ; int i;
struct PreResolutionInfo PreResolutionInfo_S ; struct PreResolutionInfo PreResolutionInfo_S;
for (i = 0 ; i < Nbr_Global ; i++) for(i = 0; i < Nbr_Global; i++)
if(List_ISearchSeq(PreResolutionIndex_L, if(List_ISearchSeq(
&(Element->GlobalBasisFunction[StartingIndex + i]-> PreResolutionIndex_L,
ResolutionIndex), fcmp_int) < 0) { &(Element->GlobalBasisFunction[StartingIndex + i]->ResolutionIndex),
fcmp_int) < 0) {
PreResolutionInfo_S.Index = PreResolutionInfo_S.Index =
Element->GlobalBasisFunction[StartingIndex + i]->ResolutionIndex ; Element->GlobalBasisFunction[StartingIndex + i]->ResolutionIndex;
PreResolutionInfo_S.Type = PR_GLOBALBASISFUNCTION ; PreResolutionInfo_S.Type = PR_GLOBALBASISFUNCTION;
List_Add(PreResolutionIndex_L, &PreResolutionInfo_S) ; List_Add(PreResolutionIndex_L, &PreResolutionInfo_S);
Message::Info(" Adding Resolution '%s' for Pre-Resolution (Global BF)", Message::Info(" Adding Resolution '%s' for Pre-Resolution (Global BF)",
((struct Resolution*)List_Pointer(Problem_S.Resolution, ((struct Resolution *)List_Pointer(
PreResolutionInfo_S.Index))->Na Problem_S.Resolution, PreResolutionInfo_S.Index))
me) ; ->Name);
} }
} }
 End of changes. 105 change blocks. 
468 lines changed or deleted 439 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)