<commit_before>/* -------------------------------------------------------------------------- *
 *                       OpenSim:  PointKinematics.cpp                        *
 * -------------------------------------------------------------------------- *
 * The OpenSim API is a toolkit for musculoskeletal modeling and simulation.  *
 * See http://opensim.stanford.edu and the NOTICE file for more information.  *
 * OpenSim is developed at Stanford University and supported by the US        *
 * National Institutes of Health (U54 GM072970, R24 HD065690) and by DARPA    *
 * through the Warrior Web program.                                           *
 *                                                                            *
 * Copyright (c) 2005-2012 Stanford University and the Authors                *
 * Author(s): <NAME>, <NAME>                                    *
 *                                                                            *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may    *
 * not use this file except in compliance with the License. You may obtain a  *
 * copy of the License at http://www.apache.org/licenses/LICENSE-2.0.         *
 *                                                                            *
 * Unless required by applicable law or agreed to in writing, software        *
 * distributed under the License is distributed on an "AS IS" BASIS,          *
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   *
 * See the License for the specific language governing permissions and        *
 * limitations under the License.                                             *
 * -------------------------------------------------------------------------- */


//=============================================================================
// INCLUDES
//=============================================================================
#include <string>
#include <OpenSim/Simulation/Model/Model.h>
#include <OpenSim/Simulation/Model/BodySet.h>
#include "PointKinematics.h"


using namespace OpenSim;
using namespace std;
using SimTK::Vec3;

//=============================================================================
// CONSTANTS
//=============================================================================
const int PointKinematics::NAME_LENGTH = PointKinematicsNAME_LENGTH;
const int PointKinematics::BUFFER_LENGTH = PointKinematicsBUFFER_LENGTH;


//=============================================================================
// CONSTRUCTOR(S) AND DESTRUCTOR
//=============================================================================
//_____________________________________________________________________________
/**
 * Destructor.
 */
PointKinematics::~PointKinematics()
{
    if(_dy!=NULL) { delete[] _dy;  _dy=NULL; }
    deleteStorage();
}
//_____________________________________________________________________________
/**
 * Construct an PointKinematics instance for recording the kinematics of
 * the bodies of a model during a simulation. Also serves as a default constructor
 *
 * @param aModel Model for which the analyses are to be recorded.
 */
PointKinematics::PointKinematics(Model *aModel) :
Analysis(aModel),
_body(NULL),
_relativeToBody(NULL),
_bodyName(_bodyNameProp.getValueStr()),
_relativeToBodyName(_relativeToBodyNameProp.getValueStr()),
_point(_pointProp.getValueDblVec()),
_pointName(_pointNameProp.getValueStr())
{
    // NULL
    setNull();

    // STORAGE
    allocateStorage();

    if (aModel==0)
        return;

}


//=============================================================================
// CONSTRUCTION METHODS
//=============================================================================
//=============================================================================
// Object Overrides
//=============================================================================
//_____________________________________________________________________________
/**
 * Construct an object from file.
 *
 * The object is constructed from the root element of the XML document.
 * The type of object is the tag name of the XML root element.
 *
 * @param aFileName File name of the document.
 */
PointKinematics::PointKinematics(const std::string &aFileName):
Analysis(aFileName, false),
_body(NULL),
_relativeToBody(NULL),
_bodyName(_bodyNameProp.getValueStr()),
_relativeToBodyName(_relativeToBodyNameProp.getValueStr()),
_point(_pointProp.getValueDblVec()),
_pointName(_pointNameProp.getValueStr())
{
    setNull();

    // Serialize from XML
    updateFromXMLDocument();

    /* The rest will be done by setModel().
    // CONSTRUCT DESCRIPTION AND LABELS
    constructDescription();
    constructColumnLabels();

    // STORAGE
    allocateStorage();
    */
}

// Copy constructor and virtual copy 
//_____________________________________________________________________________
/**
 * Copy constructor.
 *
 */
