Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
DAIndex Class Reference
Collaboration diagram for DAIndex:
Collaboration graph
[legend]

Public Member Functions

 DAIndex (const fvMesh &mesh, const DAOption &daOption, const DAModel &daModel)
 Constructors. More...
 
virtual ~DAIndex ()
 Destructor. More...
 

Public Attributes

List< word > adjStateNames
 list of adjoint state names for a specific solver More...
 
HashTable< word > adjStateType
 hash table of adjoint state types, e.g., volVectorState for a given state name More...
 
label nLocalCells
 local cell size More...
 
label nLocalFaces
 local face size More...
 
label nLocalPoints
 local point size More...
 
label nLocalXv
 local Xv size (point size*3) More...
 
label nLocalBoundaryFaces
 local boundary face size More...
 
label nLocalInternalFaces
 local internal face size More...
 
label nLocalBoundaryPatches
 local boundary patch size More...
 
label nLocalCoupledBFaces
 local coupled boundary patch size More...
 
labelList bFacePatchI
 
labelList bFaceFaceI
 
HashTable< label > stateLocalIndexOffset
 
HashTable< label > adjStateID
 a unique number ID for adjoint states, it depends on the sequence of adjStateNames More...
 
label nGlobalCells
 global cell size More...
 
label nGlobalFaces
 global face size More...
 
label nGlobalXv
 global Xv size (global face size*3) More...
 
label nGlobalObjFuncFaces
 global objective function face size More...
 
label nGlobalCoupledBFaces
 global coupled boundary face size More...
 
label nLocalAdjointStates
 number of local adjoint states (including all cells and faces) More...
 
label nGlobalAdjointStates
 number of global adjoint states (including all cells and faces) More...
 
label nLocalAdjointBoundaryStates
 local adjoint boundary states that do not contain phis More...
 
label nVolScalarStates
 number of state variables for volScalarField More...
 
label nVolVectorStates
 number of state variables for volVectorField More...
 
label nSurfaceScalarStates
 number of state variables for surfaceScalarField More...
 
label nModelStates
 number of model states, NOTE: they are counted separately More...
 

Protected Member Functions

void writeAdjointIndexing ()
 write the adjoint indexing for debugging More...
 

Protected Attributes

const fvMesh & mesh_
 Foam::fvMesh object. More...
 
const DAOptiondaOption_
 Foam::DAOption object. More...
 
const DAModeldaModel_
 DAModel object. More...
 
HashTable< wordList > stateInfo_
 the StateInfo_ list from DAStateInfo object More...
 

global indexing variables, they will be used to transfer local and global indices

globalIndex globalAdjointStateNumbering
 
globalIndex globalCellNumbering
 
globalIndex globalCellVectorNumbering
 
globalIndex globalFaceNumbering
 
globalIndex globalCoupledBFaceNumbering
 
globalIndex globalObjFuncGeoNumbering
 
globalIndex globalXvNumbering
 
globalIndex globalVolScalarFieldNumbering
 
globalIndex globalVolVectorFieldNumbering
 
globalIndex globalSurfaceScalarFieldNumbering
 
labelIOList pointProcAddressing
 a list to map the point index from decomposed domains to the original un-decomposed domain More...
 
label nUndecomposedPoints
 number of points for the un-decomposed domain More...
 
labelList isCoupledFace
 for a given face index, return whether this face is a coupled boundary face More...
 
wordList adjStateName4LocalAdjIdx
 given a local adjoint state index, return its state name More...
 
scalarList cellIFaceI4LocalAdjIdx
 given a local adjoint state index, return its cell/face index More...
 
labelList faceOwner
 owner cell of a given face More...
 
labelList phiAccumulatdOffset
 the accumulated phi indexing offset for cell-by-cell indexing More...
 
labelList phiLocalOffset
 phi local indexing offset for cell-by-cell indexing More...
 
void calcStateLocalIndexOffset (HashTable< label > &offset)
 calculate stateLocalIndexOffset More...
 
void calcAdjStateID (HashTable< label > &adjStateID)
 set adjoint state unique ID: adjStateID More...
 
void calcLocalIdxLists (wordList &adjStateName4LocalAdjIdx, scalarList &cellIFaceI4LocalAdjIdx)
 compute local lists such as adjStateName4LocalAdjIdx and cellIFaceI4LocalAdjIdx; More...
 
