OpenStudioCore:analysis
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
Protected Member Functions | Related Functions | List of all members
openstudio::analysis::DataPoint Class Reference

#include <DataPoint.hpp>

+ Inheritance diagram for openstudio::analysis::DataPoint:

Public Member Functions

Constructors and Destructors
 DataPoint (const UUID &uuid, const UUID &versionUUID, const std::string &name, const std::string &displayName, const std::string &description, const Problem &problem, bool complete, bool failed, bool selected, DataPointRunType runType, const std::vector< QVariant > &variableValues, const std::vector< double > &responseValues, const openstudio::path &directory, const boost::optional< FileReference > &osmInputData, const boost::optional< FileReference > &idfInputData, const boost::optional< FileReference > &sqlOutputData, const boost::optional< runmanager::Job > &topLevelJob, const std::vector< openstudio::path > &dakotaParametersFiles, const std::vector< Tag > &tags, const std::vector< Attribute > &outputAttributes)
 Constructor provided for deserialization; not for general use. More...
 
 DataPoint (const UUID &uuid, const UUID &versionUUID, const std::string &name, const std::string &displayName, const std::string &description, const UUID &problemUUID, const boost::optional< UUID > &analysisUUID, bool complete, bool failed, bool selected, DataPointRunType runType, const std::vector< QVariant > &variableValues, const std::vector< double > &responseValues, const openstudio::path &directory, const boost::optional< FileReference > &osmInputData, const boost::optional< FileReference > &idfInputData, const boost::optional< FileReference > &sqlOutputData, const boost::optional< runmanager::Job > &topLevelJob, const std::vector< openstudio::path > &dakotaParametersFiles, const std::vector< Tag > &tags, const std::vector< Attribute > &outputAttributes)
 Constructor provided for deserialization; not for general use. More...
 
virtual ~DataPoint ()
 
Getters and Queries
bool hasProblem () const
 Returns true if DataPoint has access to the Problem that created it. More...
 
Problem problem () const
 Returns the Problem used to create/associated with this DataPoint. More...
 
UUID problemUUID () const
 Returns the UUID of the Problem that created this DataPoint. More...
 
boost::optional< UUID > analysisUUID () const
 Returns the UUID of the Analysis that parents this DataPoint. More...
 
bool isComplete () const
 Returns true if the DataPoint has been simulated. More...
 
bool complete () const
 Returns true if the DataPoint has been simulated. More...
 
bool failed () const
 Returns true if the DataPoint was simulated, but the simulation failed, or output results could not be retrieved for some other reason. More...
 
bool selected () const
 Returns true if the DataPoint is selected (to be simulated in the next batch). More...
 
DataPointRunType runType () const
 
std::vector< QVariant > variableValues () const
 Returns the variableValues to be applied in simulating this DataPoint. More...
 
std::vector< double > responseValues () const
 Returns the value of the response functions for this DataPoint. More...
 
openstudio::path directory () const
 Run directory for this DataPoint. More...
 
boost::optional< FileReference > osmInputData () const
 Returns the final OSM file in the workflow, if the DataPoint isComplete() but not failed(), and said file was located by problem(). More...
 
boost::optional< FileReference > idfInputData () const
 Returns the final IDF file in the workflow, if the DataPoint isComplete() but not failed(), and said file was located by problem(). More...
 
boost::optional< FileReference > sqlOutputData () const
 Returns the EnergyPlus SqLite output file, if the DataPoint isComplete() but not failed(), and said file was located by problem(). More...
 
std::vector< FileReference > xmlOutputData () const
 Returns the openstudio::Attribute and openstudio::result::OSResult XML files created associated with this DataPoint, if complete() and not failed(). More...
 
boost::optional< model::Model > model () const
 If osmInputData() exists, returns the corresponding model::Model. More...
 
boost::optional< Workspace > workspace () const
 If idfInputData() exists, returns the corresponding Workspace. More...
 