PointKinematics::PointKinematics(const PointKinematics &aPointKinematics):
Analysis(aPointKinematics),
_body(aPointKinematics._body),
_relativeToBody(aPointKinematics._relativeToBody),
_bodyName(_bodyNameProp.getValueStr()),
_relativeToBodyName(_relativeToBodyNameProp.getValueStr()),
_point(_pointProp.getValueDblVec()),
_pointName(_pointNameProp.getValueStr())<commit_msg>Initialization order.<commit_after>/* -------------------------------------------------------------------------- *
 *                       OpenSim:  PointKinematics.cpp                        *
 * -------------------------------------------------------------------------- *
 * The OpenSim API is a toolkit for musculoskeletal modeling and simulation.  *
 * See http://opensim.stanford.edu and the NOTICE file for more information.  *
 * OpenSim is developed at Stanford University and supported by the US        *
 * National Institutes of Health (U54 GM072970, R24 HD065690) and by DARPA    *
 * through the Warrior Web program.                                           *
 *                                                                            *
 * Copyright (c) 2005-2012 Stanford University and the Authors                *
 * Author(s): <NAME>, <NAME>                                    *
 *                                                                            *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may    *
 * not use this file except in compliance with the License. You may obtain a  *
 * copy of the License at http://www.apache.org/licenses/LICENSE-2.0.         *
 *                                                                            *
 * Unless required by applicable law or agreed to in writing, software        *
 * distributed under the License is distributed on an "AS IS" BASIS,          *
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   *
 * See the License for the specific language governing permissions and        *
 * limitations under the License.                                             *
 * -------------------------------------------------------------------------- */


//=============================================================================
// INCLUDES
//=============================================================================
#include <string>
#include <OpenSim/Simulation/Model/Model.h>
#include <OpenSim/Simulation/Model/BodySet.h>
#include "PointKinematics.h"


using namespace OpenSim;
using namespace std;
using SimTK::Vec3;

//=============================================================================
// CONSTANTS
//=============================================================================
const int PointKinematics::NAME_LENGTH = PointKinematicsNAME_LENGTH;
const int PointKinematics::BUFFER_LENGTH = PointKinematicsBUFFER_LENGTH;


//=============================================================================
// CONSTRUCTOR(S) AND DESTRUCTOR
//=============================================================================
//_____________________________________________________________________________
/**
 * Destructor.
 */
PointKinematics::~PointKinematics()
{
    if(_dy!=NULL) { delete[] _dy;  _dy=NULL; }
    deleteStorage();
}
//_____________________________________________________________________________
/**
 * Construct an PointKinematics instance for recording the kinematics of
 * the bodies of a model during a simulation. Also serves as a default constructor
 *
 * @param aModel Model for which the analyses are to be recorded.
 */
PointKinematics::PointKinematics(Model *aModel) :
Analysis(aModel),
_body(NULL),
_relativeToBody(NULL),
_bodyName(_bodyNameProp.getValueStr()),
_point(_pointProp.getValueDblVec()),
_pointName(_pointNameProp.getValueStr()),
_relativeToBodyName(_relativeToBodyNameProp.getValueStr())
{
    // NULL
    setNull();

    // STORAGE
    allocateStorage();

    if (aModel==0)
        return;

}


//=============================================================================
// CONSTRUCTION METHODS
//=============================================================================
//=============================================================================
// Object Overrides
//=============================================================================
//_____________________________________________________________________________
/**
 * Construct an object from file.
 *
 * The object is constructed from the root element of the XML document.
 * The type of object is the tag name of the XML root element.
 *
 * @param aFileName File name of the document.
 */
PointKinematics::PointKinematics(const std::string &aFileName):
Analysis(aFileName, false),
_body(NULL),
_relativeToBody(NULL),
_bodyName(_bodyNameProp.getValueStr()),
_point(_pointProp.getValueDblVec()),
_pointName(_pointNameProp.getValueStr()),
_relativeToBodyName(_relativeToBodyNameProp.getValueStr())
{
    setNull();

    // Serialize from XML
    updateFromXMLDocument();

    /* The rest will be done by setModel().
    // CONSTRUCT DESCRIPTION AND LABELS
    constructDescription();
    constructColumnLabels();

    // STORAGE
    allocateStorage();
    */
}

// Copy constructor and virtual copy 
//_____________________________________________________________________________
/**
 * Copy constructor.
 *
 */
PointKinematics::PointKinematics(const PointKinematics &aPointKinematics):
Analysis(aPointKinematics),
_body(aPointKinematics._body),
_relativeToBody(aPointKinematics._relativeToBody),
_bodyName(_bodyNameProp.getValueStr()),
_point(_pointProp.getValueDblVec()),
_pointName(_pointNameProp.getValueStr()),
_relativeToBodyName(_relativeToBodyNameProp.getValueStr())
{'fraction_non_alphanumeric': 0.26161483701760957, 'fraction_numerical': 0.005620082427875608, 'mean_word_length': 2.967670011148272, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 26, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6942476', 'n_tokens_mistral': 2399, 'n_tokens_neox': 2190, 'n_words': 628}