IntegralCurve.code 17.4 KB
Newer Older
1 2 3 4
Function: CopyAttributes
Declaration: bool CopyAttributes(const AttributeGroup *atts);
Definition:
// ****************************************************************************
5
// Method: IntegralCurveAttributes::CopyAttributes
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
//
// Purpose: 
//   CopyAttributes method for the IntegralCurveAttributes class.
//
// Programmer: Brad Whitlock
// Creation:   Fri Oct 4 15:22:57 PST 2002
//
// Modifications:
//    Brad Whitlock, Wed Dec 22 12:57:53 PDT 2004
//    I added code to support the point tool.
//
//    Hank Childs, Sat Mar  3 09:00:12 PST 2007
//    Disable useWholeBox if we are copying box extents.
//
//    Dave Pugmire, Thu Jun 10 10:44:02 EDT 2010
//    New seed sources.
//
// ****************************************************************************

bool
IntegralCurveAttributes::CopyAttributes(const AttributeGroup *atts)
{
    bool retval = false;

    if(TypeName() == atts->TypeName())
    {
        // Call assignment operator.
        const IntegralCurveAttributes *tmp = (const IntegralCurveAttributes *)atts;
        *this = *tmp;
        retval = true;
    }
    else if(atts->TypeName() == "PointAttributes")
    {
39
        if(sourceType == SpecifiedPoint)
40 41 42 43 44 45 46 47
        {
            const PointAttributes *p = (PointAttributes *)atts;
            SetPointSource(p->GetPoint());
            retval = true;
        }
    } 
    else if(atts->TypeName() == "Line")
    {
48
        if(sourceType == SpecifiedLine)
49 50 51 52 53 54 55 56 57
        {
            const Line *line = (const Line *)atts;
            SetLineStart(line->GetPoint1());
            SetLineEnd(line->GetPoint2());
            retval = true;
        }
    }
    else if(atts->TypeName() == "PlaneAttributes")
    {
58
        if(sourceType == SpecifiedPlane || sourceType == Circle)
59 60 61 62 63
        {
            const PlaneAttributes *plane = (const PlaneAttributes *)atts;
            SetPlaneOrigin(plane->GetOrigin());
            SetPlaneNormal(plane->GetNormal());
            SetPlaneUpAxis(plane->GetUpAxis());
64
            if (sourceType == Circle)
65 66 67 68 69 70
                SetRadius(plane->GetRadius());
            retval = true;
        }
    }
    else if(atts->TypeName() == "SphereAttributes")
    {
71
        if(sourceType == SpecifiedSphere)
72 73 74 75 76 77 78 79 80
        {
            const SphereAttributes *sphere = (const SphereAttributes *)atts;
            SetSphereOrigin(sphere->GetOrigin());
            SetRadius(sphere->GetRadius());
            retval = true;
        }
    }   
    else if(atts->TypeName() == "BoxExtents")
    {
81
        if(sourceType == SpecifiedBox)
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186
        {
            const BoxExtents *box = (const BoxExtents *)atts;
            SetBoxExtents(box->GetExtents());
            SetUseWholeBox(false);
            retval = true;
        }
    }

    return retval;
}

Function: CreateCompatible
Declaration: AttributeSubject *CreateCompatible(const std::string &tname) const
Definition:
// ****************************************************************************
//  Method: IntegralCurveAttributes::CreateCompatible
//
//  Purpose:
//     Creates a new state object of the desired type.
//
//  Programmer: Brad Whitlock
//  Creation:   Fri Oct 4 15:22:57 PST 2002
//
//  Modifications:
//    Brad Whitlock, Tue Jan 21 12:33:04 PDT 2003
//    I added code to set the "have radius" flag to true so the plane tool
//    resizes properly when resizing the plane radius.
//
//    Brad Whitlock, Wed Dec 22 12:54:43 PDT 2004
//    I added code to support the point tool.
//
// ****************************************************************************