label getLocalAdjointStateIndex (const word stateName, const label idxI, const label comp=-1) const
 get local adjoint index for a given state name, cell/face indxI and its component (optional, only for vector states) More...
 
label getGlobalAdjointStateIndex (const word stateName, const label idxI, const label comp=-1) const
 get global adjoint index for a given state name, cell/face indxI and its component (optional, only for vector states) More...
 
label getGlobalXvIndex (const label idxPoint, const label idxCoord) const
 get global Xv index for a given point index and coordinate component (x, y, or z) More...
 
label getLocalXvIndex (const label idxPoint, const label idxCoord) const
 get local Xv index for a given point index and coordinate component (x, y, or z) More...
 
label getLocalCellIndex (const label cellI) const
 get local cell index for a local cell index More...
 
label getGlobalCellIndex (const label cellI) const
 get global cell index for a local cell index More...
 
label getLocalCellVectorIndex (const label cellI, const label comp) const
 get local cell index for a local cell vector index More...
 
label getGlobalCellVectorIndex (const label cellI, const label comp) const
 get global cell index for a local cell vector index More...
 
label getLocalFaceIndex (const label faceI) const
 get local face index for a local face index More...
 
label getGlobalFaceIndex (const label faceI) const
 get global face index for a local face index More...
 
void calcAdjStateID4GlobalAdjIdx (labelList &adjStateID4GlobalAdjIdx) const
 compute global list adjStateID4GlobalAdjIdx that stores the stateID for a given globalAdjIndx More...
 
void printIndices () const
 print all the sizes and indices More...
 
void printMatChars (const Mat matIn) const
 print petsc matrix statistics such as the max on/off diagonral ratio More...
 
void getMatNonZeros (const Mat matIn, label &maxCols, scalar &allNonZeros) const
 get number of non zeros for a matrix More...
 

Detailed Description

Definition at line 32 of file DAIndex.H.

Constructor & Destructor Documentation

◆ DAIndex()

DAIndex ( const fvMesh &  mesh,
const DAOption daOption,
const DAModel daModel 
)

Constructors.

Definition at line 17 of file DAIndex.C.

◆ ~DAIndex()

virtual ~DAIndex ( )
inlinevirtual

Destructor.

Definition at line 66 of file DAIndex.H.

Member Function Documentation

◆ writeAdjointIndexing()

void writeAdjointIndexing ( )
protected

write the adjoint indexing for debugging

Definition at line 1283 of file DAIndex.C.

References DAIndex::bFaceFaceI, DAIndex::bFacePatchI, forAll(), DAIndex::getGlobalAdjointStateIndex(), DAIndex::getGlobalXvIndex(), DAIndex::mesh_, DAIndex::nLocalInternalFaces, and DAIndex::stateInfo_.

Here is the call graph for this function:

◆ calcStateLocalIndexOffset()

void calcStateLocalIndexOffset ( HashTable< label > &  offset)

◆ calcAdjStateID()

void calcAdjStateID ( HashTable< label > &  adjStateID)

set adjoint state unique ID: adjStateID

Definition at line 397 of file DAIndex.C.

References DAIndex::adjStateID, forAll(), and DAIndex::stateInfo_.

Here is the call graph for this function:

◆ calcLocalIdxLists()

void calcLocalIdxLists ( wordList &  adjStateName4LocalAdjIdx,
scalarList &  cellIFaceI4LocalAdjIdx 
)

compute local lists such as adjStateName4LocalAdjIdx and cellIFaceI4LocalAdjIdx;

Definition at line 441 of file DAIndex.C.

References forAll(), DAIndex::getLocalAdjointStateIndex(), DAIndex::mesh_, DAIndex::nLocalAdjointStates, and DAIndex::stateInfo_.

Here is the call graph for this function:

◆ getLocalAdjointStateIndex()

label getLocalAdjointStateIndex ( const word  stateName,
const label  idxI,
const label  comp = -1 
) const

◆ getGlobalAdjointStateIndex()

label getGlobalAdjointStateIndex ( const word  stateName,
const label  idxI,
const label  comp = -1 
) const

get global adjoint index for a given state name, cell/face indxI and its component (optional, only for vector states)

Definition at line 661 of file DAIndex.C.

References DAIndex::getLocalAdjointStateIndex(), and DAIndex::globalAdjointStateNumbering.

