当前位置: 首页>>代码示例>>C++>>正文


C++ EXCEPTION1函数代码示例

本文整理汇总了C++中EXCEPTION1函数的典型用法代码示例。如果您正苦于以下问题:C++ EXCEPTION1函数的具体用法?C++ EXCEPTION1怎么用?C++ EXCEPTION1使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了EXCEPTION1函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: EXCEPTION2

void
avtLocateAndPickNodeQuery::SetInputParams(const MapNode &params)
{
    if (params.HasEntry("vars"))
    {
        const stringVector &v = params.GetEntry("vars")->AsStringVector();
        if (v.empty())
            EXCEPTION2(QueryArgumentException, "vars", 1);
        timeCurveSpecs["nResultsToStore"] = (int)v.size();
        pickAtts.SetVariables(v);
    }
    else
        EXCEPTION1(QueryArgumentException, "vars");

    if (params.HasNumericVectorEntry("ray_start_point"))
    {
        doubleVector v;
        params.GetEntry("ray_start_point")->ToDoubleVector(v);
        if (v.size() != 3)
            EXCEPTION2(QueryArgumentException, "ray_start_point", 3);
        pickAtts.SetRayPoint1(v);
    }
    else
        EXCEPTION1(QueryArgumentException, "ray_start_point");

    if (params.HasNumericVectorEntry("ray_end_point"))
    {
        doubleVector v;
        params.GetEntry("ray_end_point")->ToDoubleVector(v);
        if (v.size() != 3)
            EXCEPTION2(QueryArgumentException, "ray_end_point", 3);
        pickAtts.SetRayPoint2(v);
    }
    else
        EXCEPTION1(QueryArgumentException, "ray_end_point");

    if (params.HasNumericEntry("domain"))
        domain = params.GetEntry("domain")->ToInt();
    else
        EXCEPTION1(QueryArgumentException, "domain");

    if (params.HasNumericEntry("element"))
        node = params.GetEntry("element")->ToInt();
    else
        EXCEPTION1(QueryArgumentException, "element");
}
开发者ID:HarinarayanKrishnan,项目名称:VisIt26RC_Trunk,代码行数:46,代码来源:avtLocateAndPickNodeQuery.C

示例2: switch

void
VisitHotPointInteractor::Start2DMode(INTERACTION_MODE mode)
{
    if(!proxy.HasPlots())
    {
        return;
    }

    VisitInteractor  *newInteractor  = NULL;
    switch(mode)
    {
    case NAVIGATE:
        if(navigate2D == NULL)
        {
            navigate2D = new Navigate2D(proxy);
        }
        newInteractor = navigate2D;
        break;
    case NODE_PICK:
    case ZONE_PICK:
    case SPREADSHEET_PICK:
    case DDT_PICK:
        if(pick == NULL)
        {
            pick = new Pick(proxy);
        }
        newInteractor = pick;
        break;
    case ZOOM:
        if(zoom2D == NULL)
        {
            zoom2D = new Zoom2D(proxy);
        }
        newInteractor = zoom2D;
        break;
    case LINEOUT:
        if(lineout2D == NULL)
        {
            lineout2D = new Lineout2D(proxy);
        }
        newInteractor = lineout2D;
        break;
    }

    if(newInteractor == NULL)
    {
        //
        // We have an invalid navigation mode or an invalid window mode.
        //
        EXCEPTION1(BadInteractorException, mode);
    }

    //
    // No reason to set the interactor again if it is the same one.
    //
    if(newInteractor != currentInteractor)
        SetInteractor(newInteractor);
}
开发者ID:HarinarayanKrishnan,项目名称:VisIt28RC_Trunk,代码行数:58,代码来源:VisitHotPointInteractor.C

示例3: FinalizeTimeLoop

