コード例 #1
0
void ActorFactory::print(tinyxml2::XMLPrinter& p_Printer, const InstanceModel& p_Model)
{
	p_Printer.OpenElement("Model");
	p_Printer.PushAttribute("Mesh", p_Model.meshName.c_str());
	pushVector(p_Printer, "Scale", p_Model.scale);
	p_Printer.CloseElement();
}
コード例 #2
0
void ActorFactory::print(tinyxml2::XMLPrinter& p_Printer, const InstanceBoundingVolume& p_Volume)
{
	p_Printer.OpenElement("MeshPhysics");
	p_Printer.PushAttribute("Mesh", p_Volume.meshName.c_str());
	pushVector(p_Printer, "Scale", p_Volume.scale);
	p_Printer.CloseElement();
}
コード例 #3
0
void addEdge(tinyxml2::XMLPrinter& p_Printer, Vector3 p_Position, Vector3 p_Halfsize)
{
	p_Printer.OpenElement("AABBPhysics");
	p_Printer.PushAttribute("IsEdge", true);
	pushVector(p_Printer, "Halfsize", p_Halfsize);
	pushVector(p_Printer, "OffsetPosition", p_Position);
	p_Printer.CloseElement();
}
コード例 #4
0
void LookComponent::serialize(tinyxml2::XMLPrinter& p_Printer) const
{
	p_Printer.OpenElement("Look");
	pushVector(p_Printer, "OffsetPosition", m_OffsetPosition);
	pushVector(p_Printer, "Forward", m_Forward);
	pushVector(p_Printer, "Up", m_Up);
	p_Printer.CloseElement();
}
コード例 #5
0
void NumericalIntegration::write_XML(tinyxml2::XMLPrinter& file_stream) const
{
    std::ostringstream buffer;

    file_stream.OpenElement("NumericalIntegration");

    // Numerical integration method

    file_stream.OpenElement("NumericalIntegrationMethod");

    file_stream.PushText(write_numerical_integration_method().c_str());

    file_stream.CloseElement();

    // Display

    file_stream.OpenElement("Display");

    buffer.str("");
    buffer << display;

    file_stream.PushText(buffer.str().c_str());

    file_stream.CloseElement();


    file_stream.CloseElement();
}
コード例 #6
0
void TrainingAlgorithm::write_XML(tinyxml2::XMLPrinter& file_stream) const
{
    std::ostringstream buffer;

    file_stream.OpenElement("TrainingAlgorithm");

    // Display

    file_stream.OpenElement("Display");

    buffer.str("");
    buffer << display;

    file_stream.PushText(buffer.str().c_str());

    file_stream.CloseElement();


    file_stream.CloseElement();
}
コード例 #7
0
void NeuralParametersNorm::write_XML(tinyxml2::XMLPrinter& file_stream) const
{
    std::ostringstream buffer;

    //file_stream.OpenElement("NeuralParametersNorm");

    // Neural parameters norm weight

    file_stream.OpenElement("NeuralParametersNormWeight");

    buffer.str("");
    buffer << neural_parameters_norm_weight;

    file_stream.PushText(buffer.str().c_str());

    file_stream.CloseElement();


    //file_stream.CloseElement();
}
コード例 #8
0
ファイル: minkowski_error.cpp プロジェクト: Artelnics/OpenNN
void MinkowskiError::write_XML(tinyxml2::XMLPrinter& file_stream) const
{
    std::ostringstream buffer;

    //file_stream.OpenElement("MinkowskiError");

    // Minkowski parameter

    file_stream.OpenElement("MinkowskiParameter");

    buffer.str("");
    buffer << Minkowski_parameter;

    file_stream.PushText(buffer.str().c_str());

    file_stream.CloseElement();


    //file_stream.CloseElement();
}
コード例 #9
0
ファイル: Elevator.cpp プロジェクト: Hmaal/OpenSkyscraper
void Elevator::encodeXML(tinyxml2::XMLPrinter & xml)
{
	Item::encodeXML(xml);
	xml.PushAttribute("height", size.y);
	for (std::set<int>::iterator i = unservicedFloors.begin(); i != unservicedFloors.end(); i++) {
		xml.OpenElement("unserviced");
		xml.PushAttribute("floor", *i);
		xml.CloseElement();
	}
	for (Cars::iterator c = cars.begin(); c != cars.end(); c++) {
		xml.OpenElement("car");
		(*c)->encodeXML(xml);
		xml.CloseElement();
	}
}
コード例 #10
0
void RegularizationTerm::write_XML(tinyxml2::XMLPrinter& file_stream) const
{
    file_stream.OpenElement("RegularizationTerm");

    file_stream.CloseElement();
}
コード例 #11
0
ファイル: bounding_layer.cpp プロジェクト: Artelnics/OpenNN
void BoundingLayer::write_XML(tinyxml2::XMLPrinter& file_stream) const
{
   std::ostringstream buffer;

   file_stream.OpenElement("BoundingLayer");

   // Lower bounds

   {
      file_stream.OpenElement("LowerBounds");

      buffer.str("");
      buffer << lower_bounds;

      file_stream.PushText(buffer.str().c_str());

      file_stream.CloseElement();
   }

   // Upper bounds

   {
      file_stream.OpenElement("UpperBounds");

      buffer.str("");
      buffer << upper_bounds;

      file_stream.PushText(buffer.str().c_str());

      file_stream.CloseElement();
   }

   // Display

   {
      file_stream.OpenElement("Display");

      buffer.str("");
      buffer << display;

      file_stream.PushText(buffer.str().c_str());

      file_stream.CloseElement();
   }

   file_stream.CloseElement();
}
コード例 #12
0
void ActorFactory::print(tinyxml2::XMLPrinter& p_Printer, const InstanceEdgeBox& p_Edge, Vector3 p_Scale)
{
	p_Printer.OpenElement("OBBPhysics");
	p_Printer.PushAttribute("Immovable", true);
	p_Printer.PushAttribute("Mass", 0.f);
	p_Printer.PushAttribute("IsEdge", true);

	using namespace DirectX;

	XMFLOAT3 position = p_Edge.offsetPosition;
	XMFLOAT3 rotation = p_Edge.offsetRotation;
	XMFLOAT3 halfSize = p_Edge.halfsize;

	if(p_Scale.x == p_Scale.y && p_Scale.x == p_Scale.z)
	{
		halfSize = p_Edge.halfsize * p_Scale.x;
		position = p_Edge.offsetPosition * p_Scale.x;
	}
	else
	{
		XMMATRIX rotMat , scalMat;
		rotMat = XMMatrixRotationRollPitchYaw(rotation.y, rotation.x, rotation.z);
		scalMat = XMMatrixScalingFromVector(XMLoadFloat3(&p_Scale));

		float offsetValue = halfSize.x;
		int index = 0;
		float sideValue = halfSize.y;
		if(halfSize.x < halfSize.y)
		{
			offsetValue = halfSize.y;
			sideValue = halfSize.x;
			index = 1;
		}
		if(offsetValue < halfSize.z)
		{
			offsetValue = halfSize.z;
			index = 2;
		}

		XMVECTOR sizeVector = XMVectorZero();
		sizeVector.m128_f32[index] = offsetValue;

		sizeVector = XMVector3Transform(sizeVector, rotMat);

		XMVECTOR pos1, pos2;
		XMVECTOR centerPos = XMLoadFloat3(&position);
		centerPos.m128_f32[3] = 1.0f;
		pos1 = centerPos + sizeVector;
		pos2 = centerPos - sizeVector;

		pos1 = XMVector3Transform(pos1, scalMat);
		pos2 = XMVector3Transform(pos2, scalMat);

		centerPos = (pos1 + pos2) * 0.5f;

		XMStoreFloat3(&position, centerPos);

		XMVECTOR dirVector = pos1 - centerPos;

		float length = XMVector3Length(dirVector).m128_f32[0];

		halfSize.x = length;
		halfSize.y = sideValue;
		halfSize.z = sideValue;

		XMFLOAT3 direction; 
		XMStoreFloat3(&direction,dirVector);
		rotation.x = -atan2f(direction.z, direction.x);
		rotation.y = 0;
		rotation.z = asinf(direction.y / length);
	}

	pushVector(p_Printer, "Halfsize", halfSize);
	pushVector(p_Printer, "OffsetPosition", position);
	pushRotation(p_Printer, "OffsetRotation", rotation);
	p_Printer.CloseElement();
}
コード例 #13
0
ファイル: Restaurant.cpp プロジェクト: Hmaal/OpenSkyscraper
void Restaurant::encodeXML(tinyxml2::XMLPrinter & xml)
{
	Item::encodeXML(xml);
	xml.PushAttribute("variant", variant);
	xml.PushAttribute("open", open);
}
コード例 #14
0
void GoldenSectionOrder::write_XML(tinyxml2::XMLPrinter& file_stream) const
{
    std::ostringstream buffer;

    //file_stream.OpenElement("GoldenSectionOrder");

    // Minimum order

    file_stream.OpenElement("MinimumOrder");

    buffer.str("");
    buffer << minimum_order;

    file_stream.PushText(buffer.str().c_str());

    file_stream.CloseElement();

    // Maximum order

    file_stream.OpenElement("MaximumOrder");

    buffer.str("");
    buffer << maximum_order;

    file_stream.PushText(buffer.str().c_str());

    file_stream.CloseElement();

    // Parameters assays number

    file_stream.OpenElement("TrialsNumber");

    buffer.str("");
    buffer << trials_number;

    file_stream.PushText(buffer.str().c_str());

    file_stream.CloseElement();

    // Performance calculation method

    file_stream.OpenElement("PerformanceCalculationMethod");

    file_stream.PushText(write_loss_calculation_method().c_str());

    file_stream.CloseElement();

    // Reserve parameters data

    file_stream.OpenElement("ReserveParametersData");

    buffer.str("");
    buffer << reserve_parameters_data;

    file_stream.PushText(buffer.str().c_str());

    file_stream.CloseElement();

    // Reserve loss data

    file_stream.OpenElement("ReservePerformanceHistory");

    buffer.str("");
    buffer << reserve_loss_data;

    file_stream.PushText(buffer.str().c_str());

    file_stream.CloseElement();

    // Reserve selection loss data

    file_stream.OpenElement("ReserveSelectionLossHistory");

    buffer.str("");
    buffer << reserve_selection_loss_data;

    file_stream.PushText(buffer.str().c_str());

    file_stream.CloseElement();

    // Reserve minimal parameters

    file_stream.OpenElement("ReserveMinimalParameters");

    buffer.str("");
    buffer << reserve_minimal_parameters;

    file_stream.PushText(buffer.str().c_str());

    file_stream.CloseElement();

    // Display

    file_stream.OpenElement("Display");

    buffer.str("");
    buffer << display;

    file_stream.PushText(buffer.str().c_str());

    file_stream.CloseElement();

    // selection loss goal

    file_stream.OpenElement("SelectionLossGoal");

    buffer.str("");
    buffer << selection_loss_goal;

    file_stream.PushText(buffer.str().c_str());

    file_stream.CloseElement();

    // Maximum iterations

    file_stream.OpenElement("MaximumIterationsNumber");

    buffer.str("");
    buffer << maximum_iterations_number;

    file_stream.PushText(buffer.str().c_str());

    file_stream.CloseElement();

    // Maximum time

    file_stream.OpenElement("MaximumTime");

    buffer.str("");
    buffer << maximum_time;

    file_stream.PushText(buffer.str().c_str());

    file_stream.CloseElement();

    // Tolerance

    file_stream.OpenElement("Tolerance");

    buffer.str("");
    buffer << tolerance;

    file_stream.PushText(buffer.str().c_str());

    file_stream.CloseElement();


    //file_stream.CloseElement();
}
コード例 #15
0
ファイル: Car.cpp プロジェクト: Hmaal/OpenSkyscraper
void Car::encodeXML(tinyxml2::XMLPrinter& xml)
{
	xml.PushAttribute("altitude", altitude);
}
void KappaCoefficientOptimizationThreshold::write_XML(tinyxml2::XMLPrinter& file_stream) const
{
    std::ostringstream buffer;

    //file_stream.OpenElement("KappaCoefficientOptimizationThreshold");

    // Minimum threshold

    file_stream.OpenElement("MinimumThreshold");

    buffer.str("");
    buffer << minimum_threshold;

    file_stream.PushText(buffer.str().c_str());

    file_stream.CloseElement();

    // Maximum threshold

    file_stream.OpenElement("MaximumThreshold");

    buffer.str("");
    buffer << maximum_threshold;

    file_stream.PushText(buffer.str().c_str());

    file_stream.CloseElement();

    // Step

    file_stream.OpenElement("Strep");

    buffer.str("");
    buffer << step;

    file_stream.PushText(buffer.str().c_str());

    file_stream.CloseElement();

    // Reserve function data

    file_stream.OpenElement("ReserveFunctionData");

    buffer.str("");
    buffer << reserve_function_data;

    file_stream.PushText(buffer.str().c_str());

    file_stream.CloseElement();

    //file_stream.CloseElement();
}
コード例 #17
0
void MissingValues::write_XML(tinyxml2::XMLPrinter& file_stream) const
{
    std::ostringstream buffer;

    const size_t missing_values_number = get_missing_values_number();

    file_stream.OpenElement("MissingValues");

    // Instances number

    file_stream.OpenElement("InstancesNumber");

    buffer.str("");
    buffer << instances_number;

    file_stream.PushText(buffer.str().c_str());

    file_stream.CloseElement();

    // Variables number

    file_stream.OpenElement("VariablesNumber");

    buffer.str("");
    buffer << variables_number;

    file_stream.PushText(buffer.str().c_str());

    file_stream.CloseElement();

    // Scrubbing method

    file_stream.OpenElement("ScrubbingMethod");

    file_stream.PushText(write_scrubbing_method().c_str());

    file_stream.CloseElement();

    // Missing values number

    file_stream.OpenElement("MissingValuesNumber");

    buffer.str("");
    buffer << missing_values_number;

    file_stream.PushText(buffer.str().c_str());

    file_stream.CloseElement();


    if(missing_values_number <= 0)
    {
        file_stream.CloseElement();

        return;
    }

    std::string instances_indices_text;
    std::string variables_indices_text;

    for(size_t i = 0; i < missing_values_number; i++)
    {
        // Instance index

        const size_t instance_index = items[i].instance_index + 1;

        instances_indices_text.append(number_to_string(instance_index));

        if(i != missing_values_number - 1)
        {
            instances_indices_text.append(" ");
        }


        // Variable index

        const size_t variable_index = items[i].variable_index + 1;

        variables_indices_text.append(number_to_string(variable_index));

        if(i != missing_values_number - 1)
        {
            variables_indices_text.append(" ");
        }
    }

    // Instances indices

    file_stream.OpenElement("InstancesIndices");

    file_stream.PushText(instances_indices_text.c_str());

    file_stream.CloseElement();

    // Variables indices

    file_stream.OpenElement("VariablesIndices");

    file_stream.PushText(variables_indices_text.c_str());

    file_stream.CloseElement();


    file_stream.CloseElement();
}
コード例 #18
0
void SimulatedAnnealingOrder::write_XML(tinyxml2::XMLPrinter& file_stream) const
{
    std::ostringstream buffer;

    //file_stream.OpenElement("SimulatedAnnealingOrder");

    // Minimum order

    file_stream.OpenElement("MinimumOrder");

    buffer.str("");
    buffer << minimum_order;

    file_stream.PushText(buffer.str().c_str());

    file_stream.CloseElement();

    // Maximum order

    file_stream.OpenElement("MaximumOrder");

    buffer.str("");
    buffer << maximum_order;

    file_stream.PushText(buffer.str().c_str());

    file_stream.CloseElement();

    // Cooling rate

    file_stream.OpenElement("CoolingRate");

    buffer.str("");
    buffer << cooling_rate;

    file_stream.PushText(buffer.str().c_str());

    file_stream.CloseElement();

    // Trials number

    file_stream.OpenElement("TrialsNumber");

    buffer.str("");
    buffer << trials_number;

    file_stream.PushText(buffer.str().c_str());

    file_stream.CloseElement();

    // Tolerance

    file_stream.OpenElement("Tolerance");

    buffer.str("");
    buffer << tolerance;

    file_stream.PushText(buffer.str().c_str());

    file_stream.CloseElement();

    // Selection performance goal

    file_stream.OpenElement("SelectionPerformanceGoal");

    buffer.str("");
    buffer << selection_performance_goal;

    file_stream.PushText(buffer.str().c_str());

    file_stream.CloseElement();

    // Minimum temperature

    file_stream.OpenElement("MinimumTemperature");

    buffer.str("");
    buffer << minimum_temperature;

    file_stream.PushText(buffer.str().c_str());

    file_stream.CloseElement();

    // Maximum iterations

    file_stream.OpenElement("MaximumIterationsNumber");

    buffer.str("");
    buffer << maximum_iterations_number;

    file_stream.PushText(buffer.str().c_str());

    file_stream.CloseElement();

    // Maximum time

    file_stream.OpenElement("MaximumTime");

    buffer.str("");
    buffer << maximum_time;

    file_stream.PushText(buffer.str().c_str());

    file_stream.CloseElement();

    // Reserve performance data

    file_stream.OpenElement("ReservePerformanceHistory");

    buffer.str("");
    buffer << reserve_performance_data;

    file_stream.PushText(buffer.str().c_str());

    file_stream.CloseElement();

    // Reserve selection performance data

    file_stream.OpenElement("ReserveSelectionPerformanceHistory");

    buffer.str("");
    buffer << reserve_selection_performance_data;

    file_stream.PushText(buffer.str().c_str());

    file_stream.CloseElement();


    //file_stream.CloseElement();
}
コード例 #19
0
ファイル: plug_in.cpp プロジェクト: Artelnics/OpenNN
void PlugIn::write_XML(tinyxml2::XMLPrinter& file_stream) const
{
    std::ostringstream buffer;

    file_stream.OpenElement("PlugIn");

    // Independent variables number

    file_stream.OpenElement("IndependentVariablesNumber");

    buffer.str("");
    buffer << independent_variables_number;

    file_stream.PushText(buffer.str().c_str());

    file_stream.CloseElement();

    // Dependent variables number

    file_stream.OpenElement("DependentVariablesNumber");

    buffer.str("");
    buffer << dependent_variables_number;

    file_stream.PushText(buffer.str().c_str());

    file_stream.CloseElement();

    // Input method

    file_stream.OpenElement("InputMethod");

    file_stream.PushText(write_input_method().c_str());

    file_stream.CloseElement();

    // Template file_name

    file_stream.OpenElement("TemplateFileName");

    file_stream.PushText(template_file_name.c_str());

    file_stream.CloseElement();

    // Input file_name

    file_stream.OpenElement("InputFileName");

    file_stream.PushText(input_file_name.c_str());

    file_stream.CloseElement();

    // Batch file_name

    file_stream.OpenElement("BatchFileName");

    file_stream.PushText(script_file_name.c_str());

    file_stream.CloseElement();

    // Output file_name

    file_stream.OpenElement("OutputFileName");

    file_stream.PushText(output_file_name.c_str());

    file_stream.CloseElement();

    // Input flags

    file_stream.OpenElement("InputFlags");

    buffer.str("");
    buffer << input_flags;

    file_stream.PushText(buffer.str().c_str());

    file_stream.CloseElement();

    // Output rows number

    file_stream.OpenElement("OutputRowsNumber");

    buffer.str("");
    buffer << output_rows_number;

    file_stream.PushText(buffer.str().c_str());

    file_stream.CloseElement();

    // Output columns number

    file_stream.OpenElement("OutputColumnsNumber");

    buffer.str("");
    buffer << output_columns_number;

    file_stream.PushText(buffer.str().c_str());

    file_stream.CloseElement();

    // Display

    file_stream.OpenElement("Display");

    buffer.str("");
    buffer << display;

    file_stream.PushText(buffer.str().c_str());

    file_stream.CloseElement();


    file_stream.CloseElement();
}