boost::optional< SqlFile > sqlFile () const
 If sqlOutputData() exists, returns the corresponding SqlFile, which is also available through model()->sqlFile(), if model() exists. More...
 
std::vector< Attribute > outputAttributes () const
 If xmlOutputData() exists, returns the corresponding openstudio::Attributes. More...
 
boost::optional< Attribute > getOutputAttribute (const std::string &attributeName) const
 Returns the outputAttributes() element with attributeName, if it exists. More...
 
std::vector< Tag > tags () const
 
bool isTag (const std::string &tagName) const
 
bool matches (const std::vector< QVariant > &testVariableValues) const
 Returns true if testVariableValues.size() <= variableValues().size(), and any non-null values match. More...
 
boost::optional< runmanager::Job > topLevelJob () const
 Returns the top level job associated with this data point. More...
 
std::vector< openstudio::path > dakotaParametersFiles () const
 Returns vector of dakotaParameterFiles associated with this data point. More...
 
Setters
void setSelected (bool selected)
 
void setRunType (const DataPointRunType &runType)
 
void setDirectory (const openstudio::path &directory)
 Sets the run directory for this DataPoint. More...
 
void addTag (const std::string &tagName)
 
void deleteTag (const std::string &tagName)
 
Actions
bool updateFromJSON (const std::string &json, boost::optional< runmanager::RunManager > &runManager)
 Update high level results from json. More...
 
bool updateDetails (boost::optional< runmanager::RunManager > &runManager)
 Whoever downloaded the zip file should have setDirectory(), and had the file placed in directory() / toPath("dataPoint.zip"). More...
 
void clearFileDataFromCache () const
 Clear model, workspace, and sqlFile from cache. More...
 
void clearAllDataFromCache () const
 Clear model, workspace, sqlFile, and outputAttributes from cache. More...
 
void clearResults ()
 
- Public Member Functions inherited from openstudio::analysis::AnalysisObject
virtual ~AnalysisObject ()
 
AnalysisObject clone () const
 Deep copy. More...
 
std::string name () const
 
std::string displayName () const
 
std::string description () const
 
openstudio::UUID uuid () const
 
openstudio::UUID versionUUID () const
 
bool isDirty () const
 Returns true if this object has been changed since its dirty flag was last cleared. More...
 
bool operator== (const AnalysisObject &other) const
 Compare impls. More...
 
bool operator!= (const AnalysisObject &other) const
 
bool uuidEqual (const AnalysisObject &other) const
 
bool uuidAndVersionEqual (const AnalysisObject &other) const
 
boost::optional< AnalysisObjectparent () const
 
void setName (const std::string &newName)
 
void setDisplayName (const std::string &newDisplayName)
 
void setDescription (const std::string &newDescription)
 
bool clearDirtyFlag ()
 Call this method to reset the dirty flag of this object and all its children. More...
 
bool connect (const char *signal, const QObject *receiver, const char *slot, Qt::ConnectionType type=Qt::AutoConnection) const
 Connect signal from this AnalysisObject to slot on receiver. More...
 
bool disconnect (const char *signal=nullptr, const QObject *receiver=nullptr, const char *slot=nullptr) const
 
template<typename T >
cast () const
 Cast to type T. More...
 
template<typename T >
boost::optional< T > optionalCast () const
 Cast to boost::optional<T>. More...
 

Protected Member Functions

 DataPoint (const Problem &problem, const std::vector< QVariant > &variableValues)
 Constructor from variableValues. More...
 
void markComplete ()
 
void markFailed ()
 
void setIdfInputData (const FileReference &file)
 
void setOsmInputData (const FileReference &file)
 
void setProblem (const Problem &problem)
 Let Analysis_Impl set the DataPoint's Problem to get a clean clone. More...
 
void setResponseValues (const std::vector< double > &values)
 
void setSqlOutputData (const FileReference &file)
 