void
avtTimeIteratorExpression::Execute(void)
{
    FinalizeTimeLoop();
    avtContract_p contract = ConstructContractWithVarnames();
    contract->DisableExtentsCalculations();

    // Store off the original expression list.
    ParsingExprList *pel = ParsingExprList::Instance();
    ExpressionList orig_list = *(pel->GetList());

    InitializeOutput();

    std::string db = GetInput()->GetInfo().GetAttributes().GetFullDBName();
    ref_ptr<avtDatabase> dbp = avtCallback::GetDatabase(db, 0, NULL);
    if (*dbp == NULL)
        EXCEPTION1(InvalidFilesException, db.c_str());

    // The first EEF already set up its expressions ... we need a new one
    // to set up filters for the CMFE expressions.
    avtExpressionEvaluatorFilter myeef;
    myeef.SetInput(GetInput());
    for (int i = 0 ; i < numTimeSlicesToProcess ; i++)
    {
        int timeSlice = firstTimeSlice + i*timeStride;
        if (timeSlice > actualLastTimeSlice)
            timeSlice = actualLastTimeSlice;
        debug1 << "Time iterating expression working on time slice " 
               << timeSlice << endl;
        UpdateExpressions(timeSlice);
        // won't re-execute without setting modified to true, because
        // it doesn't check to see if expression definitions change.
        myeef.ReleaseData();
        myeef.GetOutput()->Update(contract);
        avtCallback::ResetTimeout(5*60);
        Barrier();
        avtCallback::ResetTimeout(5*60);

        avtDatabaseMetaData *md = dbp->GetMetaData(timeSlice, false,
                                                   false, false);
        currentCycle = md->GetCycles()[timeSlice];
        currentTime  = md->GetTimes()[timeSlice];

        ProcessDataTree(myeef.GetTypedOutput()->GetDataTree(), i);
        debug1 << "Time iterating expression done working on time slice " 
               << timeSlice << endl;
    }

    // Get the upstream filters back the way they are supposed to be.
    GetInput()->Update(executionContract);

    FinalizeOutput();

    // Restore the original expression list ... i.e. undo the temporary
    // expressions we put in.
    *(pel->GetList()) = orig_list;
}
开发者ID:HarinarayanKrishnan,项目名称:VisIt26RC_Trunk,代码行数:57,代码来源:avtTimeIteratorExpression.C

示例4: switch

vtkDataArray *
ADIOSFileObject::AllocateArray(ADIOS_DATATYPES &t)
{
    vtkDataArray *array = NULL;
    switch (t)
    {
      case adios_unsigned_byte:
        array = vtkCharArray::New();
        break;
      case adios_byte:
        array = vtkUnsignedCharArray::New();
        break;
      case adios_string:
        array = vtkCharArray::New();
        break;
        
      case adios_unsigned_short:
        array = vtkUnsignedShortArray::New();
        break;
      case adios_short:
        array = vtkShortArray::New();
        break;
        
      case adios_unsigned_integer:
        array = vtkUnsignedIntArray::New(); 
        break;
      case adios_integer:
        array = vtkIntArray::New(); 
        break;
        
      case adios_unsigned_long:
        array = vtkUnsignedLongArray::New(); 
        break;
      case adios_long:
        array = vtkLongArray::New(); 
        break;
        
      case adios_real:
        array = vtkFloatArray::New(); 
        break;
        
      case adios_double:
        array = vtkDoubleArray::New(); 
        break;
        
      case adios_long_double: // 16 bytes
      case adios_complex:     //  8 bytes
      case adios_double_complex: // 16 bytes
      default:
        std::string str = "Inavlid variable type";
        EXCEPTION1(InvalidVariableException, str);
        break;
    }

    return array;
}
开发者ID:HarinarayanKrishnan,项目名称:VisIt26RC_Trunk,代码行数:56,代码来源:ADIOSFileObject.C

示例5: ds

avtIVPVTKTimeVaryingField::avtIVPVTKTimeVaryingField( vtkDataSet* dataset, 
                                                      avtCellLocator* locator,
                                                      double _t0, double _t1 ) 
  : ds(dataset), loc(locator), t0(_t0), t1(_t1), dt(_t1-_t0)
{
    if( ds )
        ds->Register( NULL );

    if( (velData[0] = ds->GetPointData()->GetVectors()) )
    {
        velCellBased = false;

        velData[1] = ds->GetPointData()->GetArray( NextTimePrefix );
    }
    else if( (velData[0] = ds->GetCellData()->GetVectors()) )
    {
        velCellBased = true;

        velData[1] = ds->GetCellData()->GetArray( NextTimePrefix );
    }
    else 
    {
        velData[0] = velData[1] = NULL;
        EXCEPTION1( ImproperUseException, 
                    "avtIVPVTKTimeVaryingField: Can't locate vectors to interpolate." );
    }

    if( velData[1] == NULL )
    {
        EXCEPTION1( ImproperUseException, 
                    "avtIVPVTKTimeVaryingField: Can't locate second pair of vectors to interpolate." );
    }

    lastCell = -1;
    lastPos.x = lastPos.y = lastPos.z =
        std::numeric_limits<double>::quiet_NaN();

    std::fill( sclData[0], sclData[0]+256, (vtkDataArray*)NULL );
    std::fill( sclData[1], sclData[1]+256, (vtkDataArray*)NULL );
    std::fill( sclCellBased, sclCellBased+256, false );

    sclDataName.resize( 256 );
}
开发者ID:HarinarayanKrishnan,项目名称:VisIt28RC_Trunk,代码行数:43,代码来源:avtIVPVTKTimeVaryingField.C