AttributeSubject *
IntegralCurveAttributes::CreateCompatible(const std::string &tname) const
{
    AttributeSubject *retval = 0;

    if(TypeName() == tname)
    {
        retval = new IntegralCurveAttributes(*this);
    }
    else if(tname == "PointAttributes")
    {
        PointAttributes *p = new PointAttributes;
        p->SetPoint(GetPointSource());
        retval = p;
    }
    else if(tname == "Line")
    {
        Line *l = new Line;
        l->SetPoint1(GetLineStart());
        l->SetPoint2(GetLineEnd());
        retval = l;
    }
    else if(tname == "PlaneAttributes")
    {
        PlaneAttributes *p = new PlaneAttributes;
        p->SetOrigin(GetPlaneOrigin());
        p->SetNormal(GetPlaneNormal());
        p->SetUpAxis(GetPlaneUpAxis());
        p->SetRadius(GetRadius());
        p->SetHaveRadius(true);
        retval = p;
    }
    else if(tname == "SphereAttributes")
    {
        SphereAttributes *s = new SphereAttributes;
        s->SetOrigin(GetSphereOrigin());
        s->SetRadius(GetRadius());
        retval = s;
    }
    else if(tname == "CircleAttributes")
    {
        PlaneAttributes *p = new PlaneAttributes;
        p->SetOrigin(GetPlaneOrigin());
        p->SetNormal(GetPlaneNormal());
        p->SetUpAxis(GetPlaneUpAxis());
        p->SetRadius(GetRadius());
        p->SetHaveRadius(true);
        retval = p;
    }
    else if(tname == "BoxExtents")
    {
        BoxExtents *b = new BoxExtents;
        b->SetExtents(GetBoxExtents());
        retval = b;
    }

    return retval;
}

Function: ChangesRequireRecalculation
Declaration: bool ChangesRequireRecalculation(const IntegralCurveAttributes &) const;
Definition:
// ****************************************************************************
//  Method: IntegralCurveAttributes::ChangesRequireRecalculation
//
//  Purpose:
//     Determines whether or not the curves must be recalculated based on the
//     new attributes.
//
//  Programmer: Brad Whitlock
//  Creation:   Fri Oct 4 15:22:57 PST 2002
//
187
//  Notes:  Most attributes cause the integral curve to change.
188 189 190
//
//  Modifications:
//    Brad Whitlock, Wed Dec 22 12:52:45 PDT 2004
191
//    I made the coloring method matter when comparing integral curve attributes
192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243
//    and I added support for ribbons.
//
//    Hank Childs, Sat Mar  3 09:00:12 PST 2007
//    Add support for useWholeBox.
//
//    Hank Childs, Sun May  3 11:49:31 CDT 2009
//    Add support for point lists.
//
//   Dave Pugmire, Tue Dec 29 14:37:53 EST 2009
//   Add custom renderer and lots of appearance options.
//
//   Christoph Garth, Wed Jan 13 17:14:21 PST 2010 
//   Add support for circle source.
//
//   Hank Childs, Fri Oct  1 20:43:34 PDT 2010
//   Add support for absTol that is fraction of the bounding box.
//
//   Hank Childs, Mon Oct  4 14:32:06 PDT 2010
//   Add support for having multiple termination criterias.
//
//   Dave Pugmire, Fri Jan 28 14:49:50 EST 2011
//   Add vary tube radius by variable.
//
//   Dave Pugmire, Thu Mar 15 11:23:18 EDT 2012
//   Add named selections as a seed source.
//
// ****************************************************************************

#define PDIF(p1,p2,i) ((p1)[i] != (p2)[i])
#define POINT_DIFFERS(p1,p2) (PDIF(p1,p2,0) || PDIF(p1,p2,1) || PDIF(p1,p2,2))

