本文整理汇总了C++中libutilities::SessionReaderSharedPtr::DefinesParameter方法的典型用法代码示例。如果您正苦于以下问题:C++ SessionReaderSharedPtr::DefinesParameter方法的具体用法?C++ SessionReaderSharedPtr::DefinesParameter怎么用?C++ SessionReaderSharedPtr::DefinesParameter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类libutilities::SessionReaderSharedPtr
的用法示例。
在下文中一共展示了SessionReaderSharedPtr::DefinesParameter方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: convertCooToBco
/**
* Allocates a new DNekSparseMat object from the given specification.
* @param rows Number of rows in matrix.
* @param columns Number of columns in matrix.
* @param cooMat ?
*/
GlobalMatrix::GlobalMatrix(
const LibUtilities::SessionReaderSharedPtr& pSession,
unsigned int rows,
unsigned int columns,
const COOMatType &cooMat,
const MatrixStorage& matStorage):
m_smvbsrmatrix(),
m_rows(rows),
m_mulCallsCounter(0)
{
MatrixStorageType storageType = pSession->
GetSolverInfoAsEnum<MatrixStorageType>("GlobalMatrixStorageType");
unsigned int brows, bcols;
// Size of dense matrix sub-blocks
int block_size = 1;
BCOMatType bcoMat;
// assuming current sparse format allows
// block-sparse data representation
if(pSession->DefinesParameter("SparseBlockSize"))
{
pSession->LoadParameter("SparseBlockSize", block_size);
ASSERTL1(block_size > 0,"SparseBlockSize parameter must to be positive");
}
brows = rows / block_size + (rows % block_size > 0);
bcols = columns / block_size + (columns % block_size > 0);
if (rows % block_size > 0) m_copyOp = true;
if (m_copyOp)
{
m_tmpin = Array<OneD, NekDouble> (brows*block_size, 0.0);
m_tmpout = Array<OneD, NekDouble> (brows*block_size, 0.0);
}
convertCooToBco(brows, bcols, block_size, cooMat, bcoMat);
size_t matBytes;
switch(storageType)
{
case eSmvBSR:
{
// Create zero-based Smv-multiply BSR sparse storage holder
DNekSmvBsrMat::SparseStorageSharedPtr sparseStorage =
MemoryManager<DNekSmvBsrMat::StorageType>::
AllocateSharedPtr(
brows, bcols, block_size, bcoMat, matStorage );
// Create sparse matrix
m_smvbsrmatrix = MemoryManager<DNekSmvBsrMat>::
AllocateSharedPtr( sparseStorage );
matBytes = m_smvbsrmatrix->GetMemoryFootprint();
}
break;
default:
NEKERROR(ErrorUtil::efatal,"Unsupported sparse storage type chosen");
}
cout << "Global matrix storage type: "
<< MatrixStorageTypeMap[storageType] << endl;
std::cout << "Global matrix memory, bytes = " << matBytes;
if (matBytes/(1024*1024) > 0)
{
std::cout << " ("<< matBytes/(1024*1024) <<" MB)" << std::endl;
}
else
{
std::cout << " ("<< matBytes/1024 <<" KB)" << std::endl;
}
std::cout << "Sparse storage block size = " << block_size << std::endl;
}
示例2: main
int main(int argc, char *argv[])
{
string fname = std::string(argv[2]);
int fdot = fname.find_last_of('.');
if (fdot != std::string::npos)
{
string ending = fname.substr(fdot);
// If .chk or .fld we exchange the extension in the output file.
// For all other files (e.g. .bse) we append the extension to avoid
// conflicts.
if (ending == ".chk" || ending == ".fld")
{
fname = fname.substr(0,fdot);
}
}
fname = fname + ".txt";
int cnt;
int id1, id2;
int i, j, n, e, b;
Array<OneD, NekDouble> auxArray;
int nBndEdgePts, nBndEdges, nBndRegions;
if (argc < 3)
{
fprintf(stderr,
"Usage: ExtractSurface3DCFS meshfile fieldFile\n");
fprintf(stderr,
"Extracts a surface from a 3D fld file"
"(only for CompressibleFlowSolver and purely 3D .fld files)\n");
exit(1);
}
LibUtilities::SessionReaderSharedPtr vSession
= LibUtilities::SessionReader::CreateInstance(3, argv);
std::string m_ViscosityType;
NekDouble m_gamma;
NekDouble m_pInf;
NekDouble m_rhoInf;
NekDouble m_uInf;
NekDouble m_vInf;
NekDouble m_wInf;
NekDouble m_gasConstant;
NekDouble m_Twall;
NekDouble m_mu;
NekDouble m_thermalConductivity;
int m_spacedim = 3;
int nDimensions = m_spacedim;
int phys_offset;
// Get gamma parameter from session file.
ASSERTL0(vSession->DefinesParameter("Gamma"),
"Compressible flow sessions must define a Gamma parameter.");
vSession->LoadParameter("Gamma", m_gamma, 1.4);
// Get E0 parameter from session file.
ASSERTL0(vSession->DefinesParameter("pInf"),
"Compressible flow sessions must define a pInf parameter.");
vSession->LoadParameter("pInf", m_pInf, 101325);
// Get rhoInf parameter from session file.
ASSERTL0(vSession->DefinesParameter("rhoInf"),
"Compressible flow sessions must define a rhoInf parameter.");
vSession->LoadParameter("rhoInf", m_rhoInf, 1.225);
// Get uInf parameter from session file.
ASSERTL0(vSession->DefinesParameter("uInf"),
"Compressible flow sessions must define a uInf parameter.");
vSession->LoadParameter("uInf", m_uInf, 0.1);
// Get vInf parameter from session file.
if (m_spacedim == 2 || m_spacedim == 3)
{
ASSERTL0(vSession->DefinesParameter("vInf"),
"Compressible flow sessions must define a vInf parameter"
"for 2D/3D problems.");
vSession->LoadParameter("vInf", m_vInf, 0.0);
}
// Get wInf parameter from session file.
if (m_spacedim == 3)
{
ASSERTL0(vSession->DefinesParameter("wInf"),
"Compressible flow sessions must define a wInf parameter"
"for 3D problems.");
vSession->LoadParameter("wInf", m_wInf, 0.0);
}
vSession->LoadParameter ("GasConstant", m_gasConstant, 287.058);
vSession->LoadParameter ("Twall", m_Twall, 300.15);
vSession->LoadSolverInfo("ViscosityType", m_ViscosityType, "Constant");
vSession->LoadParameter ("mu", m_mu, 1.78e-05);
vSession->LoadParameter ("thermalConductivity",
m_thermalConductivity, 0.0257);
//.........这里部分代码省略.........