void SimulationDataContainer::setCellDataComponent( const std::string& key ,
                                                        size_t component ,
                                                        const std::vector<int>& cells ,
                                                        const std::vector<double>& values) {
        auto& data = getCellData( key );
        if (component >= m_num_phases)
            OPM_THROW(std::invalid_argument, "The component number: " << component << " is invalid");


        if (cells.size() != values.size())
            OPM_THROW(std::invalid_argument, "size mismatch between cells and values");

        // This is currently quite broken; the setCellDataComponent
        // method assumes that the number of components in the field
        // we are currently focusing on has num_phases components in
        // total. This restriction should be lifted by allowing a per
        // field number of components.

        if (data.size() != m_num_phases * m_num_cells)
            OPM_THROW(std::invalid_argument , "Can currently only be used on fields with num_components == num_phases (i.e. saturation...) ");


        for (size_t i = 0; i < cells.size(); i++) {
            if (size_t(cells[i]) < m_num_cells) {
                auto field_index = cells[i] * m_num_phases + component;
                data[field_index] = values[i];
            } else {
                OPM_THROW(std::invalid_argument , "The cell number: " << cells[i] << " is invalid.");
            }
        }
    }
示例#2
0
bool CSVWorld::TableEditIdAction::isValidIdCell(int row, int column) const
{
    CellData data = getCellData(row, column);
    CSMWorld::UniversalId::Type idType = CSMWorld::TableMimeData::convertEnums(data.first);
    return CSMWorld::ColumnBase::isId(data.first) && 
           idType != CSMWorld::UniversalId::Type_None &&
           !data.second.isEmpty();
}
	void WidgetsWindow::notifySelectWidgetType(MyGUI::Widget* _sender)
	{
		SkinInfo data = getCellData(_sender);

		if (getCellSelected(_sender))
			WidgetCreatorManager::getInstance().resetCreatorInfo();
		else
			WidgetCreatorManager::getInstance().setCreatorInfo(data.widget_type, data.widget_skin);
	}
示例#4
0
void CSVWorld::TableEditIdAction::setCell(int row, int column)
{
    CellData data = getCellData(row, column);
    CSMWorld::UniversalId::Type idType = CSMWorld::TableMimeData::convertEnums(data.first);

    if (idType != CSMWorld::UniversalId::Type_None)
    {
        mCurrentId = CSMWorld::UniversalId(idType, data.second.toUtf8().constData());
        setText("Edit '" + data.second + "'");
    }
}
	void WidgetsWindow::notifyToolTip(MyGUI::Widget* _sender, const MyGUI::ToolTipInfo& _info)
	{
		if (_info.type == MyGUI::ToolTipInfo::Show)
		{
			SkinInfo data = getCellData(_sender);
			EditorToolTip::getInstancePtr()->show(data);
			EditorToolTip::getInstancePtr()->move(_info.point);
		}
		else if (_info.type == MyGUI::ToolTipInfo::Hide)
		{
			EditorToolTip::getInstancePtr()->hide();
		}
		else if (_info.type == MyGUI::ToolTipInfo::Move)
		{
			EditorToolTip::getInstancePtr()->move(_info.point);
		}
	}
 const std::vector<double>& SimulationDataContainer::saturation() const {
     return getCellData("SATURATION");
 }
 const std::vector<double>& SimulationDataContainer::temperature() const {
     return getCellData("TEMPERATURE");
 }
 const std::vector<double>& SimulationDataContainer::pressure( ) const {
     return getCellData("PRESSURE");
 }
 size_t SimulationDataContainer::numCellDataComponents( const std::string& name ) const {
     const auto& data = getCellData( name );
     return data.size() / m_num_cells;
 }