示例6: EXCEPTION1

void
avtLineScanQuery::PreExecute(void)
{
    avtDatasetQuery::PreExecute();

    if (numBins <= 0)
    {
        EXCEPTION1(VisItException, "There must be at least one bin.");
    }
    if (numLines <= 0)
    {
        EXCEPTION1(VisItException, "There must be at least one line.");
    }
    if (minLength < 0 || maxLength <= minLength)
    {
        EXCEPTION1(VisItException, "The min length must be less than the max "
                        "length and they both must be positive.");
    }
}
开发者ID:burlen,项目名称:visit_vtk_7_src,代码行数:19,代码来源:avtLineScanQuery.C

示例7: GetInput

void
avtExecuteThenTimeLoopFilter::FinalizeTimeLoop()
{
    int numStates = GetInput()->GetInfo().GetAttributes().GetNumStates();

    if (startTime < 0)
    {
        startTime = 0;
    }
    if (endTime < 0)
    {
        endTime = numStates - 1;
    }
    if (stride < 0)
    {
        stride = 1;
    }

    if (startTime > endTime)
    {
        std::string msg("Start time must be smaller than or equal to the end time for " );
        msg += GetType();
        msg += ".\n";
        EXCEPTION1(ImproperUseException, msg);
    }

    nFrames = (int) ceil((((float)endTime-startTime))/(float)stride) + 1; 

    // ARS - This check will always pass because of the additional
    // frame added to nFrames above and startTime must be greater than
    // or equal to endTime. Thus it is commented out.

//     if (nFrames < 1)
//     {
//         std::string msg(GetType());
//         msg = msg +  " requires at least 1 frame, please correct start " + 
//                "and end times and try again.";
//         EXCEPTION1(ImproperUseException, msg);
//    }

    if (endTime >= numStates)
    {
        std::string msg(GetType());
        msg += ":  Clamping end time to number of available timesteps.";
        avtCallback::IssueWarning(msg.c_str());
    }

    //
    // Ensure that the specified endTime is included,
    // regardless of the stride.
    //
    actualEnd = startTime + nFrames * stride;
    if (actualEnd < endTime)
        actualEnd = endTime + stride;
}
开发者ID:HarinarayanKrishnan,项目名称:VisIt26RC_Trunk,代码行数:55,代码来源:avtExecuteThenTimeLoopFilter.C

示例8: sprintf

void
avtGTCFileFormat::BinData( int dim, parallelBuffer **array, float *vars, float *ids,
                            float **myVarsPtr, float **myIdsPtr )
{
    int ptCnt = nTotalPoints / nProcs;
    int remainder = nTotalPoints % nProcs;

    float *ptrIDs = ids, *ptrVars = vars, *myVars = *myVarsPtr, *myIds = *myIdsPtr;
    float *data = new float[dim+1];
    
    for ( int i = 0; i < nPoints; i++ )
    {
        int id = ((int) *ptrIDs) - 1; //Make the id 0...N-1 for the math below.
        int whichProc;

        // Determine which processor this ID goes to.
        if ( id < (remainder * (ptCnt+1)) )
            whichProc = id / (ptCnt+1);
        else
        {
            int id2 = id - (remainder * (ptCnt+1));
            whichProc = remainder + id2/ptCnt;
        }

        if ( whichProc < 0 || whichProc >= nProcs )
        {
            char str[512];
            sprintf( str, "Bad Id mapping: %d ==> %d\n", id, whichProc );
            EXCEPTION1( InvalidDBTypeException, str );
        }

        // This is our data, so copy it to the front of the var, ids arrays.
        if ( whichProc == rank )
        {
            // ID
            *myIds++ = *ptrIDs++;
            for ( int j = 0; j < dim; j++ )
                *myVars++ = *ptrVars++;
        }
        // This data isn't ours. Stash it in the buffer to be sent.        
        else   
        {
            // ID
            data[0] = *ptrIDs++;
            for ( int j = 0; j < dim; j++ )
                data[j+1] = *ptrVars++;
            array[whichProc]->Add( data );
        }
    }
    
    delete [] data;

    *myIdsPtr = myIds;
    *myVarsPtr = myVars;
}
开发者ID:EricAlex,项目名称:ThirdParty-dev,代码行数:55,代码来源:avtGTCFileFormat.C

