本文整理汇总了C++中PetscStrstr函数的典型用法代码示例。如果您正苦于以下问题:C++ PetscStrstr函数的具体用法?C++ PetscStrstr怎么用?C++ PetscStrstr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PetscStrstr函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PetscDLLibraryRegister
/*@C
PFInitializePackage - This function initializes everything in the PF package. It is called
from PetscDLLibraryRegister() when using dynamic libraries, and on the first call to PFCreate()
when using static libraries.
Input Parameter:
. path - The dynamic library path, or PETSC_NULL
Level: developer
.keywords: Vec, initialize, package
.seealso: PetscInitialize()
@*/
PetscErrorCode PFInitializePackage(const char path[])
{
char logList[256];
char *className;
PetscBool opt;
PetscErrorCode ierr;
PetscFunctionBegin;
if (PFPackageInitialized) PetscFunctionReturn(0);
PFPackageInitialized = PETSC_TRUE;
/* Register Classes */
ierr = PetscClassIdRegister("PointFunction",&PF_CLASSID);CHKERRQ(ierr);
/* Register Constructors */
ierr = PFRegisterAll(path);CHKERRQ(ierr);
/* Process info exclusions */
ierr = PetscOptionsGetString(PETSC_NULL, "-info_exclude", logList, 256, &opt);CHKERRQ(ierr);
if (opt) {
ierr = PetscStrstr(logList, "pf", &className);CHKERRQ(ierr);
if (className) {
ierr = PetscInfoDeactivateClass(PF_CLASSID);CHKERRQ(ierr);
}
}
/* Process summary exclusions */
ierr = PetscOptionsGetString(PETSC_NULL, "-log_summary_exclude", logList, 256, &opt);CHKERRQ(ierr);
if (opt) {
ierr = PetscStrstr(logList, "pf", &className);CHKERRQ(ierr);
if (className) {
ierr = PetscLogEventDeactivateClass(PF_CLASSID);CHKERRQ(ierr);
}
}
ierr = PetscRegisterFinalize(PFFinalizePackage);CHKERRQ(ierr);
PetscFunctionReturn(0);
}
示例2: PetscSetDebugger
/*@C
PetscSetDebuggerFromString - Set the complete path for the
debugger for PETSc to use.
Not collective
Level: developer
.seealso: PetscSetDebugger(), PetscSetDefaultDebugger()
@*/
PetscErrorCode PetscSetDebuggerFromString(const char *string)
{
const char *debugger = NULL;
PetscBool xterm = PETSC_TRUE;
char *f;
PetscErrorCode ierr;
PetscFunctionBegin;
ierr = PetscStrstr(string, "noxterm", &f);CHKERRQ(ierr);
if (f) xterm = PETSC_FALSE;
ierr = PetscStrstr(string, "ddd", &f);CHKERRQ(ierr);
if (f) xterm = PETSC_FALSE;
ierr = PetscCheckDebugger_Private("xdb", string, &debugger);CHKERRQ(ierr);
ierr = PetscCheckDebugger_Private("dbx", string, &debugger);CHKERRQ(ierr);
ierr = PetscCheckDebugger_Private("xldb", string, &debugger);CHKERRQ(ierr);
ierr = PetscCheckDebugger_Private("gdb", string, &debugger);CHKERRQ(ierr);
ierr = PetscCheckDebugger_Private("idb", string, &debugger);CHKERRQ(ierr);
ierr = PetscCheckDebugger_Private("xxgdb", string, &debugger);CHKERRQ(ierr);
ierr = PetscCheckDebugger_Private("ddd", string, &debugger);CHKERRQ(ierr);
ierr = PetscCheckDebugger_Private("kdbg", string, &debugger);CHKERRQ(ierr);
ierr = PetscCheckDebugger_Private("ups", string, &debugger);CHKERRQ(ierr);
ierr = PetscCheckDebugger_Private("workshop", string, &debugger);CHKERRQ(ierr);
ierr = PetscCheckDebugger_Private("pgdbg", string, &debugger);CHKERRQ(ierr);
ierr = PetscCheckDebugger_Private("pathdb", string, &debugger);CHKERRQ(ierr);
ierr = PetscCheckDebugger_Private("lldb", string, &debugger);CHKERRQ(ierr);
ierr = PetscSetDebugger(debugger, xterm);CHKERRQ(ierr);
PetscFunctionReturn(0);
}
示例3: PetscDLLibraryRegister
/*@C
RGInitializePackage - This function initializes everything in the RG package.
It is called from PetscDLLibraryRegister() when using dynamic libraries, and
on the first call to RGCreate() when using static libraries.
Level: developer
.seealso: SlepcInitialize()
@*/
PetscErrorCode RGInitializePackage(void)
{
char logList[256];
char *className;
PetscBool opt;
PetscErrorCode ierr;
PetscFunctionBegin;
if (RGPackageInitialized) PetscFunctionReturn(0);
RGPackageInitialized = PETSC_TRUE;
/* Register Classes */
ierr = PetscClassIdRegister("Region",&RG_CLASSID);CHKERRQ(ierr);
/* Register Constructors */
ierr = RGRegisterAll();CHKERRQ(ierr);
/* Process info exclusions */
ierr = PetscOptionsGetString(NULL,"-info_exclude",logList,256,&opt);CHKERRQ(ierr);
if (opt) {
ierr = PetscStrstr(logList,"rg",&className);CHKERRQ(ierr);
if (className) {
ierr = PetscInfoDeactivateClass(RG_CLASSID);CHKERRQ(ierr);
}
}
/* Process summary exclusions */
ierr = PetscOptionsGetString(NULL,"-log_summary_exclude",logList,256,&opt);CHKERRQ(ierr);
if (opt) {
ierr = PetscStrstr(logList,"rg",&className);CHKERRQ(ierr);
if (className) {
ierr = PetscLogEventDeactivateClass(RG_CLASSID);CHKERRQ(ierr);
}
}
ierr = PetscRegisterFinalize(RGFinalizePackage);CHKERRQ(ierr);
PetscFunctionReturn(0);
}
示例4: PetscDLLibraryRegister
/*@C
DMInitializePackage - This function initializes everything in the DM package. It is called
from PetscDLLibraryRegister() when using dynamic libraries, and on the first call to AOCreate()
or DMDACreate() when using static libraries.
Level: developer
.keywords: AO, initialize, package
.seealso: PetscInitialize()
@*/
PetscErrorCode DMInitializePackage(void)
{
char logList[256];
char *className;
PetscBool opt;
PetscErrorCode ierr;
PetscFunctionBegin;
if (DMPackageInitialized) PetscFunctionReturn(0);
DMPackageInitialized = PETSC_TRUE;
/* Register Classes */
ierr = PetscClassIdRegister("Distributed Mesh",&DM_CLASSID);CHKERRQ(ierr);
#if defined(PETSC_HAVE_HYPRE)
ierr = MatRegister(MATHYPRESTRUCT, MatCreate_HYPREStruct);CHKERRQ(ierr);
#endif
/* Register Constructors */
ierr = DMRegisterAll();CHKERRQ(ierr);
/* Register Events */
ierr = PetscLogEventRegister("DMConvert", DM_CLASSID,&DM_Convert);CHKERRQ(ierr);
ierr = PetscLogEventRegister("DMGlobalToLocal", DM_CLASSID,&DM_GlobalToLocal);CHKERRQ(ierr);
ierr = PetscLogEventRegister("DMLocalToGlobal", DM_CLASSID,&DM_LocalToGlobal);CHKERRQ(ierr);
ierr = PetscLogEventRegister("DMDALocalADFunc", DM_CLASSID,&DMDA_LocalADFunction);CHKERRQ(ierr);
ierr = PetscLogEventRegister("DMPlexInterpolate", DM_CLASSID,&DMPLEX_Interpolate);CHKERRQ(ierr);
ierr = PetscLogEventRegister("DMPlexPartition", DM_CLASSID,&DMPLEX_Partition);CHKERRQ(ierr);
ierr = PetscLogEventRegister("DMPlexDistribute", DM_CLASSID,&DMPLEX_Distribute);CHKERRQ(ierr);
ierr = PetscLogEventRegister("DMPlexDistribCones", DM_CLASSID,&DMPLEX_DistributeCones);CHKERRQ(ierr);
ierr = PetscLogEventRegister("DMPlexDistribLabels", DM_CLASSID,&DMPLEX_DistributeLabels);CHKERRQ(ierr);
ierr = PetscLogEventRegister("DMPlexDistribSF", DM_CLASSID,&DMPLEX_DistributeSF);CHKERRQ(ierr);
ierr = PetscLogEventRegister("DMPlexDistribField", DM_CLASSID,&DMPLEX_DistributeField);CHKERRQ(ierr);
ierr = PetscLogEventRegister("DMPlexDistribData", DM_CLASSID,&DMPLEX_DistributeData);CHKERRQ(ierr);
ierr = PetscLogEventRegister("DMPlexStratify", DM_CLASSID,&DMPLEX_Stratify);CHKERRQ(ierr);
ierr = PetscLogEventRegister("DMPlexPreallocate", DM_CLASSID,&DMPLEX_Preallocate);CHKERRQ(ierr);
ierr = PetscLogEventRegister("DMPlexResidualFEM", DM_CLASSID,&DMPLEX_ResidualFEM);CHKERRQ(ierr);
ierr = PetscLogEventRegister("DMPlexJacobianFEM", DM_CLASSID,&DMPLEX_JacobianFEM);CHKERRQ(ierr);
/* Process info exclusions */
ierr = PetscOptionsGetString(NULL, "-info_exclude", logList, 256, &opt);CHKERRQ(ierr);
if (opt) {
ierr = PetscStrstr(logList, "da", &className);CHKERRQ(ierr);
if (className) {
ierr = PetscInfoDeactivateClass(DM_CLASSID);CHKERRQ(ierr);
}
}
/* Process summary exclusions */
ierr = PetscOptionsGetString(NULL, "-log_summary_exclude", logList, 256, &opt);CHKERRQ(ierr);
if (opt) {
ierr = PetscStrstr(logList, "da", &className);CHKERRQ(ierr);
if (className) {
ierr = PetscLogEventDeactivateClass(DM_CLASSID);CHKERRQ(ierr);
}
}
ierr = PetscRegisterFinalize(DMFinalizePackage);CHKERRQ(ierr);
PetscFunctionReturn(0);
}
示例5: PetscObjectsDump
/*@C
PetscObjectsDump - Prints the currently existing objects.
Logically Collective on PetscViewer
Input Parameter:
+ fd - file pointer
- all - by default only tries to display objects created explicitly by the user, if all is PETSC_TRUE then lists all outstanding objects
Options Database:
. -objects_dump <all>
Level: advanced
Concepts: options database^printing
@*/
PetscErrorCode PetscObjectsDump(FILE *fd,PetscBool all)
{
PetscErrorCode ierr;
PetscInt i;
#if defined(PETSC_USE_DEBUG)
PetscInt j,k=0;
#endif
PetscObject h;
PetscFunctionBegin;
if (PetscObjectsCounts) {
ierr = PetscFPrintf(PETSC_COMM_WORLD,fd,"The following objects were never freed\n");CHKERRQ(ierr);
ierr = PetscFPrintf(PETSC_COMM_WORLD,fd,"-----------------------------------------\n");CHKERRQ(ierr);
for (i=0; i<PetscObjectsMaxCounts; i++) {
if ((h = PetscObjects[i])) {
ierr = PetscObjectName(h);CHKERRQ(ierr);
{
#if defined(PETSC_USE_DEBUG)
PetscStack *stack = 0;
char *create,*rclass;
/* if the PETSc function the user calls is not a create then this object was NOT directly created by them */
ierr = PetscMallocGetStack(h,&stack);CHKERRQ(ierr);
if (stack) {
k = stack->currentsize-2;
if (!all) {
k = 0;
while (!stack->petscroutine[k]) k++;
ierr = PetscStrstr(stack->function[k],"Create",&create);CHKERRQ(ierr);
if (!create) {
ierr = PetscStrstr(stack->function[k],"Get",&create);CHKERRQ(ierr);
}
ierr = PetscStrstr(stack->function[k],h->class_name,&rclass);CHKERRQ(ierr);
if (!create) continue;
if (!rclass) continue;
}
}
#endif
ierr = PetscFPrintf(PETSC_COMM_WORLD,fd,"[%d] %s %s %s\n",PetscGlobalRank,h->class_name,h->type_name,h->name);CHKERRQ(ierr);
#if defined(PETSC_USE_DEBUG)
ierr = PetscMallocGetStack(h,&stack);CHKERRQ(ierr);
if (stack) {
for (j=k; j>=0; j--) {
fprintf(fd," [%d] %s() in %s\n",PetscGlobalRank,stack->function[j],stack->file[j]);
}
}
#endif
}
}
}
}
PetscFunctionReturn(0);
}
示例6: PetscDLLibraryRegister
/*@C
PCInitializePackage - This function initializes everything in the PC package. It is called
from PetscDLLibraryRegister() when using dynamic libraries, and on the first call to PCCreate()
when using static libraries.
Level: developer
.keywords: PC, initialize, package
.seealso: PetscInitialize()
@*/
PetscErrorCode PCInitializePackage(void)
{
char logList[256];
char *className;
PetscBool opt;
PetscErrorCode ierr;
PetscFunctionBegin;
if (PCPackageInitialized) PetscFunctionReturn(0);
PCPackageInitialized = PETSC_TRUE;
/* Initialize subpackages */
ierr = PCGAMGInitializePackage();CHKERRQ(ierr);
/* Register Classes */
ierr = PetscClassIdRegister("Preconditioner",&PC_CLASSID);CHKERRQ(ierr);
/* Register Constructors */
ierr = PCRegisterAll();CHKERRQ(ierr);
/* Register Events */
ierr = PetscLogEventRegister("PCSetUp", PC_CLASSID,&PC_SetUp);CHKERRQ(ierr);
ierr = PetscLogEventRegister("PCSetUpOnBlocks", PC_CLASSID,&PC_SetUpOnBlocks);CHKERRQ(ierr);
ierr = PetscLogEventRegister("PCApplyOnBlocks", PC_CLASSID,&PC_ApplyOnBlocks);CHKERRQ(ierr);
ierr = PetscLogEventRegister("PCApplyOnMproc", PC_CLASSID,&PC_ApplyOnMproc);CHKERRQ(ierr);
ierr = PetscLogEventRegister("PCApply", PC_CLASSID,&PC_Apply);CHKERRQ(ierr);
ierr = PetscLogEventRegister("PCApplyCoarse", PC_CLASSID,&PC_ApplyCoarse);CHKERRQ(ierr);
ierr = PetscLogEventRegister("PCApplyMultiple", PC_CLASSID,&PC_ApplyMultiple);CHKERRQ(ierr);
ierr = PetscLogEventRegister("PCApplySymmLeft", PC_CLASSID,&PC_ApplySymmetricLeft);CHKERRQ(ierr);
ierr = PetscLogEventRegister("PCApplySymmRight", PC_CLASSID,&PC_ApplySymmetricRight);CHKERRQ(ierr);
ierr = PetscLogEventRegister("PCModifySubMatri", PC_CLASSID,&PC_ModifySubMatrices);CHKERRQ(ierr);
/* Process info exclusions */
ierr = PetscOptionsGetString(NULL, "-info_exclude", logList, 256, &opt);CHKERRQ(ierr);
if (opt) {
ierr = PetscStrstr(logList, "pc", &className);CHKERRQ(ierr);
if (className) {
ierr = PetscInfoDeactivateClass(PC_CLASSID);CHKERRQ(ierr);
}
}
/* Process summary exclusions */
ierr = PetscOptionsGetString(NULL, "-log_summary_exclude", logList, 256, &opt);CHKERRQ(ierr);
if (opt) {
ierr = PetscStrstr(logList, "pc", &className);CHKERRQ(ierr);
if (className) {
ierr = PetscLogEventDeactivateClass(PC_CLASSID);CHKERRQ(ierr);
}
}
/* Register data */
ierr = PetscObjectComposedDataRegister(&PetscMGLevelId);CHKERRQ(ierr);
ierr = PetscRegisterFinalize(PCFinalizePackage);CHKERRQ(ierr);
PetscFunctionReturn(0);
}
示例7: PetscViewerFileSetName_MPIIO
PetscErrorCode PetscViewerFileSetName_MPIIO(PetscViewer viewer,const char name[])
{
PetscMPIInt rank;
PetscErrorCode ierr;
size_t len;
PetscViewer_Binary *vbinary = (PetscViewer_Binary*)viewer->data;
char *gz;
PetscBool found;
PetscFileMode type = vbinary->btype;
PetscFunctionBegin;
if (type == (PetscFileMode) -1) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ORDER,"Must call PetscViewerFileSetMode() before PetscViewerFileSetName()");
ierr = PetscViewerFileClose_MPIIO(viewer);CHKERRQ(ierr);
ierr = PetscOptionsGetBool(((PetscObject)viewer)->prefix,"-viewer_binary_skip_info",&vbinary->skipinfo,NULL);CHKERRQ(ierr);
ierr = PetscOptionsGetBool(((PetscObject)viewer)->prefix,"-viewer_binary_skip_options",&vbinary->skipoptions,NULL);CHKERRQ(ierr);
ierr = MPI_Comm_rank(PetscObjectComm((PetscObject)viewer),&rank);CHKERRQ(ierr);
ierr = PetscStrallocpy(name,&vbinary->filename);CHKERRQ(ierr);
vbinary->storecompressed = PETSC_FALSE;
/* only first processor opens file if writeable */
if (type == FILE_MODE_READ) {
MPI_File_open(PetscObjectComm((PetscObject)viewer),vbinary->filename,MPI_MODE_RDONLY,MPI_INFO_NULL,&vbinary->mfdes);CHKERRQ(ierr);
} else if (type == FILE_MODE_WRITE) {
MPI_File_open(PetscObjectComm((PetscObject)viewer),vbinary->filename,MPI_MODE_WRONLY | MPI_MODE_CREATE,MPI_INFO_NULL,&vbinary->mfdes);CHKERRQ(ierr);
}
/*
try to open info file: all processors open this file if read only
Below is identical code to the code for Binary above, should be put in seperate routine
*/
if (!vbinary->skipinfo && (!rank || type == FILE_MODE_READ)) {
char infoname[PETSC_MAX_PATH_LEN],iname[PETSC_MAX_PATH_LEN];
ierr = PetscStrcpy(infoname,name);CHKERRQ(ierr);
/* remove .gz if it ends library name */
ierr = PetscStrstr(infoname,".gz",&gz);CHKERRQ(ierr);
if (gz) {
ierr = PetscStrlen(gz,&len);CHKERRQ(ierr);
if (len == 3) *gz = 0;
}
ierr = PetscStrcat(infoname,".info");CHKERRQ(ierr);
ierr = PetscFixFilename(infoname,iname);CHKERRQ(ierr);
if (type == FILE_MODE_READ) {
ierr = PetscFileRetrieve(PetscObjectComm((PetscObject)viewer),iname,infoname,PETSC_MAX_PATH_LEN,&found);CHKERRQ(ierr);
ierr = PetscOptionsInsertFile(PetscObjectComm((PetscObject)viewer),infoname,PETSC_FALSE);CHKERRQ(ierr);
} else {
vbinary->fdes_info = fopen(infoname,"w");
if (!vbinary->fdes_info) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_FILE_OPEN,"Cannot open .info file %s for writing",infoname);
}
}
#if defined(PETSC_USE_LOG)
PetscLogObjectState((PetscObject)viewer,"File: %s",name);
#endif
PetscFunctionReturn(0);
}
示例8: PetscDLLibraryRegister
/*@C
SNESInitializePackage - This function initializes everything in the SNES package. It is called
from PetscDLLibraryRegister() when using dynamic libraries, and on the first call to SNESCreate()
when using static libraries.
Level: developer
.keywords: SNES, initialize, package
.seealso: PetscInitialize()
@*/
PetscErrorCode SNESInitializePackage(void)
{
char logList[256];
char *className;
PetscBool opt;
PetscErrorCode ierr;
PetscFunctionBegin;
if (SNESPackageInitialized) PetscFunctionReturn(0);
SNESPackageInitialized = PETSC_TRUE;
/* Initialize subpackages */
ierr = SNESMSInitializePackage();CHKERRQ(ierr);
/* Register Classes */
ierr = PetscClassIdRegister("SNES",&SNES_CLASSID);CHKERRQ(ierr);
ierr = PetscClassIdRegister("SNESLineSearch",&SNESLINESEARCH_CLASSID);CHKERRQ(ierr);
ierr = PetscClassIdRegister("DMSNES",&DMSNES_CLASSID);CHKERRQ(ierr);
/* Register Constructors */
ierr = SNESRegisterAll();CHKERRQ(ierr);
ierr = SNESLineSearchRegisterAll();CHKERRQ(ierr);
/* Register Events */
ierr = PetscLogEventRegister("SNESSolve", SNES_CLASSID,&SNES_Solve);CHKERRQ(ierr);
ierr = PetscLogEventRegister("SNESFunctionEval", SNES_CLASSID,&SNES_FunctionEval);CHKERRQ(ierr);
ierr = PetscLogEventRegister("SNESObjectiveEval", SNES_CLASSID,&SNES_ObjectiveEval);CHKERRQ(ierr);
ierr = PetscLogEventRegister("SNESNGSEval", SNES_CLASSID,&SNES_NGSEval);CHKERRQ(ierr);
ierr = PetscLogEventRegister("SNESNGSFuncEval", SNES_CLASSID,&SNES_NGSFuncEval);CHKERRQ(ierr);
ierr = PetscLogEventRegister("SNESJacobianEval", SNES_CLASSID,&SNES_JacobianEval);CHKERRQ(ierr);
ierr = PetscLogEventRegister("SNESLineSearch", SNESLINESEARCH_CLASSID,&SNESLINESEARCH_Apply);CHKERRQ(ierr);
ierr = PetscLogEventRegister("SNESNPCSolve", SNES_CLASSID,&SNES_NPCSolve);CHKERRQ(ierr);
/* Process info exclusions */
ierr = PetscOptionsGetString(NULL,NULL, "-info_exclude", logList, 256, &opt);CHKERRQ(ierr);
if (opt) {
ierr = PetscStrstr(logList, "snes", &className);CHKERRQ(ierr);
if (className) {
ierr = PetscInfoDeactivateClass(SNES_CLASSID);CHKERRQ(ierr);
}
}
/* Process summary exclusions */
ierr = PetscOptionsGetString(NULL,NULL, "-log_exclude", logList, 256, &opt);CHKERRQ(ierr);
if (opt) {
ierr = PetscStrstr(logList, "snes", &className);CHKERRQ(ierr);
if (className) {
ierr = PetscLogEventDeactivateClass(SNES_CLASSID);CHKERRQ(ierr);
}
}
ierr = PetscRegisterFinalize(SNESFinalizePackage);CHKERRQ(ierr);
PetscFunctionReturn(0);
}
示例9: PetscDLLibraryRegister
/*@C
BVInitializePackage - This function initializes everything in the BV package.
It is called from PetscDLLibraryRegister() when using dynamic libraries, and
on the first call to BVCreate() when using static libraries.
Level: developer
.seealso: SlepcInitialize()
@*/
PetscErrorCode BVInitializePackage(void)
{
char logList[256];
char *className;
PetscBool opt;
PetscErrorCode ierr;
PetscFunctionBegin;
if (BVPackageInitialized) PetscFunctionReturn(0);
BVPackageInitialized = PETSC_TRUE;
/* Register Classes */
ierr = PetscClassIdRegister("Basis Vectors",&BV_CLASSID);CHKERRQ(ierr);
/* Register Constructors */
ierr = BVRegisterAll();CHKERRQ(ierr);
/* Register Events */
ierr = PetscLogEventRegister("BVCreate",BV_CLASSID,&BV_Create);CHKERRQ(ierr);
ierr = PetscLogEventRegister("BVCopy",BV_CLASSID,&BV_Copy);CHKERRQ(ierr);
ierr = PetscLogEventRegister("BVMult",BV_CLASSID,&BV_Mult);CHKERRQ(ierr);
ierr = PetscLogEventRegister("BVDot",BV_CLASSID,&BV_Dot);CHKERRQ(ierr);
ierr = PetscLogEventRegister("BVOrthogonalize",BV_CLASSID,&BV_Orthogonalize);CHKERRQ(ierr);
ierr = PetscLogEventRegister("BVScale",BV_CLASSID,&BV_Scale);CHKERRQ(ierr);
ierr = PetscLogEventRegister("BVNorm",BV_CLASSID,&BV_Norm);CHKERRQ(ierr);
ierr = PetscLogEventRegister("BVSetRandom",BV_CLASSID,&BV_SetRandom);CHKERRQ(ierr);
ierr = PetscLogEventRegister("BVMatMult",BV_CLASSID,&BV_MatMult);CHKERRQ(ierr);
ierr = PetscLogEventRegister("BVMatProject",BV_CLASSID,&BV_MatProject);CHKERRQ(ierr);
ierr = PetscLogEventRegister("BVAXPY",BV_CLASSID,&BV_AXPY);CHKERRQ(ierr);
/* Process info exclusions */
ierr = PetscOptionsGetString(NULL,"-info_exclude",logList,256,&opt);CHKERRQ(ierr);
if (opt) {
ierr = PetscStrstr(logList,"bv",&className);CHKERRQ(ierr);
if (className) {
ierr = PetscInfoDeactivateClass(BV_CLASSID);CHKERRQ(ierr);
}
}
/* Process summary exclusions */
ierr = PetscOptionsGetString(NULL,"-log_summary_exclude",logList,256,&opt);CHKERRQ(ierr);
if (opt) {
ierr = PetscStrstr(logList,"bv",&className);CHKERRQ(ierr);
if (className) {
ierr = PetscLogEventDeactivateClass(BV_CLASSID);CHKERRQ(ierr);
}
}
ierr = PetscRegisterFinalize(BVFinalizePackage);CHKERRQ(ierr);
PetscFunctionReturn(0);
}
示例10: PetscDLLibraryRegister
/*@C
NEPInitializePackage - This function initializes everything in the NEP package.
It is called from PetscDLLibraryRegister() when using dynamic libraries, and
on the first call to NEPCreate() when using static libraries.
Level: developer
.seealso: SlepcInitialize()
@*/
PetscErrorCode NEPInitializePackage(void)
{
char logList[256];
char *className;
PetscBool opt;
PetscErrorCode ierr;
PetscFunctionBegin;
if (NEPPackageInitialized) PetscFunctionReturn(0);
NEPPackageInitialized = PETSC_TRUE;
/* Register Classes */
ierr = PetscClassIdRegister("Nonlinear Eigenvalue Problem solver",&NEP_CLASSID);CHKERRQ(ierr);
/* Register Constructors */
ierr = NEPRegisterAll();CHKERRQ(ierr);
/* Register Events */
ierr = PetscLogEventRegister("NEPSetUp",NEP_CLASSID,&NEP_SetUp);CHKERRQ(ierr);
ierr = PetscLogEventRegister("NEPSolve",NEP_CLASSID,&NEP_Solve);CHKERRQ(ierr);
ierr = PetscLogEventRegister("NEPRefine",NEP_CLASSID,&NEP_Refine);CHKERRQ(ierr);
ierr = PetscLogEventRegister("NEPFunctionEval",NEP_CLASSID,&NEP_FunctionEval);CHKERRQ(ierr);
ierr = PetscLogEventRegister("NEPJacobianEval",NEP_CLASSID,&NEP_JacobianEval);CHKERRQ(ierr);
/* Process info exclusions */
ierr = PetscOptionsGetString(NULL,"-info_exclude",logList,256,&opt);CHKERRQ(ierr);
if (opt) {
ierr = PetscStrstr(logList,"nep",&className);CHKERRQ(ierr);
if (className) {
ierr = PetscInfoDeactivateClass(NEP_CLASSID);CHKERRQ(ierr);
}
}
/* Process summary exclusions */
ierr = PetscOptionsGetString(NULL,"-log_summary_exclude",logList,256,&opt);CHKERRQ(ierr);
if (opt) {
ierr = PetscStrstr(logList,"nep",&className);CHKERRQ(ierr);
if (className) {
ierr = PetscLogEventDeactivateClass(NEP_CLASSID);CHKERRQ(ierr);
}
}
ierr = PetscRegisterFinalize(NEPFinalizePackage);CHKERRQ(ierr);
PetscFunctionReturn(0);
}
示例11: PetscPullJSONValue
/*@C
PetscPullJSONValue - Given a JSON response containing the substring with "key" : "value" where there may or not be spaces around the : returns the value.
Input Parameters:
+ buff - the char array containing the possible values
. key - the key of the requested value
- valuelen - the length of the array to contain the value associated with the key
Output Parameters:
+ value - the value obtained
- found - flag indicating if the value was found in the buff
Level: advanced
@*/
PetscErrorCode PetscPullJSONValue(const char buff[],const char key[],char value[],size_t valuelen,PetscBool *found)
{
PetscErrorCode ierr;
char *v,*w;
char work[256];
size_t len;
PetscFunctionBegin;
ierr = PetscStrcpy(work,"\"");CHKERRQ(ierr);
ierr = PetscStrlcat(work,key,sizeof(work));CHKERRQ(ierr);
ierr = PetscStrcat(work,"\":");CHKERRQ(ierr);
ierr = PetscStrstr(buff,work,&v);CHKERRQ(ierr);
ierr = PetscStrlen(work,&len);CHKERRQ(ierr);
if (v) {
v += len;
} else {
work[len++-1] = 0;
ierr = PetscStrcat(work," :");CHKERRQ(ierr);
ierr = PetscStrstr(buff,work,&v);CHKERRQ(ierr);
if (!v) {
*found = PETSC_FALSE;
PetscFunctionReturn(0);
}
v += len;
}
ierr = PetscStrchr(v,'\"',&v);CHKERRQ(ierr);
if (!v) {
*found = PETSC_FALSE;
PetscFunctionReturn(0);
}
ierr = PetscStrchr(v+1,'\"',&w);CHKERRQ(ierr);
if (!w) {
*found = PETSC_FALSE;
PetscFunctionReturn(0);
}
*found = PETSC_TRUE;
ierr = PetscStrncpy(value,v+1,PetscMin((size_t)(w-v),valuelen));CHKERRQ(ierr);
PetscFunctionReturn(0);
}
示例12: PetscDLLibraryRegister
/*@C
PetscInitializeDrawPackage - This function initializes everything in the PetscDraw package. It is called
from PetscDLLibraryRegister() when using dynamic libraries, and on the call to PetscInitialize()
when using static libraries.
Level: developer
.keywords: Petsc, initialize, package
.seealso: PetscInitialize()
@*/
PetscErrorCode PetscDrawInitializePackage(void)
{
char logList[256];
char *className;
PetscBool opt;
PetscErrorCode ierr;
PetscFunctionBegin;
if (PetscDrawPackageInitialized) PetscFunctionReturn(0);
PetscDrawPackageInitialized = PETSC_TRUE;
/* Register Classes */
ierr = PetscClassIdRegister("Draw",&PETSC_DRAW_CLASSID);CHKERRQ(ierr);
ierr = PetscClassIdRegister("Axis",&PETSC_DRAWAXIS_CLASSID);CHKERRQ(ierr);
ierr = PetscClassIdRegister("Line Graph",&PETSC_DRAWLG_CLASSID);CHKERRQ(ierr);
ierr = PetscClassIdRegister("Histogram",&PETSC_DRAWHG_CLASSID);CHKERRQ(ierr);
ierr = PetscClassIdRegister("Bar Grap",&PETSC_DRAWBAR_CLASSID);CHKERRQ(ierr);
ierr = PetscClassIdRegister("Scatter Plot",&PETSC_DRAWSP_CLASSID);CHKERRQ(ierr);
/* Register Constructors */
ierr = PetscDrawRegisterAll();CHKERRQ(ierr);
/* Process info exclusions */
ierr = PetscOptionsGetString(NULL, "-info_exclude", logList, 256, &opt);CHKERRQ(ierr);
if (opt) {
ierr = PetscStrstr(logList, "draw", &className);CHKERRQ(ierr);
if (className) {
ierr = PetscInfoDeactivateClass(0);CHKERRQ(ierr);
}
}
/* Process summary exclusions */
ierr = PetscOptionsGetString(NULL, "-log_summary_exclude", logList, 256, &opt);CHKERRQ(ierr);
if (opt) {
ierr = PetscStrstr(logList, "draw", &className);CHKERRQ(ierr);
if (className) {
ierr = PetscLogEventDeactivateClass(0);CHKERRQ(ierr);
}
}
ierr = PetscRegisterFinalize(PetscDrawFinalizePackage);CHKERRQ(ierr);
PetscFunctionReturn(0);
}
示例13: PetscInitialize
/*@C
PetscViewerInitializePackage - This function initializes everything in the main PetscViewer package.
Level: developer
.keywords: Petsc, initialize, package
.seealso: PetscInitialize()
@*/
PetscErrorCode PetscViewerInitializePackage(void)
{
char logList[256];
char *className;
PetscBool opt;
PetscErrorCode ierr;
PetscFunctionBegin;
if (PetscViewerPackageInitialized) PetscFunctionReturn(0);
PetscViewerPackageInitialized = PETSC_TRUE;
/* Register Classes */
ierr = PetscClassIdRegister("Viewer",&PETSC_VIEWER_CLASSID);CHKERRQ(ierr);
/* Register Constructors */
ierr = PetscViewerRegisterAll();CHKERRQ(ierr);
/* Process info exclusions */
ierr = PetscOptionsGetString(NULL,NULL, "-info_exclude", logList, 256, &opt);CHKERRQ(ierr);
if (opt) {
ierr = PetscStrstr(logList, "viewer", &className);CHKERRQ(ierr);
if (className) {
ierr = PetscInfoDeactivateClass(0);CHKERRQ(ierr);
}
}
/* Process summary exclusions */
ierr = PetscOptionsGetString(NULL,NULL, "-log_exclude", logList, 256, &opt);CHKERRQ(ierr);
if (opt) {
ierr = PetscStrstr(logList, "viewer", &className);CHKERRQ(ierr);
if (className) {
ierr = PetscLogEventDeactivateClass(0);CHKERRQ(ierr);
}
}
#if defined(PETSC_HAVE_MATHEMATICA)
ierr = PetscViewerMathematicaInitializePackage();CHKERRQ(ierr);
#endif
ierr = PetscRegisterFinalize(PetscViewerFinalizePackage);CHKERRQ(ierr);
PetscFunctionReturn(0);
}
示例14: PetscStripe0
/*
Removes all zeros but one from .0000
*/
PetscErrorCode PetscStripe0(char *buf)
{
PetscErrorCode ierr;
size_t n;
PetscBool flg;
char *str;
PetscFunctionBegin;
ierr = PetscStrlen(buf,&n);CHKERRQ(ierr);
ierr = PetscStrendswith(buf,"e00",&flg);CHKERRQ(ierr);
if (flg) buf[n-3] = 0;
ierr = PetscStrstr(buf,"e0",&str);CHKERRQ(ierr);
if (str) {
buf[n-2] = buf[n-1];
buf[n-1] = 0;
}
ierr = PetscStrstr(buf,"e-0",&str);CHKERRQ(ierr);
if (str) {
buf[n-2] = buf[n-1];
buf[n-1] = 0;
}
PetscFunctionReturn(0);
}
示例15: PetscP4estInitialize
PetscErrorCode PetscP4estInitialize(void)
{
PetscBool psc_catch_signals = PETSC_FALSE;
PetscBool psc_print_backtrace = PETSC_TRUE;
int psc_log_threshold = SC_LP_DEFAULT;
int pp4est_log_threshold = SC_LP_DEFAULT;
char logList[256], *className;
PetscBool opt;
PetscErrorCode ierr;
PetscFunctionBegin;
if (PetscP4estInitialized) PetscFunctionReturn(0);
PetscP4estInitialized = PETSC_TRUE;
ierr = PetscClassIdRegister("p4est logging",&P4ESTLOGGING_CLASSID);CHKERRQ(ierr);
ierr = PetscOptionsGetString(NULL,NULL, "-info_exclude", logList, 256, &opt);CHKERRQ(ierr);
if (opt) {
ierr = PetscStrstr(logList, "p4est", &className);CHKERRQ(ierr);
if (className) {
ierr = PetscInfoDeactivateClass(P4ESTLOGGING_CLASSID);CHKERRQ(ierr);
}
}
ierr = PetscHeaderCreate(P4estLoggingObject,P4ESTLOGGING_CLASSID,"p4est","p4est logging","DM",PETSC_COMM_WORLD,NULL,PetscObjectView);CHKERRQ(ierr);
if (sc_package_id == -1) {
int log_threshold_shifted = psc_log_threshold + 1;
PetscBool set;
PetscBeganSc = PETSC_TRUE;
ierr = PetscOptionsGetBool(NULL,NULL,"-petsc_sc_catch_signals",&psc_catch_signals,NULL);CHKERRQ(ierr);
ierr = PetscOptionsGetBool(NULL,NULL,"-petsc_sc_print_backtrace",&psc_print_backtrace,NULL);CHKERRQ(ierr);
ierr = PetscOptionsGetEnum(NULL,NULL,"-petsc_sc_log_threshold",SCLogTypes,(PetscEnum*)&log_threshold_shifted,&set);CHKERRQ(ierr);
if (set) psc_log_threshold = log_threshold_shifted - 1;
sc_init(PETSC_COMM_WORLD,(int)psc_catch_signals,(int)psc_print_backtrace,PetscScLogHandler,psc_log_threshold);
if (sc_package_id == -1) SETERRQ(PETSC_COMM_WORLD,PETSC_ERR_LIB,"Could not initialize libsc package used by p4est");
sc_set_abort_handler(PetscScAbort);
}
if (p4est_package_id == -1) {
int log_threshold_shifted = pp4est_log_threshold + 1;
PetscBool set;
ierr = PetscOptionsGetEnum(NULL,NULL,"-petsc_p4est_log_threshold",SCLogTypes,(PetscEnum*)&log_threshold_shifted,&set);CHKERRQ(ierr);
if (set) pp4est_log_threshold = log_threshold_shifted - 1;
PetscStackCallP4est(p4est_init,(PetscScLogHandler,pp4est_log_threshold));
if (p4est_package_id == -1) SETERRQ(PETSC_COMM_WORLD,PETSC_ERR_LIB,"Could not initialize p4est");
}
ierr = DMForestRegisterType(DMP4EST);CHKERRQ(ierr);
ierr = DMForestRegisterType(DMP8EST);CHKERRQ(ierr);
ierr = PetscRegisterFinalize(PetscP4estFinalize);CHKERRQ(ierr);
PetscFunctionReturn(0);
}