bool
IntegralCurveAttributes::ChangesRequireRecalculation(const IntegralCurveAttributes &obj) const
{
    //Check the general stuff first...
    if (sourceType != obj.sourceType ||
        maxSteps != obj.maxSteps ||
        terminateByDistance != obj.terminateByDistance ||
        termDistance != obj.termDistance ||
        terminateByTime != obj.terminateByTime ||
        termTime != obj.termTime ||
        integrationDirection != obj.integrationDirection ||
        fieldType != obj.fieldType ||
        fieldConstant != obj.fieldConstant ||
        integrationType != obj.integrationType ||
        maxStepLength != obj.maxStepLength ||
        maxTimeStep != obj.maxTimeStep ||
        limitMaximumTimestep != obj.limitMaximumTimestep ||
        relTol != obj.relTol ||
        absTolAbsolute != obj.absTolAbsolute ||
        absTolBBox != obj.absTolBBox ||
        absTolSizeType != obj.absTolSizeType ||
244 245 246 247 248
        cropBeginFlag != obj.cropBeginFlag ||
        cropBegin != obj.cropBegin ||
        cropEndFlag != obj.cropEndFlag ||
        cropEnd != obj.cropEnd ||
        cropValue != obj.cropValue ||
249 250 251 252
        pathlines != obj.pathlines ||
        pathlinesOverrideStartingTimeFlag != obj.pathlinesOverrideStartingTimeFlag ||
        pathlinesOverrideStartingTime != obj.pathlinesOverrideStartingTime ||
        pathlinesCMFE != obj.pathlinesCMFE ||
253 254
        dataVariable != obj.dataVariable ||
        (dataValue != obj.dataValue && obj.dataValue != Solid) ||
255 256 257 258 259
        ((dataValue == CorrelationDistance) &&
         (correlationDistanceAngTol != obj.correlationDistanceAngTol ||
          correlationDistanceMinDistAbsolute != obj.correlationDistanceMinDistAbsolute ||
          correlationDistanceMinDistBBox != obj.correlationDistanceMinDistBBox ||
          correlationDistanceMinDistType != obj.correlationDistanceMinDistType)) ||
260 261
        0 )
    {
262

263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278
        return true;
    }
         
    // If they say they don't want warnings, then don't re-execute.  If they say they do,
    // then we better re-execute so we can give them that warning.
    if (issueTerminationWarnings != obj.issueTerminationWarnings &&
        obj.issueTerminationWarnings == true)
        return true;

    if (fieldType == FlashField &&
        POINT_DIFFERS(velocitySource, obj.velocitySource))
    {
        return true;
    }

    //Check by source type.
279 280
    if ((sourceType == SpecifiedPoint) &&
        POINT_DIFFERS(pointSource, obj.pointSource))
281 282 283 284
    {
        return true;
    }

285
    if (sourceType == SpecifiedLine)
286 287 288 289 290 291 292 293 294 295 296 297
    {
        if (POINT_DIFFERS(lineStart, obj.lineStart) ||
            POINT_DIFFERS(lineEnd, obj.lineEnd) ||
            randomSamples != obj.randomSamples ||
            (!randomSamples && (sampleDensity0 != obj.sampleDensity0)) ||
            (randomSamples && (randomSeed != obj.randomSeed ||
                               numberOfRandomSamples != obj.numberOfRandomSamples)))
        {
            return true;
        }
    }

298
    if (sourceType == SpecifiedPlane)
299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315
    {
        if (POINT_DIFFERS(planeOrigin, obj.planeOrigin) ||
            POINT_DIFFERS(planeNormal, obj.planeNormal) ||
            POINT_DIFFERS(planeUpAxis, obj.planeUpAxis) ||
            sampleDistance0 != obj.sampleDistance0 ||
            sampleDistance1 != obj.sampleDistance1 ||
            randomSamples != obj.randomSamples ||
            fillInterior != obj.fillInterior ||
            (randomSamples && (randomSeed != obj.randomSeed ||
                               numberOfRandomSamples != obj.numberOfRandomSamples)) ||
            (!randomSamples && (sampleDensity0 != obj.sampleDensity0 ||
                                sampleDensity1 != obj.sampleDensity1)))
        {
            return true;
        }
    }

316
    if (sourceType == Circle)
317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333
    {
        if (POINT_DIFFERS(planeOrigin, obj.planeOrigin) ||
            POINT_DIFFERS(planeNormal, obj.planeNormal) ||
            POINT_DIFFERS(planeUpAxis, obj.planeUpAxis) ||
            radius != obj.radius ||
            randomSamples != obj.randomSamples ||
            fillInterior != obj.fillInterior ||
            (randomSamples && (randomSeed != obj.randomSeed ||
                               numberOfRandomSamples != obj.numberOfRandomSamples)) ||
            (!randomSamples && fillInterior && (sampleDensity0 != obj.sampleDensity0 ||
                                                sampleDensity1 != obj.sampleDensity1)) ||
            (!randomSamples && !fillInterior && (sampleDensity0 != obj.sampleDensity0)))
        {
            return true;
        }
    }

334
    if (sourceType == SpecifiedSphere)
335 336 337 338 339 340 341 342 343 344 345 346 347 348 349
    {
        if (POINT_DIFFERS(sphereOrigin, obj.sphereOrigin) ||
            radius != obj.radius ||
            randomSamples != obj.randomSamples ||
            fillInterior != obj.fillInterior ||
            (randomSamples && (randomSeed != obj.randomSeed ||
                               numberOfRandomSamples != obj.numberOfRandomSamples)) ||
            (!randomSamples && (sampleDensity0 != obj.sampleDensity0 ||
                                sampleDensity1 != obj.sampleDensity1 ||
                                sampleDensity2 != obj.sampleDensity2)))
        {
            return true;
        }
    }

350
    if (sourceType == SpecifiedBox)
351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366
    {
        if (POINT_DIFFERS(boxExtents, obj.boxExtents) ||
            POINT_DIFFERS(boxExtents+3, obj.boxExtents+3) ||
            useWholeBox != obj.useWholeBox ||
            randomSamples != obj.randomSamples ||
            fillInterior != obj.fillInterior ||
            (randomSamples && (randomSeed != obj.randomSeed ||
                               numberOfRandomSamples != obj.numberOfRandomSamples)) ||
            (!randomSamples && (sampleDensity0 != obj.sampleDensity0 ||
                                sampleDensity1 != obj.sampleDensity1 ||
                                sampleDensity2 != obj.sampleDensity2)))
        {
            return true;
        }
    }
    
367
    if (sourceType == PointList || sourceType == FieldData)
368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390
    {
        if (pointList.size() != obj.pointList.size())
            return true;
        else
            for (size_t i = 0 ; i < pointList.size() ; i++)
                if (pointList[i] != obj.pointList[i])
                    return true;
    }
    if (sourceType == Selection)
    {
        if (selection != obj.selection ||
            randomSamples != obj.randomSamples ||
            (!randomSamples && (sampleDensity0 != obj.sampleDensity0)) ||
            (randomSamples && (randomSeed != obj.randomSeed ||
                               numberOfRandomSamples != obj.numberOfRandomSamples)))
        {
            return true;
        }
    }

    return false;
}