示例9: Initialize

vtkDataArray *
avtADIOSBasicFileFormat::GetVar(int timestate, int domain, const char *varname)
{
    debug1 << "avtADIOSBasicFileFormat::GetVar " << varname << endl;
    Initialize();
    vtkFloatArray *arr = NULL;
    if (! fileObj->ReadVariable(varname, timestate, &arr))
        EXCEPTION1(InvalidVariableException, varname);
        
    return arr;
}
开发者ID:HarinarayanKrishnan,项目名称:VisIt26RC_Trunk,代码行数:11,代码来源:avtADIOSBasicFileFormat.C

示例10: EXCEPTION1

OperatorPluginManager *
ViewerProxy::GetOperatorPluginManager() const
{
    if(operatorPlugins == 0)
    {
        EXCEPTION1(ImproperUseException, "ViewerProxy::InitializePlugins "
            "must be called before ViewerProxy::GetOperatorPluginManager");
    }

    return operatorPlugins;
}
开发者ID:burlen,项目名称:visit_vtk_7_src,代码行数:11,代码来源:ViewerProxy.C

示例11: VASP_CreateFileFormatInterface

avtFileFormatInterface *
VASP_CreateFileFormatInterface(const char * const *list, int nList, int nBlock)
{
    avtFileFormatInterface *ffi = 0;

    if (list != 0 && nList > 0)
    {
        // Determine the type of reader that we want to use.
        int flavor = -1;
        TRY
        {
            std::string fn(list[0]);
            if(flavor == -1 && avtOUTCARFileFormat::Identify(fn))
            {
                flavor = 0;
                debug4 << "Database is avtOUTCARFileFormat" << endl;
            }

            if(flavor == -1 && avtCHGCARFileFormat::Identify(fn))
            {
                flavor = 1;
                debug4 << "Database is avtCHGCARFileFormat" << endl;
            }

            if(flavor == -1 && avtPOSCARFileFormat::Identify(fn))
            {
                flavor = 2;
                debug4 << "Database is avtPOSCARFileFormat" << endl;
            }

            if(flavor == -1)
            {
                EXCEPTION1(InvalidFilesException, list[0]);
            }
        }
        CATCH(VisItException)
        {
            RETHROW;
        }
        ENDTRY

        switch(flavor)
        {
          case 0:
            ffi = avtOUTCARFileFormat::CreateInterface(list, nList, nBlock);
            break;
          case 1:
            ffi = avtCHGCARFileFormat::CreateInterface(list, nList, nBlock);
            break;
          case 2:
            ffi = avtPOSCARFileFormat::CreateInterface(list, nList, nBlock);
            break;
        }
    }
开发者ID:HarinarayanKrishnan,项目名称:VisIt28RC_Trunk,代码行数:54,代码来源:avtVASPFileFormat.C

示例12: if

void
avtIVPVTKTimeVaryingField::SetScalarVariable(unsigned char index, const std::string& name)
{
    vtkDataArray* data[2] = { NULL, NULL };
    bool cellBased;

    if( (data[0] = ds->GetPointData()->GetScalars( name.c_str() )) )
    {
        cellBased = false;
        data[1] = 
            ds->GetPointData()->GetArray( (NextTimePrefix+name).c_str() );
    }
    else if( (data[0] = ds->GetCellData()->GetScalars( name.c_str() )) )
    {
        cellBased = true;
        data[1] = 
            ds->GetCellData()->GetArray( (NextTimePrefix+name).c_str() );
    }
    else
        EXCEPTION1( ImproperUseException, 
                    "avtIVPVTKTimeVaryingField: Can't locate scalar \"" + name + 
                    "\" to interpolate." );

/* TODO. not sure we want all data to have a second value
    if( data[1] == NULL )
        EXCEPTION1( ImproperUseException, 
                    "avtIVPVTKTimeVaryingField: Can't locate next scalar \"" + name + 
                    "\" to interpolate." );
*/

    if( data[0]->GetNumberOfComponents() != 1 || 
        (data[1] && data[1]->GetNumberOfComponents() != 1) )
        EXCEPTION1( ImproperUseException,
                    "avtIVPVTKTimeVaryingField: Given variable \"" + name +
                    "\" is not scalar." );
        
    sclDataName[index] = name;
    sclData[0][index] = data[0];
    sclData[1][index] = data[1];
    sclCellBased[index] = cellBased;
}
开发者ID:HarinarayanKrishnan,项目名称:VisIt28RC_Trunk,代码行数:41,代码来源:avtIVPVTKTimeVaryingField.C

示例13: strlen

void
avtFluxFilter::InferVariableNameFromContract(avtContract_p c)
{
    avtDataRequest_p in_dr = c->GetDataRequest();

    bool foundIt = false;
    if (strncmp(in_dr->GetVariable(), "operators/Flux/",
                strlen("operators/Flux/")) == 0)
    {
        foundIt = true;
        if (atts.GetFlowField() == "default")
        {
             EXCEPTION1(VisItException, "You can't set the flow field as \"default\" "
                        "since the default field is not a vector.");
        }
        if (atts.GetWeight() && atts.GetWeightField() == "default")
        {
             EXCEPTION1(VisItException, "You can't set the weighting field as \"default\" "
                        "since that would lead to a recursive definition.");
        }
        varname = in_dr->GetVariable()+strlen("operators/Flux/");
    }

    if (!foundIt)
    {
        std::vector<CharStrRef>   vars2nd = in_dr->GetSecondaryVariablesWithoutDuplicates();
        for (size_t i = 0 ; i < vars2nd.size() ; i++)
        if (strncmp(*(vars2nd[i]), "operators/Flux/",
                    strlen("operators/Flux/")) == 0)
        {
            foundIt = true;
            varname = *(vars2nd[i])+strlen("operators/Flux/");
        }
    }

    if (!foundIt)
    {
        EXCEPTION1(VisItException, "Unable to determine variable name from contract");
    }
}
开发者ID:HarinarayanKrishnan,项目名称:VisIt28RC_Trunk,代码行数:40,代码来源:avtFluxFilter.C

示例14: EXCEPTION1

void 
avtShapeletDecompositionQuery::SetInputParams(const MapNode & params)
{
    if (params.HasNumericEntry("beta"))
    {
        double b = params.GetEntry("beta")->ToDouble();
        if (b < 1.0)
        {
            EXCEPTION1(VisItException, "Shapelet Decomposition requires "
                       "beta and nmax >= 1.");
        }
        SetBeta(b);
    }
    else
    {
        SetBeta(1.0);
    }

    if (params.HasNumericEntry("nmax"))
    {
        int m = params.GetEntry("nmax")->ToInt();
        SetNMax(m < 1 ? 1 : m);
    }
 
    SetDecompOutputFileName("");

    if (params.HasEntry("recomp_file"))
    {
        std::string rf(params.GetEntry("recomp_file")->AsString());
        if (rf.empty())
        {
            EXCEPTION1(QueryArgumentException, "recomp_file");
        }
        SetRecompOutputFileName(rf);
    }
    else 
    {
        SetRecompOutputFileName("");
    }
}
开发者ID:burlen,项目名称:visit_vtk_7_src,代码行数:40,代码来源:avtShapeletDecompositionQuery.C

示例15: avtCellLocator

avtCellLocatorRect::avtCellLocatorRect( vtkDataSet* ds ) :
    avtCellLocator( ds )
{
    vtkRectilinearGrid* rg = vtkRectilinearGrid::SafeDownCast( dataSet );

    if( dataSet->GetDataObjectType() != VTK_RECTILINEAR_GRID || rg == NULL )
        EXCEPTION1( ImproperUseException, "avtCellLocatorRect: Dataset is not rectilinear." );

    // copy the coordinate arrays for faster access later
    vtkDataArray* ca[3] = { 
        rg->GetXCoordinates(),
        rg->GetYCoordinates(),
        rg->GetZCoordinates(),
    };

    for( unsigned int d=0; d<3; ++d )
    {
        coord[d].resize( ca[d]->GetNumberOfTuples() );
        ascending[d] = true;

        for( unsigned int i=0; i<coord[d].size(); ++i )
        {
            coord[d][i] = ca[d]->GetComponent( i, 0 );
            if (i == 1)
            {
               if (coord[d][1] < coord[d][0])
                   ascending[d] = false;
            }
            else if (i > 1)
            {
                bool thisPairAscending = (coord[d][i] > coord[d][i-1]);
                if (thisPairAscending != ascending[d])
                {
                    EXCEPTION1( ImproperUseException, "avtCellLocatorRect: Coordinate "
                       "arrays are not monotonic.");
                }
            }
        }
    }    
}
开发者ID:burlen,项目名称:visit_vtk_7_src,代码行数:40,代码来源:avtCellLocatorRect.C


注:本文中的EXCEPTION1函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。