Referenced by DAJacCon::addConMatCell(), DAJacCon::addConMatCellFaces(), DAJacCon::addConMatNeighbourCells(), DAJacCon::addStateConnections(), DAIndex::calcAdjStateID4GlobalAdjIdx(), DAIndex::printMatChars(), DAPartDeriv::setNormStatePerturbVec(), DAJacCon::setPIVVec(), DAJacCondRdW::setupdRdWCon(), and DAIndex::writeAdjointIndexing().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getGlobalXvIndex()

label getGlobalXvIndex ( const label  idxPoint,
const label  idxCoord 
) const

get global Xv index for a given point index and coordinate component (x, y, or z)

Definition at line 702 of file DAIndex.C.

References DAIndex::getLocalXvIndex(), and DAIndex::globalXvNumbering.

Referenced by DAIndex::writeAdjointIndexing().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getLocalXvIndex()

label getLocalXvIndex ( const label  idxPoint,
const label  idxCoord 
) const

get local Xv index for a given point index and coordinate component (x, y, or z)

Definition at line 733 of file DAIndex.C.

Referenced by DAIndex::getGlobalXvIndex(), DAField::ofMesh2PointVec(), DAField::point2OFMesh(), and DAField::pointVec2OFMesh().

Here is the caller graph for this function:

◆ getLocalCellIndex()

label getLocalCellIndex ( const label  cellI) const

get local cell index for a local cell index

Definition at line 760 of file DAIndex.C.

Referenced by DAIndex::getGlobalCellIndex().

Here is the caller graph for this function:

◆ getGlobalCellIndex()

label getGlobalCellIndex ( const label  cellI) const

get global cell index for a local cell index

Definition at line 782 of file DAIndex.C.

References DAIndex::getLocalCellIndex(), and DAIndex::globalCellNumbering.

Here is the call graph for this function:

◆ getLocalCellVectorIndex()

label getLocalCellVectorIndex ( const label  cellI,
const label  comp 
) const

get local cell index for a local cell vector index

Definition at line 808 of file DAIndex.C.

Referenced by DAIndex::getGlobalCellVectorIndex().

Here is the caller graph for this function:

◆ getGlobalCellVectorIndex()

label getGlobalCellVectorIndex ( const label  cellI,
const label  comp 
) const

get global cell index for a local cell vector index

Definition at line 834 of file DAIndex.C.

References DAIndex::getLocalCellVectorIndex(), and DAIndex::globalCellVectorNumbering.

Here is the call graph for this function:

◆ getLocalFaceIndex()

label getLocalFaceIndex ( const label  faceI) const

get local face index for a local face index

Definition at line 864 of file DAIndex.C.

Referenced by DAIndex::getGlobalFaceIndex().

Here is the caller graph for this function:

◆ getGlobalFaceIndex()

label getGlobalFaceIndex ( const label  faceI) const

get global face index for a local face index

Definition at line 886 of file DAIndex.C.

References DAIndex::getLocalFaceIndex(), and DAIndex::globalFaceNumbering.

Here is the call graph for this function:

◆ calcAdjStateID4GlobalAdjIdx()

void calcAdjStateID4GlobalAdjIdx ( labelList &  adjStateID4GlobalAdjIdx) const

compute global list adjStateID4GlobalAdjIdx that stores the stateID for a given globalAdjIndx

Definition at line 912 of file DAIndex.C.

References DAIndex::adjStateID, forAll(), DAIndex::getGlobalAdjointStateIndex(), DAIndex::mesh_, DAIndex::nGlobalAdjointStates, DAIndex::nLocalAdjointStates, and DAIndex::stateInfo_.

Referenced by DAJacCon::setupStateBoundaryConID().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ printIndices()

void printIndices ( ) const
inline

◆ printMatChars()

void printMatChars ( const Mat  matIn) const

print petsc matrix statistics such as the max on/off diagonral ratio

Definition at line 1010 of file DAIndex.C.

References DAIndex::adjStateID, DAIndex::bFaceFaceI, DAIndex::bFacePatchI, forAll(), DAIndex::getGlobalAdjointStateIndex(), DAIndex::getMatNonZeros(), DAIndex::mesh_, DAIndex::nLocalInternalFaces, DAIndex::stateInfo_, and dafoam_plot3dtransform::vals.

