"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "Functions/BF_Region.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.

BF_Region.cpp  (getdp-3.4.0-source.tgz):BF_Region.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 "GetDPConfig.h" #include "GetDPConfig.h"
#include "ProData.h" #include "ProData.h"
#include "BF.h" #include "BF.h"
#include "MallocUtils.h" #include "MallocUtils.h"
#include "Message.h" #include "Message.h"
#include "Cal_Quantity.h" #include "Cal_Quantity.h"
#if defined(HAVE_KERNEL) #if defined(HAVE_KERNEL)
#include "Get_DofOfElement.h" #include "Get_DofOfElement.h"
#include "Pos_FemInterpolation.h" #include "Pos_FemInterpolation.h"
#endif #endif
extern struct Problem Problem_S ; extern struct Problem Problem_S;
extern struct CurrentData Current ; extern struct CurrentData Current;
/* ------------------------------------------------------------------------ */ /* ------------------------------------------------------------------------ */
/* B F _ S u b F u n c t i o n */ /* B F _ S u b F u n c t i o n */
/* ------------------------------------------------------------------------ */ /* ------------------------------------------------------------------------ */
void BF_SubFunction(struct Element * Element, int NumExpression, void BF_SubFunction(struct Element *Element, int NumExpression, int Dim,
int Dim, double s[]) double s[])
{ {
struct Value Value ; struct Value Value;
Get_ValueOfExpressionByIndex(NumExpression, NULL, 0., 0., 0., &Value) ; Get_ValueOfExpressionByIndex(NumExpression, NULL, 0., 0., 0., &Value);
switch (Dim) { switch(Dim) {
case 1 : case 1: *s *= Value.Val[0]; break;
*s *= Value.Val[0] ; case 3:
break ; s[0] *= Value.Val[0];
case 3 : s[1] *= Value.Val[0];
s[0] *= Value.Val[0] ; s[2] *= Value.Val[0];
s[1] *= Value.Val[0] ; break;
s[2] *= Value.Val[0] ;
break ;
} }
} }
/* ------------------------------------------------------------------------ */ /* ------------------------------------------------------------------------ */
/* B F _ R e g i o n */ /* B F _ R e g i o n */
/* ------------------------------------------------------------------------ */ /* ------------------------------------------------------------------------ */
void BF_Region(struct Element * Element, int NumRegion, void BF_Region(struct Element *Element, int NumRegion, double u, double v,
double u, double v, double w, double *s) double w, double *s)
{ {
*s = 1. ; *s = 1.;
if (Element->NumSubFunction[0][NumRegion-1] >= 0) if(Element->NumSubFunction[0][NumRegion - 1] >= 0)
BF_SubFunction(Element, Element->NumSubFunction[0][NumRegion-1], 1, s) ; BF_SubFunction(Element, Element->NumSubFunction[0][NumRegion - 1], 1, s);
} }
void BF_dRegion(struct Element * Element, int NumRegion, void BF_dRegion(struct Element *Element, int NumRegion, double u, double v,
double u, double v, double w, double *s) double w, double *s)
{ {
*s = 1. ; *s = 1.;
if (Element->NumSubFunction[0][NumRegion-1] >= 0) if(Element->NumSubFunction[0][NumRegion - 1] >= 0)
BF_SubFunction(Element, Element->NumSubFunction[2][NumRegion-1], 1, s) ; BF_SubFunction(Element, Element->NumSubFunction[2][NumRegion - 1], 1, s);
else else
*s = 0. ; *s = 0.;
} }
/* ------------------------------------------------------------------------ */ /* ------------------------------------------------------------------------ */
/* B F _ R e g i o n X , Y , Z */ /* B F _ R e g i o n X , Y , Z */
/* ------------------------------------------------------------------------ */ /* ------------------------------------------------------------------------ */
void BF_RegionX(struct Element * Element, int NumRegion, void BF_RegionX(struct Element *Element, int NumRegion, double u, double v,
double u, double v, double w, double s[]) double w, double s[])
{ {
s[1] = s[2] = 0. ; s[0] = 1. ; s[1] = s[2] = 0.;
s[0] = 1.;
if (Element->NumSubFunction[0][NumRegion-1] >= 0) if(Element->NumSubFunction[0][NumRegion - 1] >= 0)
BF_SubFunction(Element, Element->NumSubFunction[0][NumRegion-1], 3, s) ; BF_SubFunction(Element, Element->NumSubFunction[0][NumRegion - 1], 3, s);
} }
void BF_RegionY(struct Element * Element, int NumRegion, void BF_RegionY(struct Element *Element, int NumRegion, double u, double v,
double u, double v, double w, double s[]) double w, double s[])
{ {
s[0] = s[2] = 0.;
s[1] = 1.;
s[0] = s[2] = 0. ; s[1] = 1. ; if(Element->NumSubFunction[0][NumRegion - 1] >= 0)
BF_SubFunction(Element, Element->NumSubFunction[0][NumRegion - 1], 3, s);
if (Element->NumSubFunction[0][NumRegion-1] >= 0)
BF_SubFunction(Element, Element->NumSubFunction[0][NumRegion-1], 3, s) ;
} }
void BF_RegionZ(struct Element * Element, int NumRegion, void BF_RegionZ(struct Element *Element, int NumRegion, double u, double v,
double u, double v, double w, double s[]) double w, double s[])
{ {
s[0] = s[1] = 0. ; s[2] = 1. ; s[0] = s[1] = 0.;
s[2] = 1.;
if (Element->NumSubFunction[0][NumRegion-1] >= 0) if(Element->NumSubFunction[0][NumRegion - 1] >= 0)
BF_SubFunction(Element, Element->NumSubFunction[0][NumRegion-1], 3, s) ; BF_SubFunction(Element, Element->NumSubFunction[0][NumRegion - 1], 3, s);
} }
void BF_dRegionX(struct Element * Element, int NumRegion, void BF_dRegionX(struct Element *Element, int NumRegion, double u, double v,
double u, double v, double w, double s[]) double w, double s[])
{ {
s[1] = s[2] = 0. ; s[0] = 1. ; /* Patrick (a finaliser) */ s[1] = s[2] = 0.;
s[0] = 1.; /* Patrick (a finaliser) */
if (Element->NumSubFunction[0][NumRegion-1] >= 0) if(Element->NumSubFunction[0][NumRegion - 1] >= 0)
BF_SubFunction(Element, Element->NumSubFunction[2][NumRegion-1], 3, s) ; BF_SubFunction(Element, Element->NumSubFunction[2][NumRegion - 1], 3, s);
else else
s[0] = 0. ; s[0] = 0.;
} }
void BF_dRegionY(struct Element * Element, int NumRegion, void BF_dRegionY(struct Element *Element, int NumRegion, double u, double v,
double u, double v, double w, double s[]) double w, double s[])
{ {
s[0] = s[2] = 0. ; s[1] = 1. ; /* Patrick (a finaliser) */ s[0] = s[2] = 0.;
s[1] = 1.; /* Patrick (a finaliser) */
if (Element->NumSubFunction[0][NumRegion-1] >= 0) if(Element->NumSubFunction[0][NumRegion - 1] >= 0)
BF_SubFunction(Element, Element->NumSubFunction[2][NumRegion-1], 3, s) ; BF_SubFunction(Element, Element->NumSubFunction[2][NumRegion - 1], 3, s);
else else
s[1] = 0. ; s[1] = 0.;
} }
void BF_dRegionZ(struct Element * Element, int NumRegion, void BF_dRegionZ(struct Element *Element, int NumRegion, double u, double v,
double u, double v, double w, double s[]) double w, double s[])
{ {
/* Patrick (a finaliser) /* Patrick (a finaliser)
s[0] = s[1] = 0. ; s[2] = 1. ; s[0] = s[1] = 0. ; s[2] = 1. ;
*/ */
s[0] = s[2] = 0. ; s[1] = -1. ; s[0] = s[2] = 0.;
s[1] = -1.;
if (Element->NumSubFunction[0][NumRegion-1] >= 0) if(Element->NumSubFunction[0][NumRegion - 1] >= 0)
BF_SubFunction(Element, Element->NumSubFunction[2][NumRegion-1], 3, s) ; BF_SubFunction(Element, Element->NumSubFunction[2][NumRegion - 1], 3, s);
else else
s[1] = 0. ; s[1] = 0.;
} }
/* ------------------------------------------------------------------------ */ /* ------------------------------------------------------------------------ */
/* B F _ Z e r o */ /* B F _ Z e r o */
/* ------------------------------------------------------------------------ */ /* ------------------------------------------------------------------------ */
void BF_Zero(struct Element * Element, int Num, void BF_Zero(struct Element *Element, int Num, double u, double v, double w,
double u, double v, double w, double *s) double *s)
{ {
s[0] = s[1] = s[2] = 0. ; s[0] = s[1] = s[2] = 0.;
} }
void BF_One(struct Element * Element, int Num, void BF_One(struct Element *Element, int Num, double u, double v, double w,
double u, double v, double w, double *s) double *s)
{ {
s[0] = 1. ; s[1] = s[2] = 0. ; s[0] = 1.;
s[1] = s[2] = 0.;
} }
void BF_OneZ(struct Element * Element, int Num, void BF_OneZ(struct Element *Element, int Num, double u, double v, double w,
double u, double v, double w, double *s) double *s)
{ {
s[0] = s[1] = 0. ; s[2] = 1. ; s[0] = s[1] = 0.;
s[2] = 1.;
} }
/* ------------------------------------------------------------------------ */ /* ------------------------------------------------------------------------ */
/* B F _ I n i t G l o b a l */ /* B F _ I n i t G l o b a l */
/* ------------------------------------------------------------------------ */ /* ------------------------------------------------------------------------ */
void BF_InitGlobal(struct GlobalBasisFunction * GlobalBasisFunction_P) void BF_InitGlobal(struct GlobalBasisFunction *GlobalBasisFunction_P)
{ {
struct QuantityStorage * QuantityStorage_P ; struct QuantityStorage *QuantityStorage_P;
struct Formulation * Formulation_P ; struct Formulation *Formulation_P;
QuantityStorage_P = GlobalBasisFunction_P->QuantityStorage =
(struct QuantityStorage *)Malloc(sizeof(struct QuantityStorage));
QuantityStorage_P = QuantityStorage_P->NumLastElementForFunctionSpace = 0;
GlobalBasisFunction_P->QuantityStorage =
(struct QuantityStorage *)Malloc(sizeof(struct QuantityStorage)) ; Formulation_P = (struct Formulation *)List_Pointer(
Problem_S.Formulation, GlobalBasisFunction_P->FormulationIndex);
QuantityStorage_P->NumLastElementForFunctionSpace = 0 ; QuantityStorage_P->DefineQuantity = (struct DefineQuantity *)List_Pointer(
Formulation_P->DefineQuantity, GlobalBasisFunction_P->DefineQuantityIndex);
Formulation_P = (struct Formulation*) QuantityStorage_P->FunctionSpace = (struct FunctionSpace *)List_Pointer(
List_Pointer(Problem_S.Formulation, Problem_S.FunctionSpace,
GlobalBasisFunction_P->FormulationIndex) ; QuantityStorage_P->DefineQuantity->FunctionSpaceIndex);
QuantityStorage_P->DefineQuantity = (struct DefineQuantity*) QuantityStorage_P->TypeQuantity = QuantityStorage_P->FunctionSpace->Type;
List_Pointer(Formulation_P->DefineQuantity,
GlobalBasisFunction_P->DefineQuantityIndex) ;
QuantityStorage_P->FunctionSpace = (struct FunctionSpace*)
List_Pointer(Problem_S.FunctionSpace,
QuantityStorage_P->DefineQuantity->FunctionSpaceIndex) ;
QuantityStorage_P->TypeQuantity = QuantityStorage_P->FunctionSpace->Type ;
} }
/* ------------------------------------------------------------------------ */ /* ------------------------------------------------------------------------ */
/* B F _ G l o b a l , B F _ d G l o b a l , B F _ d I n v G l o b a l */ /* B F _ G l o b a l , B F _ d G l o b a l , B F _ d I n v G l o b a l */
/* ------------------------------------------------------------------------ */ /* ------------------------------------------------------------------------ */
void BF_Global_OP(struct Element * Element, int NumGlobal, void BF_Global_OP(struct Element *Element, int NumGlobal, double u, double v,
double u, double v, double w, double *s, int type_OP) double w, double *s, int type_OP)
{ {
#if !defined(HAVE_KERNEL) #if !defined(HAVE_KERNEL)
Message::Error("BF_Global_OP requires Kernel"); Message::Error("BF_Global_OP requires Kernel");
#else #else
struct Value Value ; struct Value Value;
struct GlobalBasisFunction * GlobalBasisFunction_P ; struct GlobalBasisFunction *GlobalBasisFunction_P;
struct QuantityStorage * QuantityStorage_P ; struct QuantityStorage *QuantityStorage_P;
int Save_NbrHar; int Save_NbrHar;
GlobalBasisFunction_P = Element->GlobalBasisFunction[NumGlobal-1] ; GlobalBasisFunction_P = Element->GlobalBasisFunction[NumGlobal - 1];
if (!GlobalBasisFunction_P->QuantityStorage) if(!GlobalBasisFunction_P->QuantityStorage)
BF_InitGlobal(GlobalBasisFunction_P) ; /* Init QuantityStorage */ BF_InitGlobal(GlobalBasisFunction_P); /* Init QuantityStorage */
QuantityStorage_P = GlobalBasisFunction_P->QuantityStorage ; QuantityStorage_P = GlobalBasisFunction_P->QuantityStorage;
if (QuantityStorage_P->NumLastElementForFunctionSpace != Element->Num) { if(QuantityStorage_P->NumLastElementForFunctionSpace != Element->Num) {
QuantityStorage_P->NumLastElementForFunctionSpace = Element->Num ; QuantityStorage_P->NumLastElementForFunctionSpace = Element->Num;
Get_DofOfElement Get_DofOfElement(Element, QuantityStorage_P->FunctionSpace,
(Element, QuantityStorage_P->FunctionSpace, QuantityStorage_P, QuantityStorage_P,
QuantityStorage_P->DefineQuantity->IndexInFunctionSpace) ; QuantityStorage_P->DefineQuantity->IndexInFunctionSpace);
} }
Save_NbrHar = Current.NbrHar; Save_NbrHar = Current.NbrHar;
Current.NbrHar = 1; /* for real basis function */ Current.NbrHar = 1; /* for real basis function */
Pos_FemInterpolation Pos_FemInterpolation(Element, NULL, GlobalBasisFunction_P->QuantityStorage,
(Element, QUANTITY_SIMPLE, type_OP, -1, 0, u, v, w, 0., 0., 0.,
NULL, Value.Val, &Value.Type, 0);
GlobalBasisFunction_P->QuantityStorage,
QUANTITY_SIMPLE, type_OP, -1, 0,
u, v, w, 0., 0., 0., Value.Val, &Value.Type, 0) ;
Current.NbrHar = Save_NbrHar; Current.NbrHar = Save_NbrHar;
switch (Value.Type) { switch(Value.Type) {
case SCALAR : case SCALAR: s[0] = Value.Val[0]; break;
s[0] = Value.Val[0] ; case VECTOR:
break ; s[0] = Value.Val[0];
case VECTOR : s[1] = Value.Val[1];
s[0] = Value.Val[0] ; s[1] = Value.Val[1] ; s[2] = Value.Val[2] ; s[2] = Value.Val[2];
break ; break;
default : default: Message::Error("Bad type of value for Global BasisFunction");
Message::Error("Bad type of value for Global BasisFunction") ;
} }
#endif #endif
} }
/* ------------------------------------------------------------------------ */ /* ------------------------------------------------------------------------ */
void BF_Global(struct Element * Element, int NumGlobal, void BF_Global(struct Element *Element, int NumGlobal, double u, double v,
double u, double v, double w, double *s) double w, double *s)
{ {
BF_Global_OP(Element, NumGlobal, u, v, w, s, NOOP); BF_Global_OP(Element, NumGlobal, u, v, w, s, NOOP);
} }
void BF_dGlobal(struct Element * Element, int NumGlobal, void BF_dGlobal(struct Element *Element, int NumGlobal, double u, double v,
double u, double v, double w, double *s ) double w, double *s)
{ {
BF_Global_OP(Element, NumGlobal, u, v, w, s, EXTDER); BF_Global_OP(Element, NumGlobal, u, v, w, s, EXTDER);
} }
void BF_dInvGlobal(struct Element * Element, int NumGlobal, void BF_dInvGlobal(struct Element *Element, int NumGlobal, double u, double v,
double u, double v, double w, double *s ) double w, double *s)
{ {
BF_Global_OP(Element, NumGlobal, u, v, w, s, EXTDERINV); BF_Global_OP(Element, NumGlobal, u, v, w, s, EXTDERINV);
} }
 End of changes. 55 change blocks. 
124 lines changed or deleted 122 lines changed or added

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