void setXmlOutputData (const std::vector< FileReference > &files)
 

Related Functions

(Note that these are not member functions.)

typedef std::vector< DataPointDataPointVector
 
AnalysisJSONLoadResult loadJSON (const openstudio::path &p)
 Factory method for loading JSON containing an AnalysisObject. More...
 
AnalysisJSONLoadResult loadJSON (std::istream &json)
 Factory method for loading JSON containing an AnalysisObject. More...
 
AnalysisJSONLoadResult loadJSON (const std::string &json)
 Factory method for loading JSON containing an AnalysisObject. More...
 
typedef boost::optional
< DataPoint
OptionalDataPoint
 

Serialization

bool saveJSON (const openstudio::path &p, bool overwrite=false) const
 
std::ostream & toJSON (std::ostream &os) const
 
std::string toJSON () const
 
static boost::optional< DataPointloadJSON (const openstudio::path &p)
 
static boost::optional< DataPointloadJSON (std::istream &json)
 
static boost::optional< DataPointloadJSON (const std::string &json)
 

Detailed Description

DataPoint is an AnalysisObject that describes a single simulation run/to be run for a given Analysis.

New DataPoints are constructed using Problem::createDataPoint, since the DataPoint variableValues only make sense in the context of a Problem. Similarly, results only make sense in the context of an Analysis, where there is a specific Problem and a specific seed file defined. Therefore, once a DataPoint is created, it should be added to an Analysis (Analysis::addDataPoint), and then run using an analysisdriver::AnalysisDriver. In many cases, the createDataPoint and addDataPoint steps are hidden from the user through the use of an Algorithm.

Constructor & Destructor Documentation

openstudio::analysis::DataPoint::DataPoint ( const UUID &  uuid,
const UUID &  versionUUID,
const std::string &  name,
const std::string &  displayName,
const std::string &  description,
const Problem problem,
bool  complete,
bool  failed,
bool  selected,
DataPointRunType  runType,
const std::vector< QVariant > &  variableValues,
const std::vector< double > &  responseValues,
const openstudio::path &  directory,
const boost::optional< FileReference > &  osmInputData,
const boost::optional< FileReference > &  idfInputData,
const boost::optional< FileReference > &  sqlOutputData,
const boost::optional< runmanager::Job > &  topLevelJob,
const std::vector< openstudio::path > &  dakotaParametersFiles,
const std::vector< Tag > &  tags,
const std::vector< Attribute > &  outputAttributes 
)

Constructor provided for deserialization; not for general use.

openstudio::analysis::DataPoint::DataPoint ( const UUID &  uuid,
const UUID &  versionUUID,
const std::string &  name,
const std::string &  displayName,
const std::string &  description,
const UUID &  problemUUID,
const boost::optional< UUID > &  analysisUUID,
bool  complete,
bool  failed,
bool  selected,
DataPointRunType  runType,
const std::vector< QVariant > &  variableValues,
const std::vector< double > &  responseValues,
const openstudio::path &  directory,
const boost::optional< FileReference > &  osmInputData,
const boost::optional< FileReference > &  idfInputData,
const boost::optional< FileReference > &  sqlOutputData,
const boost::optional< runmanager::Job > &  topLevelJob,
const std::vector< openstudio::path > &  dakotaParametersFiles,
const std::vector< Tag > &  tags,
const std::vector< Attribute > &  outputAttributes 
)

Constructor provided for deserialization; not for general use.

virtual openstudio::analysis::DataPoint::~DataPoint ( )
inlinevirtual
openstudio::analysis::DataPoint::DataPoint ( const Problem problem,
const std::vector< QVariant > &  variableValues 
)
protected

Constructor from variableValues.

Called by Problem::createDataPoint. After construction complete() == false and selected() == true.

Member Function Documentation