Referenced by DAPartDerivdRdW::calcPartDerivMat().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getMatNonZeros()

void getMatNonZeros ( const Mat  matIn,
label &  maxCols,
scalar &  allNonZeros 
) const

get number of non zeros for a matrix

Definition at line 1236 of file DAIndex.C.

References dafoam_plot3dtransform::vals.

Referenced by DAIndex::printMatChars().

Here is the caller graph for this function:

Member Data Documentation

◆ mesh_

const fvMesh& mesh_
protected

◆ daOption_

const DAOption& daOption_
protected

◆ daModel_

const DAModel& daModel_
protected

DAModel object.

Definition at line 50 of file DAIndex.H.

◆ stateInfo_

HashTable<wordList> stateInfo_
protected

◆ adjStateNames

List<word> adjStateNames

◆ adjStateType

HashTable<word> adjStateType

◆ nLocalCells

label nLocalCells

local cell size

Definition at line 83 of file DAIndex.H.

Referenced by DAIndex::calcStateLocalIndexOffset(), and DAFoamFvSource::compute().

◆ nLocalFaces

label nLocalFaces

local face size

Definition at line 86 of file DAIndex.H.

Referenced by DAIndex::calcStateLocalIndexOffset().

◆ nLocalPoints

label nLocalPoints

local point size

Definition at line 89 of file DAIndex.H.

◆ nLocalXv

label nLocalXv

local Xv size (point size*3)

Definition at line 92 of file DAIndex.H.

◆ nLocalBoundaryFaces

label nLocalBoundaryFaces

local boundary face size

Definition at line 95 of file DAIndex.H.

Referenced by DAJacCon::calcNeiBFaceGlobalCompact().

◆ nLocalInternalFaces

label nLocalInternalFaces

◆ nLocalBoundaryPatches

label nLocalBoundaryPatches

local boundary patch size

Definition at line 101 of file DAIndex.H.

◆ nLocalCoupledBFaces

label nLocalCoupledBFaces

local coupled boundary patch size

Definition at line 104 of file DAIndex.H.

Referenced by DAJacCon::combineStateBndCon(), DAJacCon::setupStateBoundaryCon(), and DAJacCon::setupStateBoundaryConID().

◆ bFacePatchI

labelList bFacePatchI

◆ bFaceFaceI

labelList bFaceFaceI

◆ stateLocalIndexOffset

HashTable<label> stateLocalIndexOffset

hash table of local state variable index offset, see initializeStateLocalIndexOffset for definition. This will be used in determing the local indexing for adjoint states. It differs depending on whether we use state-by-state or cell-by-cell ordering

Definition at line 122 of file DAIndex.H.

Referenced by DAIndex::getLocalAdjointStateIndex().

◆ adjStateID

HashTable<label> adjStateID

a unique number ID for adjoint states, it depends on the sequence of adjStateNames

Definition at line 125 of file DAIndex.H.

Referenced by DAJacCon::addBoundaryFaceConnections(), DAIndex::calcAdjStateID(), DAIndex::calcAdjStateID4GlobalAdjIdx(), and DAIndex::printMatChars().

◆ nGlobalCells

label nGlobalCells

global cell size

Definition at line 129 of file DAIndex.H.

Referenced by DAIndex::printIndices().

◆ nGlobalFaces

label nGlobalFaces

global face size

Definition at line 132 of file DAIndex.H.

Referenced by DAIndex::printIndices().

◆ nGlobalXv

label nGlobalXv

global Xv size (global face size*3)

Definition at line 135 of file DAIndex.H.

Referenced by DAIndex::printIndices().

◆ nGlobalObjFuncFaces

label nGlobalObjFuncFaces

global objective function face size

Definition at line 138 of file DAIndex.H.

◆ nGlobalCoupledBFaces

label nGlobalCoupledBFaces

global coupled boundary face size

Definition at line 141 of file DAIndex.H.

◆ nLocalAdjointStates

label nLocalAdjointStates

◆ nGlobalAdjointStates

label nGlobalAdjointStates

number of global adjoint states (including all cells and faces)

Definition at line 148 of file DAIndex.H.

Referenced by DAIndex::calcAdjStateID4GlobalAdjIdx(), DAJacCon::createConnectionMat(), DAColoring::parallelD2Coloring(), DAIndex::printIndices(), and DAJacCon::setupStateBoundaryConID().

