本文整理汇总了C++中Array2D::deallocate方法的典型用法代码示例。如果您正苦于以下问题:C++ Array2D::deallocate方法的具体用法?C++ Array2D::deallocate怎么用?C++ Array2D::deallocate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Array2D
的用法示例。
在下文中一共展示了Array2D::deallocate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
void Strand2dFCBlockMesh::initialize(const int& level0,
const int& meshOrder0,
const int& nSurfElem0,
const int& nSurfNodeG,
const int& nBndNode0,
const int& nStrandNodeG,
const int& nCompBd0,
int** surfElemG,
const Array1D<int>& bndNodeG,
const Array2D<double>& surfXG,
const Array1D<double>& strandXG,
const Array1D<int>& surfElemTagG,
const Array1D<int>& bndNodeTagG,
const Array2D<double>& bndNodeNormalG)
{
// copy dimensions for this block
level = level0;
meshOrder = meshOrder0;
nSurfElem = nSurfElem0;
nBndNode = nBndNode0;
nCompBd = nCompBd0;
// allocate space for the mesh data, and copy the known data
surfElem.allocate(nSurfElem,meshOrder+1);
surfElemTag.allocate(nSurfElem);
bndNode.allocate(nBndNode);
bndNodeTag.allocate(nBndNode);
bndNodeNormal.allocate(nBndNode,2);
for (int n=0; n<nSurfElem; n++) surfElemTag(n) = surfElemTagG(n);
for (int n=0; n<nBndNode; n++){
bndNodeTag(n) = bndNodeTagG(n);
bndNodeNormal(n,0) = bndNodeNormalG(n,0);
bndNodeNormal(n,1) = bndNodeNormalG(n,1);
}
// form surface elements of the desired order, count surface nodes
int n1,n2;
Array1D<int> flag(nSurfNodeG);
flag.set(-1);
nSurfNode = 0;
for (int n=0; n<nSurfElem; n++){ //add element end points first
n1 = surfElemG[n][1];
n2 = surfElemG[n][2];
if (flag(n1) == -1) flag(n1) = nSurfNode++;
if (flag(n2) == -1) flag(n2) = nSurfNode++;
surfElem(n,0) = flag(n1);
surfElem(n,1) = flag(n2);
}
for (int n=0; n<nSurfElem; n++) //add interior dofs next
for (int j=2; j<meshOrder+1; j++) surfElem(n,j) = nSurfNode++;
// point the bndNode array to the new node numbers
for (int n=0; n<nBndNode; n++) bndNode(n) = flag(bndNodeG(n));
// find surface mesh coordinates based on mappings from the mesh file
Array1D<double> ss(meshOrder+1);
int spacing=0; // assume equal spacing for now
solutionPoints1D(meshOrder, //find s-locations based on desired spacing
spacing,
&ss(0));
surfX.allocate(nSurfNode,2);
surfX.set(0.);
bool test=false;
int orderM;
double lm;
Array1D<double> sM;
Array2D<double> lcM;
flag.deallocate();
flag.allocate(nSurfNode);
flag.set(-1);
for (int n=0; n<nSurfElem; n++){
orderM = surfElemG[n][0];
// s-locations using numbering consistent with the mesh
sM.allocate(orderM+1);
solutionPoints1D(orderM,
spacing,
&sM(0));
// lagrange polynomials at the sM locations
lcM.allocate(orderM+1,orderM+1);
lagrangePoly1D(test,
orderM,
&sM(0),
&lcM(0,0));
// evaluate the x-coordinates at the local solution points
for (int i=0; i<meshOrder+1; i++) //ith local point
if (flag(surfElem(n,i)) == -1){//haven't computed this location yet
for (int m=0; m<orderM+1; m++){ //mth Lagrange poly. used in mapping
lm = 0.;
for (int k=0; k<orderM+1; k++) lm += pow(ss(i),k)*lcM(m,k);
surfX(surfElem(n,i),0) += lm*surfXG(surfElemG[n][m+1],0);
surfX(surfElem(n,i),1) += lm*surfXG(surfElemG[n][m+1],1);
}
flag(surfElem(n,i)) = 0;
//.........这里部分代码省略.........