<commit_before>#include "OutputGeometry.h"
#include "OutputGeometryPart.h"
#include "OutputObject.h"
#include "util.h"
#include "AssetNode.h"

OutputGeometry::~OutputGeometry()
{
}

OutputGeometry::OutputGeometry(int assetId, int objectId, int geoId, OutputObject * parentObject) :
    myParentObject (parentObject),
    myAssetId (assetId),
    myObjectId (objectId),
    myGeoId (geoId)
{
    HAPI_GeoInfo_Init(&myGeoInfo);

    // Do a full update, ignoring what has changed
    HAPI_Result hstat = HAPI_RESULT_SUCCESS;
    try
    {
        hstat = HAPI_GetGeoInfo(myAssetId, myObjectId, myGeoId, &myGeoInfo);
        Util::checkHAPIStatus(hstat);

        if(myGeoInfo.type == HAPI_GEOTYPE_DEFAULT ||
            myGeoInfo.type == HAPI_GEOTYPE_INTERMEDIATE ||
            myGeoInfo.type == HAPI_GEOTYPE_CURVE)
        {
            int partCount = myGeoInfo.partCount;
            myParts.clear();
            myParts.reserve(partCount);

            HAPI_ObjectInfo objectInfo = myParentObject->getObjectInfo();

            for(int ii = 0; ii < partCount; ii++)
            {
                myParts.push_back(OutputGeometryPart(myAssetId,
                                                 myObjectId,
                                                 myGeoId,
                                                 ii,
                                                 objectInfo,
                                                 myGeoInfo
                                                 ));
            }
        }
    }
    catch (HAPIError& e)
    {
        cerr << e.what() << endl;
    }
}

void
OutputGeometry::update()
{
    HAPI_Result hstat = HAPI_RESULT_SUCCESS;
    try
    {
        // update geometry
        HAPI_GeoInfo oldGeoInfo = myGeoInfo;
        hstat = HAPI_GetGeoInfo(myAssetId, myObjectId, myGeoId, &myGeoInfo);
        Util::checkHAPIStatus(hstat);

        if(myGeoInfo.type == HAPI_GEOTYPE_DEFAULT ||
            myGeoInfo.type == HAPI_GEOTYPE_INTERMEDIATE ||
            myGeoInfo.type == HAPI_GEOTYPE_CURVE)
        {
            int partCount = myGeoInfo.partCount;

            // if partCount changed, we clear out the array and make a new one.
            if(oldGeoInfo.partCount != partCount)
            {
                myParts.clear();
                myParts.reserve(partCount);
                HAPI_ObjectInfo objectInfo = myParentObject->getObjectInfo();
                for(int ii = 0; ii < partCount; ii++)
                {
                    myParts.push_back(OutputGeometryPart(myAssetId,
                                                     myObjectId,
                                                     myGeoId,
                                                     ii,
                                                     objectInfo,
                                                     myGeoInfo
                                                     ));
                }
            }
        }
    }
    catch (HAPIError& e)
    {
        cerr << e.what() << endl;
        HAPI_GeoInfo_Init(&myGeoInfo);
    }

}

MStatus
OutputGeometry::compute(MDataHandle &geoHandle, bool &needToSyncOutputs)
{<commit_msg>In OutputGeomtry constructor, call update()<commit_after>#include "OutputGeometry.h"
#include "OutputGeometryPart.h"
#include "OutputObject.h"
#include "util.h"
#include "AssetNode.h"

OutputGeometry::~OutputGeometry()
{
}

OutputGeometry::OutputGeometry(int assetId, int objectId, int geoId, OutputObject * parentObject) :
    myParentObject (parentObject),
    myAssetId (assetId),
    myObjectId (objectId),
    myGeoId (geoId)
{
    update();
}

void
OutputGeometry::update()
{
    HAPI_Result hstat = HAPI_RESULT_SUCCESS;
    try
    {
        // update geometry
        hstat = HAPI_GetGeoInfo(myAssetId, myObjectId, myGeoId, &myGeoInfo);
        Util::checkHAPIStatus(hstat);

        if(myGeoInfo.type == HAPI_GEOTYPE_DEFAULT ||
            myGeoInfo.type == HAPI_GEOTYPE_INTERMEDIATE ||
            myGeoInfo.type == HAPI_GEOTYPE_CURVE)
        {
            int partCount = myGeoInfo.partCount;

            // if partCount is different, we clear out the array and make a new
            // one.
            if(myParts.size() != partCount)
            {
                myParts.clear();
                myParts.reserve(partCount);
                HAPI_ObjectInfo objectInfo = myParentObject->getObjectInfo();
                for(int ii = 0; ii < partCount; ii++)
                {
                    myParts.push_back(OutputGeometryPart(myAssetId,
                                                     myObjectId,
                                                     myGeoId,
                                                     ii,
                                                     objectInfo,
                                                     myGeoInfo
                                                     ));
                }
            }
        }
    }
    catch (HAPIError& e)
    {
        cerr << e.what() << endl;
        HAPI_GeoInfo_Init(&myGeoInfo);
    }

}

MStatus
OutputGeometry::compute(MDataHandle &geoHandle, bool &needToSyncOutputs)
{
{'fraction_non_alphanumeric': 0.08571985193843756, 'fraction_numerical': 0.0005844535359438924, 'mean_word_length': 1.3410852713178294, 'pattern_counts': {'":': 0, '<': 18, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 36, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1150711', 'n_tokens_mistral': 1389, 'n_tokens_neox': 1365, 'n_words': 248}