cyrush's avatar
cyrush committed
391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459
Function: ProcessOldVersions
Declaration: virtual void ProcessOldVersions(DataNode *node, const char *configVersion);
Definition:
// ****************************************************************************
// Method: IntegralCurveAttributes::ProcessOldVersions
//
// Purpose:
//   Updates the config settings in the data node to the current IndexSelect
//   opertor version.
//
// Arguments:
//   parentNode    : The data node that stores the IndexSelect attributes.
//   configVersion : The version of the config file from which the node
//                   was read.
//
// Programmer: Allen Sanderson
// Creation:   8 March 2016
//
// Modifications:
//
// ****************************************************************************

void
IntegralCurveAttributes::ProcessOldVersions(DataNode *parentNode,
    const char *configVersion)
{
    if(parentNode == 0)
        return;

    if (VersionLessThan(configVersion, "2.11.0"))
    {
        DataNode *searchNode = parentNode->GetNode("IntegralCurveAttributes");
        if(searchNode == 0)
            return;

        DataNode *sourceNode = searchNode->GetNode("sourceType");
        if(sourceNode == 0)
            return;

        std::string mode = sourceNode->AsString();
        
        if (mode == "Point")
        {
          searchNode->RemoveNode(sourceNode, true);
          searchNode->AddNode(new DataNode("sourceType", SourceType_ToString(IntegralCurveAttributes::SpecifiedPoint)));
        }
        else if (mode == "Line_")
        {
          searchNode->RemoveNode(sourceNode, true);
          searchNode->AddNode(new DataNode("sourceType", SourceType_ToString(IntegralCurveAttributes::SpecifiedLine)));
        }
        else if (mode == "Plane")
        {
          searchNode->RemoveNode(sourceNode, true);
          searchNode->AddNode(new DataNode("sourceType", SourceType_ToString(IntegralCurveAttributes::SpecifiedPlane)));
        }
        else if (mode == "Box")
        {
          searchNode->RemoveNode(sourceNode, true);
          searchNode->AddNode(new DataNode("sourceType", SourceType_ToString(IntegralCurveAttributes::SpecifiedBox)));
        }
        else if (mode == "Sphere")
        {
          searchNode->RemoveNode(sourceNode, true);
          searchNode->AddNode(new DataNode("sourceType", SourceType_ToString(IntegralCurveAttributes::SpecifiedSphere)));
        }
    }
}