◆ nLocalAdjointBoundaryStates

label nLocalAdjointBoundaryStates

local adjoint boundary states that do not contain phis

Definition at line 151 of file DAIndex.H.

◆ nVolScalarStates

label nVolScalarStates

number of state variables for volScalarField

Definition at line 154 of file DAIndex.H.

Referenced by DAIndex::getLocalAdjointStateIndex().

◆ nVolVectorStates

label nVolVectorStates

number of state variables for volVectorField

Definition at line 157 of file DAIndex.H.

Referenced by DAIndex::getLocalAdjointStateIndex().

◆ nSurfaceScalarStates

label nSurfaceScalarStates

number of state variables for surfaceScalarField

Definition at line 160 of file DAIndex.H.

◆ nModelStates

label nModelStates

number of model states, NOTE: they are counted separately

Definition at line 163 of file DAIndex.H.

Referenced by DAIndex::getLocalAdjointStateIndex().

◆ globalAdjointStateNumbering

globalIndex globalAdjointStateNumbering

◆ globalCellNumbering

globalIndex globalCellNumbering

Definition at line 168 of file DAIndex.H.

Referenced by DAIndex::getGlobalCellIndex().

◆ globalCellVectorNumbering

globalIndex globalCellVectorNumbering

Definition at line 169 of file DAIndex.H.

Referenced by DAIndex::getGlobalCellVectorIndex().

◆ globalFaceNumbering

globalIndex globalFaceNumbering

Definition at line 170 of file DAIndex.H.

Referenced by DAIndex::getGlobalFaceIndex().

◆ globalCoupledBFaceNumbering

globalIndex globalCoupledBFaceNumbering

◆ globalObjFuncGeoNumbering

globalIndex globalObjFuncGeoNumbering

Definition at line 172 of file DAIndex.H.

◆ globalXvNumbering

globalIndex globalXvNumbering

Definition at line 173 of file DAIndex.H.

Referenced by DAIndex::getGlobalXvIndex().

◆ globalVolScalarFieldNumbering

globalIndex globalVolScalarFieldNumbering

Definition at line 174 of file DAIndex.H.

◆ globalVolVectorFieldNumbering

globalIndex globalVolVectorFieldNumbering

Definition at line 175 of file DAIndex.H.

◆ globalSurfaceScalarFieldNumbering

globalIndex globalSurfaceScalarFieldNumbering

Definition at line 176 of file DAIndex.H.

◆ pointProcAddressing

labelIOList pointProcAddressing

a list to map the point index from decomposed domains to the original un-decomposed domain

Definition at line 180 of file DAIndex.H.

◆ nUndecomposedPoints

label nUndecomposedPoints

number of points for the un-decomposed domain

Definition at line 183 of file DAIndex.H.

Referenced by DAIndex::printIndices().

◆ isCoupledFace

labelList isCoupledFace

for a given face index, return whether this face is a coupled boundary face

Definition at line 186 of file DAIndex.H.

Referenced by DAJacCon::addBoundaryFaceConnections().

◆ adjStateName4LocalAdjIdx

wordList adjStateName4LocalAdjIdx

given a local adjoint state index, return its state name

Definition at line 189 of file DAIndex.H.

◆ cellIFaceI4LocalAdjIdx

scalarList cellIFaceI4LocalAdjIdx

given a local adjoint state index, return its cell/face index

Definition at line 192 of file DAIndex.H.

◆ faceOwner

labelList faceOwner

owner cell of a given face

Definition at line 195 of file DAIndex.H.

Referenced by DAIndex::calcStateLocalIndexOffset(), and DAIndex::getLocalAdjointStateIndex().

◆ phiAccumulatdOffset

labelList phiAccumulatdOffset

the accumulated phi indexing offset for cell-by-cell indexing

Definition at line 198 of file DAIndex.H.

Referenced by DAIndex::calcStateLocalIndexOffset(), and DAIndex::getLocalAdjointStateIndex().

◆ phiLocalOffset

labelList phiLocalOffset

phi local indexing offset for cell-by-cell indexing

Definition at line 201 of file DAIndex.H.

Referenced by DAIndex::calcStateLocalIndexOffset(), and DAIndex::getLocalAdjointStateIndex().


The documentation for this class was generated from the following files: