39 for (
int xyz = 1; xyz <= myArray.giveSize(); xyz++ ) {
40 if ( dynamic_cast< IntArray * >(& myArray) ) {
41 printf(
"%u ", myArray.at(xyz) );
43 printf(
"%f ", myArray.at(xyz) );
56 void logDataMsg(
const char *c, T myArray,
const char *c2) {
125 if ( dof == myDof ) {
140 for (
auto &n :this->
giveDomain()->giveDofManagers() ) {
155 double A0p = 0.0, App = 0.0, A0m = 0.0, Amm = 0.0, Bp = 0.0, Bm = 0.0, c0 = 0.0, cp = 0.0, cm = 0.0;
162 for (
int i = 0; i < BoundaryList.
giveSize() / 2; i++ ) {
163 int ElementID = BoundaryList(2 * i);
164 int Boundary = BoundaryList(2 * i + 1);
168 IntArray bnodes, zNodes, pNodes, mNodes;
182 const FloatArray &lcoords = gp->giveNaturalCoordinates();
204 for (
int l = 1; l <= zNodes.
giveSize(); l++ ) {
205 int nodeID = zNodes.
at(l);
207 zPhi.
at(m) = zPhi.
at(m) + N.
at(nodeID) * nodeValues.
at(m, nodeID);
213 for (
int l = 1; l <= pNodes.
giveSize(); l++ ) {
214 int nodeID = pNodes.
at(l);
216 pPhi.
at(m) = pPhi.
at(m) + N.
at(nodeID) * nodeValues.
at(m, nodeID);
221 for (
int l = 1; l <= mNodes.
giveSize(); l++ ) {
222 int nodeID = mNodes.
at(l);
224 mPhi.
at(m) = mPhi.
at(m) + N.
at(nodeID) * nodeValues.
at(m, nodeID);
242 * am = -( A0m * cp * cp - Bm * cp * cp - A0p * cm * cp + App * c0 * cm + Bp * cm * cp ) / ( App * cm * cm + Amm * cp * cp );
243 * ap = -( A0p * cm * cm - Bp * cm * cm - A0m * cm * cp + Amm * c0 * cp + Bm * cm * cp ) / ( App * cm * cm + Amm * cp * cp );
253 for (
int j = 1; j <= bnodes.
giveSize(); j++ ) {
258 bool isMinus =
false;
264 }
else if ( isPlus ) {
266 }
else if ( isMinus ) {
271 for (
size_t k = 0; k < mode.
SurfaceData.size(); k++ ) {
273 int IndexOfDofIDItem = 0;
276 IndexOfDofIDItem = l;
280 nodeValues.
at(IndexOfDofIDItem, j) = mode.
SurfaceData.at(k)->value;
303 double out = shapeFunctionValues.
dotProduct(gamma);
315 FloatArray values, masterContribs2, d, values2;
317 masterContribs.
resize( this->
giveDomain()->giveNumberOfSpatialDimensions() );
318 masterContribs2.
resize( this->
giveDomain()->giveNumberOfSpatialDimensions() );
322 bool isPlus, isMinus, isZero, found;
330 for (
size_t j = 0; j < ms->
SurfaceData.size(); j++ ) {
350 factor = isPlus ?
modes.at(i - 1)->ap : factor;
351 factor = isMinus ?
modes.at(i - 1)->am : factor;
352 factor = isZero ? 1.0 : factor;
354 masterContribs.
at(i) = factor * values.
at(1);
374 OOFEM_LOG_INFO(
"************************** Instanciating microproblem from file %s for dimension %u\n",
filename.c_str(), i);
380 myEngngModel->checkProblemConsistency();
381 myEngngModel->initMetaStepAttributes( myEngngModel->giveMetaStep(1) );
383 myEngngModel->init();
384 this->
setLoads(myEngngModel, i + 1);
387 for (
auto &elem : myEngngModel->giveDomain(1)->giveElements() ) {
393 for (
int k = 1; k <= elem->giveNumberOfDofManagers(); k++ ) {
396 for (
Dof *dof: *dman ) {
397 if ( dof->giveBcId() != 0 ) {
402 if ( vlockCount == 30 ) {
403 OOFEM_WARNING(
"Element over-constrained (%u)! Center coordinate: %f, %f, %f\n", elem->giveNumber(), centerCoord.
at(1) / 10, centerCoord.
at(2) / 10, centerCoord.
at(3) / 10);
411 std :: string originalFilename;
412 originalFilename = myEngngModel->giveOutputBaseFileName();
414 if (i==0) originalFilename = originalFilename +
"_X";
415 if (i==1) originalFilename = originalFilename +
"_Y";
416 if (i==2) originalFilename = originalFilename +
"_Z";
418 myEngngModel->letOutputBaseFileNameBe(originalFilename +
"_1_Base");
432 double am=1.0, ap=1.0;
446 myEngngModel->letOutputBaseFileNameBe(originalFilename +
"_2_Updated");
450 modes.push_back(mode);
452 OOFEM_LOG_INFO(
"************************** Microproblem at %p instanciated \n", myEngngModel);
460 for (
size_t j = 0; j < m->
SurfaceData.size(); j++ ) {
468 factor = m->
SurfaceData.at(j)->isZeroBoundary ? 1.0 : factor;
470 if ( dynamic_cast< MasterDof * >(d) && m->
SurfaceData.at(j)->isFree ) {
499 blArray = elem->giveBodyLoadArray();
512 for (
int i = 1; i <= answer.
giveSize(); i++ ) {
517 std :: vector< FloatArray >checkcoords;
518 std :: vector< int >permuteIndex;
527 if ( this->
giveDomain()->giveNumberOfSpatialDimensions() == 2 ) {
536 for (
int i = 1; i <= coords.
giveSize(); i++ ) {
538 permuteIndex.push_back(i);
541 thisMask = thisMask + ( 0x01 << ( i - 1 ) );
545 for (
int i = 0; i < _s; i++ ) {
546 int mask = i, counter = 1;
549 for (
int j = 1; j <= n; j++ ) {
551 if ( ( mask & 1 ) == 0 ) {
552 newCoord.
at( permuteIndex.at(counter - 1) ) =
minCoord.
at( permuteIndex.at(counter - 1) ) + d;
554 newCoord.
at( permuteIndex.at(counter - 1) ) =
maxCoord.
at( permuteIndex.at(counter - 1) ) - d;
559 checkcoords.emplace_back(newCoord);
567 * tempCoord = coords;
569 checkcoords.push_back(tempCoord);
572 for (
size_t i = 0; i < checkcoords.size(); i++ ) {
576 for (
int j = 1; j <= values.
giveSize(); j++ ) {
577 answer.
at(j) = values.
at(j);
580 for (
int j = 1; j <= values.
giveSize(); j++ ) {
581 answer.
at(j) += values.
at(j) / ( ( double ) pow(2.0, n) );
596 if ( elementAtCoords == NULL ) {
607 for (
int i = 1; i <= dofIDs.
giveSize(); i++ ) {
608 for (
int j = 1; j <= eldofids.
giveSize(); j++ ) {
609 if ( dofIDs.
at(i) == eldofids.
at(j) ) {
610 answer.
at(i) = values.
at(j);
655 for (
int i = 0; i < BoundaryList.
giveSize() / 2; i++ ) {
656 int ElementID = BoundaryList(2 * i);
657 int Boundary = BoundaryList(2 * i + 1);
669 for (
int k = 1; k <= bnodes.
giveSize(); k++ ) {
684 lcoords.
at(1) = 0.33333;
685 lcoords.
at(2) = 0.33333;
691 printf(
"i=%u\tj=%u\t(%f\t%f\t%f)\n", i, j, normal.
at(1), normal.
at(2), normal.
at(3) );
692 for (
int k = 1; k <= normal.
giveSize(); k++ ) {
693 if ( fabs( ( fabs( normal.
at(k) ) - 1 ) ) < 1e-4 ) {
695 if ( normal.
at(k) > 0.5 ) {
698 if ( normal.
at(k) < -0.5 ) {
701 if ( addTo != NULL ) {
702 for (
int l = 1; l <= bnodes.
giveSize(); l++ ) {
703 bool isSurface =
false;
724 for (
int i = 1; i < pNodes.
giveSize(); i++ ) {
725 printf(
"%u, ", pNodes.
at(i) );
729 for (
int i = 1; i < mNodes.
giveSize(); i++ ) {
730 printf(
"%u, ", mNodes.
at(i) );
741 if ( pNodes.
at(i) == mNodes.
at(j) ) {
760 for (
int i = 1; i <= pNodes.
giveSize(); i++ ) {
761 printf(
"%u, ", pNodes.
at(i) );
765 for (
int i = 1; i <= mNodes.
giveSize(); i++ ) {
766 printf(
"%u, ", mNodes.
at(i) );
770 for (
int i = 1; i <= zNodes.
giveSize(); i++ ) {
771 printf(
"%u, ", zNodes.
at(i) );
776 for (
int i = 1; i <= pNodes.
giveSize(); i++ ) {
778 printf(
"%f, %f, %f; ", coords->
at(1), coords->
at(2), coords->
at(3) );
782 for (
int i = 1; i <= mNodes.
giveSize(); i++ ) {
784 printf(
"%f, %f, %f; ", coords->
at(1), coords->
at(2), coords->
at(3) );
788 for (
int i = 1; i <= zNodes.
giveSize(); i++ ) {
790 printf(
"%f, %f, %f; ", coords->
at(1), coords->
at(2), coords->
at(3) );
803 for (
int k = 1; k <= coord.
giveSize(); k++ ) {
808 isZero = isPlus && isMinus;
814 for (
int i = 1; i <= nodeList.
giveSize(); i++ ) {
831 for (
Dof *d: *dman ){
835 if (d->giveDofID() == this->
dofs.
at(j)) {
838 surfaceData->
DofMan = dman;
839 surfaceData->
isPlus = isPlus;
840 surfaceData->
isMinus = isMinus;
842 surfaceData->
isFree = d->giveBcId() == 0;
843 surfaceData->
value = values.
at(j);
REGISTER_BoundaryCondition(BoundaryCondition)
void erase(int pos)
Erase the element at given position (1-based index) Receiver will shrink accordingly, the values at positions (pos+1,...,size) will be moved to positions (pos,...,size-1)
int giveDofManagerNumber(int i) const
Translates local to global indices for dof managers.
void setBoundaryCondition(int i, GeneralBoundaryCondition *obj)
Sets i-th component. The component will be further managed and maintained by domain object...
std::vector< modeStruct * > modes
virtual void computeDofTransformation(ActiveDof *dof, FloatArray &masterContribs)
Domain * domain
Link to domain object, useful for communicating with other FEM components.
IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description stored in input record.
const IntArray & giveBoundaryList()
Returns list of element boundaries within set.
int giveNumberOfBoundaryConditions() const
Returns number of boundary conditions in domain.
Abstract class representing field of primary variables (those, which are unknown and are typically as...
bool isCoeff(ActiveDof *dof)
virtual double boundaryEvalNormal(FloatArray &answer, int boundary, const FloatArray &lcoords, const FEICellGeometry &cellgeo)=0
Evaluates the normal on the requested boundary.
double & at(int i)
Coefficient access function.
int max(int i, int j)
Returns bigger value form two given decimals.
ValueModeType
Type representing the mode of UnknownType or CharType, or similar types.
void clear()
Clears receiver (zero size).
void splitBoundaryNodeIDs(modeStruct &mode, Element &e, IntArray &boundary, IntArray &pList, IntArray &mList, IntArray &zList, FloatMatrix &nodeValues)
void setPrescribedValue(double s)
Set prescribed value at the input record string of receiver.
void whichBoundary(FloatArray &coord, bool &isPlus, bool &isMinus, bool &isZero)
virtual FloatArray * giveCoordinates()
void computeBaseFunctionValueAt(FloatArray &answer, FloatArray &coords, IntArray &dofIDs, EngngModel &myEngngModel)
Abstract base class for all finite elements.
Base class for dof managers.
#define _IFT_SolutionbasedShapeFunction_DumpSnapshots
virtual ~SolutionbasedShapeFunction()
GeneralBoundaryCondition * createBoundaryCondition(const char *name, int num, Domain *domain)
Creates new instance of boundary condition corresponding to given keyword.
int giveNumberOfSpatialDimensions()
Returns number of spatial dimensions.
bool useCorrectionFactors
Class implementing an array of integers.
int & at(int i)
Coefficient access function.
virtual FEInterpolation * giveInterpolation() const
virtual void setBcId(int bcId)
Overwrites the boundary condition id (0-inactive BC), intended for specific purposes such as coupling...
GeneralBoundaryCondition * giveBc(int n)
Service for accessing particular domain bc.
#define _IFT_GeneralBoundaryCondition_timeFunct
virtual IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description stored in input record.
Class representing a general abstraction for finite element interpolation class.
Class representing "master" degree of freedom.
EngngModel * InstanciateProblem(DataReader &dr, problemMode mode, int contextFlag, EngngModel *_master, bool parallelFlag)
Instanciates the new problem.
void copyDofManagersToSurfaceData(modeStruct *mode, IntArray nodeList, bool isPlus, bool isMinus, bool isZero)
void insertSorted(int value, int allocChunk=0)
Inserts given value into a receiver, which is assumed to be sorted.
int giveSetNumber()
Gives the set number which boundary condition is applied to.
void giveUnknownVector(FloatArray &answer, const IntArray &dofMask, ValueModeType mode, TimeStep *tStep, bool padding=false)
Assembles the vector of unknowns in global c.s for given dofs of receiver.
virtual int giveBcId()=0
Returns the id of associated boundary condition, if there is any.
Class implementing Dirichlet boundary condition on DOF (primary boundary condition).
#define OOFEM_LOG_INFO(...)
Element * giveElement(int n)
Service for accessing particular domain fe element.
double dotProduct(const FloatArray &x) const
Computes the dot product (or inner product) of receiver and argument.
void insertOnce(int p)
Insert once (does not make any assumption about receiver state or ordering, quite inefficient)...
void clear()
Clears the array (zero size).
DofIDItem
Type representing particular dof type.
void setBoundaryConditionOnDof(Dof *d, double value)
virtual void boundaryLocal2Global(FloatArray &answer, int boundary, const FloatArray &lcoords, const FEICellGeometry &cellgeo)=0
Maps the local boundary coordinates to global.
Set of elements, boundaries, edges and/or nodes.
SpatialLocalizer * giveSpatialLocalizer()
Returns receiver's associated spatial localizer.
DofIDItem giveDofID() const
Returns DofID value of receiver, which determines type of of unknown connected to receiver (e...
Wrapper around element definition to provide FEICellGeometry interface.
void resizeWithValues(int n, int allocChunk=0)
Checks size of receiver towards requested bounds.
Set * giveSet(int n)
Service for accessing particular domain set.
#define _IFT_SolutionbasedShapeFunction_Externalset
virtual double boundaryGiveTransformationJacobian(int boundary, const FloatArray &lcoords, const FEICellGeometry &cellgeo)=0
Evaluates the determinant of the transformation Jacobian on the requested boundary.
virtual IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description stored in input record.
IntArray dofs
Dofs that b.c. is applied to (relevant for Dirichlet type b.c.s).
Abstract base class for all active boundary conditions.
Abstract base class for all boundary conditions of problem.
virtual void giveElementDofIDMask(IntArray &answer) const
Returns element dof mask for node.
double at(int i, int j) const
Coefficient access function.
void initializeSurfaceData(modeStruct *mode)
Class representing "slave" degree of freedom with an active boundary condition.
void appendDof(Dof *dof)
Adds the given Dof into the receiver.
virtual void boundaryGiveNodes(IntArray &answer, int boundary)=0
Gives the boundary nodes for requested boundary number.
int giveNextFreeDofID(int increment=1)
Gives the next free dof ID.
Class representing vector of real numbers.
virtual int init(bool force=false)
Initialize receiver data structure if not done previously If force is set to true, the initialization is enforced (useful if domain geometry has changed)
Implementation of matrix containing floating point numbers.
IRResultType
Type defining the return values of InputRecord reading operations.
#define _IFT_SolutionbasedShapeFunction_UseCorrectionFactors
virtual void pY() const
Print receiver on stdout with high accuracy.
void resize(int rows, int cols)
Checks size of receiver towards requested bounds.
virtual Element * giveElementClosestToPoint(FloatArray &lcoords, FloatArray &closest, const FloatArray &coords, int region=0)=0
Returns the element closest to a given point.
virtual void printYourself() const
Print receiver on stdout.
virtual IntegrationRule * giveBoundaryIntegrationRule(int order, int boundary)
Sets up a suitable integration rule for integrating over the requested boundary.
Dof * giveDofWithID(int dofID) const
Returns DOF with given dofID; issues error if not present.
void zero()
Zeroes all coefficients of receiver.
EngngModel * myEngngModel
ClassFactory & classFactory
#define _IFT_BoundaryCondition_PrescribedValue
[rn,optional] Prescribed value of all DOFs
void logDataMsg(const char *c, T myArray)
#define _IFT_Load_components
virtual Dof * giveMasterDof(ActiveDof *dof, int mdof)
Give the pointer to master dof belonging to active DOF.
virtual FloatArray * giveCoordinates()
void zero()
Zeroes all coefficient of receiver.
Domain * giveDomain() const
#define _IFT_SolutionbasedShapeFunction_ShapeFunctionFile
int min(int i, int j)
Returns smaller value from two given decimals.
std::vector< std::unique_ptr< Element > > & giveElements()
void setLoads(EngngModel *myEngngModel, int d)
virtual DofManager * giveInternalDofManager(int i)
Gives an internal dof manager from receiver.
Abstract base class representing the "problem" under consideration.
DofManager * giveDofManager() const
int giveSize() const
Returns the size of receiver.
Class representing the implementation of plain text date reader.
virtual void computeField(ValueModeType mode, TimeStep *tStep, const FloatArray &lcoords, FloatArray &answer)
Computes the unknown vector interpolated at the specified local coordinates.
Node * giveNode(int n)
Service for accessing particular domain node.
the oofem namespace is to define a context or scope in which all oofem names are defined.
DofManager * giveDofManager(int i) const
void computeCorrectionFactors(modeStruct &myMode, IntArray *Dofs, double *am, double *ap)
Domain * giveDomain(int n)
Service for accessing particular problem domain.
Class implementing node in finite element mesh.
void updateModelWithFactors(modeStruct *m)
Abstract class Dof represents Degree Of Freedom in finite element mesh.
DofManager * giveDofManager(int n)
Service for accessing particular domain dof manager.
virtual int giveNumberOfMasterDofs(ActiveDof *dof)
Allows for active boundary conditions to handle their own special DOF.
virtual void boundaryEvalN(FloatArray &answer, int boundary, const FloatArray &lcoords, const FEICellGeometry &cellgeo)=0
Evaluates the basis functions on the requested boundary.
Class representing integration point in finite element program.
#define OOFEM_WARNING(...)
std::vector< SurfaceDataStruct * > SurfaceData
Class representing solution step.
void add(const FloatArray &src)
Adds array src to receiver.
void giveValueAtPoint(FloatArray &answer, const FloatArray &coords, IntArray &dofID, EngngModel &myEngngModel)
giveValueAtPoint
virtual double giveUnknown(PrimaryField &field, ValueModeType mode, TimeStep *tStep, ActiveDof *dof)
Computes the value of the dof.
void resize(int s)
Resizes receiver towards requested size.