460
Target: xml2info
461 462
Function: IntegralCurveViewerEnginePluginInfo::GetOperatorVarDescription
Declaration: virtual std::string GetOperatorVarDescription(AttributeSubject *atts, const avtPlotMetaData &plot);
463 464
Definition:
// ****************************************************************************
465
//  Method: IntegralCurveViewerEnginePluginInfo::GetOperatorVarDescription
466 467 468 469 470 471 472 473 474 475 476 477 478
//
//  Purpose:
//    Return the operator variable description.
//
//  Arguments:
//    atts        The attribute subject to initialize.
//    plot        The viewer plot that owns the operator.
//
//  Programmer: Allen Sanderson
//  Creation:   19 August 2013
//
// ****************************************************************************

479 480
#include <avtPlotMetaData.h>
#include <cstring>
481
std::string
482 483
IntegralCurveViewerEnginePluginInfo::GetOperatorVarDescription(AttributeSubject *atts,
                                                               const avtPlotMetaData &plot)
484 485 486
{
    IntegralCurveAttributes *atts_in = (IntegralCurveAttributes *)atts;

487 488 489 490 491
    const char *typeString[11] =
      { "None", "Seed Point ID", "Speed", "Vorticity", "Arc Length",
         "Absolute Time", "Relative Time",
         "Ave. dist. from seed", "Correlation Distance", "Difference",
         "Variable" };
492

493
    std::string var = plot.GetVariableName();
494 495 496 497 498 499 500 501 502

    if( strncmp(var.c_str(), "operators/IntegralCurve/",
                strlen("operators/IntegralCurve/")) == 0)
    {
      std::string justTheVar = var.substr(strlen("operators/IntegralCurve/"));

      var = justTheVar;
    }
    
503 504 505 506 507 508 509 510
    else if( strncmp(var.c_str(), "operators/LCS/",
                     strlen("operators/LCS/")) == 0)
    {
      std::string justTheVar = var.substr(strlen("operators/LCS/"));

      var = justTheVar;
    }

511
    var += std::string(" - ") +
512
        std::string(typeString[atts_in->GetDataValue()]);
513

514
    if( atts_in->GetDataValue() == IntegralCurveAttributes::Variable ) 
515
    {
516
        var += std::string(": ") + atts_in->GetDataVariable();
517 518 519 520
    }

    return var;
}
cyrush's avatar
cyrush committed
521