void openstudio::analysis::DataPoint::addTag ( const std::string &  tagName)
boost::optional<UUID> openstudio::analysis::DataPoint::analysisUUID ( ) const

Returns the UUID of the Analysis that parents this DataPoint.

void openstudio::analysis::DataPoint::clearAllDataFromCache ( ) const

Clear model, workspace, sqlFile, and outputAttributes from cache.

void openstudio::analysis::DataPoint::clearFileDataFromCache ( ) const

Clear model, workspace, and sqlFile from cache.

void openstudio::analysis::DataPoint::clearResults ( )
bool openstudio::analysis::DataPoint::complete ( ) const

Returns true if the DataPoint has been simulated.

std::vector<openstudio::path> openstudio::analysis::DataPoint::dakotaParametersFiles ( ) const

Returns vector of dakotaParameterFiles associated with this data point.

void openstudio::analysis::DataPoint::deleteTag ( const std::string &  tagName)
openstudio::path openstudio::analysis::DataPoint::directory ( ) const

Run directory for this DataPoint.

Set by analysisdriver::AnalysisDriver.

bool openstudio::analysis::DataPoint::failed ( ) const

Returns true if the DataPoint was simulated, but the simulation failed, or output results could not be retrieved for some other reason.

boost::optional<Attribute> openstudio::analysis::DataPoint::getOutputAttribute ( const std::string &  attributeName) const

Returns the outputAttributes() element with attributeName, if it exists.

bool openstudio::analysis::DataPoint::hasProblem ( ) const

Returns true if DataPoint has access to the Problem that created it.

Should be true unless DataPoint was deserialized from JSON and has not yet been assimilated back into its parent Analysis.

boost::optional<FileReference> openstudio::analysis::DataPoint::idfInputData ( ) const

Returns the final IDF file in the workflow, if the DataPoint isComplete() but not failed(), and said file was located by problem().

bool openstudio::analysis::DataPoint::isComplete ( ) const

Returns true if the DataPoint has been simulated.

Deprecated:
bool openstudio::analysis::DataPoint::isTag ( const std::string &  tagName) const
static boost::optional<DataPoint> openstudio::analysis::DataPoint::loadJSON ( const openstudio::path &  p)
static
static boost::optional<DataPoint> openstudio::analysis::DataPoint::loadJSON ( std::istream &  json)
static
static boost::optional<DataPoint> openstudio::analysis::DataPoint::loadJSON ( const std::string &  json)
static
void openstudio::analysis::DataPoint::markComplete ( )
protected
void openstudio::analysis::DataPoint::markFailed ( )
protected
bool openstudio::analysis::DataPoint::matches ( const std::vector< QVariant > &  testVariableValues) const

Returns true if testVariableValues.size() <= variableValues().size(), and any non-null values match.

Otherwise, returns false.

boost::optional<model::Model> openstudio::analysis::DataPoint::model ( ) const

If osmInputData() exists, returns the corresponding model::Model.

Also caches the Model for future use.

boost::optional<FileReference> openstudio::analysis::DataPoint::osmInputData ( ) const

Returns the final OSM file in the workflow, if the DataPoint isComplete() but not failed(), and said file was located by problem().

std::vector<Attribute> openstudio::analysis::DataPoint::outputAttributes ( ) const

If xmlOutputData() exists, returns the corresponding openstudio::Attributes.

Caches the Attributes for future use.

Problem openstudio::analysis::DataPoint::problem ( ) const

Returns the Problem used to create/associated with this DataPoint.

UUID openstudio::analysis::DataPoint::problemUUID ( ) const

Returns the UUID of the Problem that created this DataPoint.

std::vector<double> openstudio::analysis::DataPoint::responseValues ( ) const

Returns the value of the response functions for this DataPoint.

Only non-empty if isComplete() and not failed() (and problem().numResponses() > 0).

DataPointRunType openstudio::analysis::DataPoint::runType ( ) const
bool openstudio::analysis::DataPoint::saveJSON ( const openstudio::path &  p,
bool  overwrite = false 
) const
bool openstudio::analysis::DataPoint::selected ( ) const

Returns true if the DataPoint is selected (to be simulated in the next batch).

void openstudio::analysis::DataPoint::setDirectory ( const openstudio::path &  directory)

Sets the run directory for this DataPoint.

Generally called by analysisdriver::AnalysisDriver.

void openstudio::analysis::DataPoint::setIdfInputData ( const FileReference &  file)
protected
void openstudio::analysis::DataPoint::setOsmInputData ( const FileReference &  file)
protected
void openstudio::analysis::DataPoint::setProblem ( const Problem problem)
protected

Let Analysis_Impl set the DataPoint's Problem to get a clean clone.

void openstudio::analysis::DataPoint::setResponseValues ( const std::vector< double > &  values)
protected
void openstudio::analysis::DataPoint::setRunType ( const DataPointRunType runType)
void openstudio::analysis::DataPoint::setSelected ( bool  selected)
void openstudio::analysis::DataPoint::setSqlOutputData ( const FileReference &  file)
protected
void openstudio::analysis::DataPoint::setXmlOutputData ( const std::vector< FileReference > &  files)
protected
boost::optional<SqlFile> openstudio::analysis::DataPoint::sqlFile ( ) const

If sqlOutputData() exists, returns the corresponding SqlFile, which is also available through model()->sqlFile(), if model() exists.

Also caches the SqlFile for future use.

boost::optional<FileReference> openstudio::analysis::DataPoint::sqlOutputData ( ) const

Returns the EnergyPlus SqLite output file, if the DataPoint isComplete() but not failed(), and said file was located by problem().

std::vector<Tag> openstudio::analysis::DataPoint::tags ( ) const
std::ostream& openstudio::analysis::DataPoint::toJSON ( std::ostream &  os) const
std::string openstudio::analysis::DataPoint::toJSON ( ) const
boost::optional<runmanager::Job> openstudio::analysis::DataPoint::topLevelJob ( ) const

Returns the top level job associated with this data point.

See also
Problem::getJobsByWorkflowStep
bool openstudio::analysis::DataPoint::updateDetails ( boost::optional< runmanager::RunManager > &  runManager)

Whoever downloaded the zip file should have setDirectory(), and had the file placed in directory() / toPath("dataPoint.zip").

bool openstudio::analysis::DataPoint::updateFromJSON ( const std::string &  json,
boost::optional< runmanager::RunManager > &  runManager 
)

Update high level results from json.

std::vector<QVariant> openstudio::analysis::DataPoint::variableValues ( ) const

Returns the variableValues to be applied in simulating this DataPoint.

(That is, inputData will be the result of applying variableValues to the Analysis seed file.)

boost::optional<Workspace> openstudio::analysis::DataPoint::workspace ( ) const

If idfInputData() exists, returns the corresponding Workspace.

Also caches the Workspace for future use.

std::vector<FileReference> openstudio::analysis::DataPoint::xmlOutputData ( ) const

Returns the openstudio::Attribute and openstudio::result::OSResult XML files created associated with this DataPoint, if complete() and not failed().

Otherwise, the return value is .empty().

Friends And Related Function Documentation

typedef std::vector<DataPoint> DataPointVector
related
AnalysisJSONLoadResult loadJSON ( const openstudio::path &  p)
related

Factory method for loading JSON containing an AnalysisObject.

Returned object will be of the correct type.

AnalysisJSONLoadResult loadJSON ( std::istream &  json)
related

Factory method for loading JSON containing an AnalysisObject.

Returned object will be of the correct type.

AnalysisJSONLoadResult loadJSON ( const std::string &  json)
related

Factory method for loading JSON containing an AnalysisObject.

Returned object will be of the correct type.

typedef boost::optional<DataPoint> OptionalDataPoint
related