hexsha
stringlengths
40
40
size
int64
19
11.4M
ext
stringclasses
13 values
lang
stringclasses
1 value
max_stars_repo_path
stringlengths
3
270
max_stars_repo_name
stringlengths
5
110
max_stars_repo_head_hexsha
stringlengths
40
40
max_stars_repo_licenses
listlengths
1
9
max_stars_count
float64
1
191k
max_stars_repo_stars_event_min_datetime
stringlengths
24
24
max_stars_repo_stars_event_max_datetime
stringlengths
24
24
max_issues_repo_path
stringlengths
3
270
max_issues_repo_name
stringlengths
5
116
max_issues_repo_head_hexsha
stringlengths
40
78
max_issues_repo_licenses
listlengths
1
9
max_issues_count
float64
1
67k
max_issues_repo_issues_event_min_datetime
stringlengths
24
24
max_issues_repo_issues_event_max_datetime
stringlengths
24
24
max_forks_repo_path
stringlengths
3
270
max_forks_repo_name
stringlengths
5
116
max_forks_repo_head_hexsha
stringlengths
40
78
max_forks_repo_licenses
listlengths
1
9
max_forks_count
float64
1
105k
max_forks_repo_forks_event_min_datetime
stringlengths
24
24
max_forks_repo_forks_event_max_datetime
stringlengths
24
24
content
stringlengths
19
11.4M
avg_line_length
float64
1.93
229k
max_line_length
int64
12
688k
alphanum_fraction
float64
0.07
0.99
matches
listlengths
1
10
f78ff73179ac8110e5ebd3c3773fba05f90a3f34
1,467
cpp
C++
src/driver/model/find_one_and_delete.cpp
hanumantmk/mongo-cxx-driver
3455d12030d8b10a05bd42a0fcebec13a443ba1b
[ "Apache-2.0" ]
null
null
null
src/driver/model/find_one_and_delete.cpp
hanumantmk/mongo-cxx-driver
3455d12030d8b10a05bd42a0fcebec13a443ba1b
[ "Apache-2.0" ]
null
null
null
src/driver/model/find_one_and_delete.cpp
hanumantmk/mongo-cxx-driver
3455d12030d8b10a05bd42a0fcebec13a443ba1b
[ "Apache-2.0" ]
null
null
null
// Copyright 2014 MongoDB Inc. // // 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. #include "driver/model/find_one_and_delete.hpp" namespace mongo { namespace driver { namespace model { find_one_and_delete::find_one_and_delete(bson::document::view criteria) : _criteria(std::move(criteria)) {} find_one_and_delete& find_one_and_delete::projection(bson::document::view projection) { _projection = projection; return *this; } find_one_and_delete& find_one_and_delete::sort(bson::document::view ordering) { _ordering = ordering; return *this; } const bson::document::view& find_one_and_delete::criteria() const { return _criteria; } const optional<bson::document::view>& find_one_and_delete::projection() const { return _projection; } const optional<bson::document::view>& find_one_and_delete::sort() const { return _ordering; } } // namespace model } // namespace driver } // namespace mongo #include "driver/config/postlude.hpp"
31.212766
93
0.749148
[ "model" ]
f79cc2ac7aa72b6c829dcb91e5d24bf6f8c07d22
3,565
hh
C++
src/HostManager.hh
VadimNvr/SDN_RunOS
74df09f78f8672f144a283823b24de3106f8e419
[ "Apache-2.0" ]
null
null
null
src/HostManager.hh
VadimNvr/SDN_RunOS
74df09f78f8672f144a283823b24de3106f8e419
[ "Apache-2.0" ]
null
null
null
src/HostManager.hh
VadimNvr/SDN_RunOS
74df09f78f8672f144a283823b24de3106f8e419
[ "Apache-2.0" ]
null
null
null
/* * Copyright 2015 Applied Research Center for Computer Networks * * 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. */ #pragma once #include <mutex> #include <string> #include <vector> #include <unordered_map> #include <time.h> #include "Common.hh" #include "Loader.hh" #include "Application.hh" #include "OFMessageHandler.hh" #include "Switch.hh" #include "Rest.hh" #include "AppObject.hh" #include "json11.hpp" /** * Host object corresponding end host * Inherits AppObject for using event model */ class Host : public AppObject { struct HostImpl* m; public: uint64_t id() const override; json11::Json to_json() const override; json11::Json formFloodlightJSON(); std::string mac() const; std::string ip() const; uint64_t switchID() const; uint32_t switchPort()const; void switchID(uint64_t id); void switchPort(uint32_t port); void ip(std::string ip); Host(std::string mac, IPAddress ip); ~Host(); }; /** * HostManager is looking for new hosts in the network. * This application connects switch-manager's signal &SwitchManager::switchDiscovered * and remember all switches and their mac addresses. * * Also application handles all packet_ins and if eth_src field is not belongs to switch * it means that new end host appears in the network. */ class HostManager: public Application, OFMessageHandlerFactory, RestHandler { Q_OBJECT SIMPLE_APPLICATION(HostManager, "host-manager") public: HostManager(); ~HostManager(); void init(Loader* loader, const Config& config) override; std::string orderingName() const override { return "host-finder"; } std::unique_ptr<OFMessageHandler> makeOFMessageHandler() override { return std::unique_ptr<OFMessageHandler>(new Handler(this)); } bool isPrereq(const std::string &name) const; std::unordered_map<std::string, Host*> hosts(); Host* getHost(std::string mac); Host* getHost(IPAddress ip); std::string restName() override {return "host-manager";} bool eventable() override {return true;} AppType type() override { return AppType::Service; } json11::Json handleGET(std::vector<std::string> params, std::string body) override; public slots: void onSwitchDiscovered(Switch* dp); void onSwitchDown(Switch* dp); void newPort(Switch* dp, of13::Port port); signals: void hostDiscovered(Host* dev); private: struct HostManagerImpl* m; std::vector<std::string> switch_macs; SwitchManager* m_switch_manager; std::mutex mutex; void addHost(Switch* sw, IPAddress ip, std::string mac, uint32_t port); Host* createHost(std::string mac, IPAddress ip); bool findMac(std::string mac); bool isSwitch(std::string mac); void attachHost(std::string mac, uint64_t id, uint32_t port); void delHostForSwitch(Switch* dp); class Handler: public OFMessageHandler { public: Handler(HostManager* app_) : app(app_) { } Action processMiss(OFConnection* ofconn, Flow* flow) override; private: HostManager* app; }; };
31.830357
88
0.71136
[ "object", "vector", "model" ]
f79d19d69863ad7026ef9608cb51020bd50ac4d0
5,025
cpp
C++
third_party/libSBML-5.11.0-Source/src/sbml/packages/render/sbml/Transformation.cpp
gitter-badger/sbmlsolver
c92936832297ea1d2ad7f17223b68ada43c8f0b2
[ "Apache-2.0" ]
null
null
null
third_party/libSBML-5.11.0-Source/src/sbml/packages/render/sbml/Transformation.cpp
gitter-badger/sbmlsolver
c92936832297ea1d2ad7f17223b68ada43c8f0b2
[ "Apache-2.0" ]
null
null
null
third_party/libSBML-5.11.0-Source/src/sbml/packages/render/sbml/Transformation.cpp
gitter-badger/sbmlsolver
c92936832297ea1d2ad7f17223b68ada43c8f0b2
[ "Apache-2.0" ]
null
null
null
/** * @file Transformation.cpp * @brief class representing a 3D affine transformation * @author Ralph Gauges * */ /* Copyright 2010 Ralph Gauges * * This library is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation. A copy of the license agreement is * provided in the file named "LICENSE.txt" included with this software * distribution. It is also available online at * http://sbml.org/software/libsbml/license.html * * You should have received a copy of the GNU Lesser General Public License * along with this library; if not, write to the Free Software Foundation, * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * * The original code contained here was initially developed by: * * Ralph Gauges * Group for the modeling of biological processes * University of Heidelberg * Im Neuenheimer Feld 267 * 69120 Heidelberg * Germany * * mailto:ralph.gauges@bioquant.uni-heidelberg.de * * Contributor(s): */ #include "Transformation.h" #include <limits> #ifndef OMIT_DEPRECATED #ifdef DEPRECATION_WARNINGS #include <iostream> #endif // DEPRECATION_WARNINGS #endif // OMIT_DEPRECATED LIBSBML_CPP_NAMESPACE_BEGIN const double Transformation::IDENTITY3D[12]={1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0}; /** @cond doxygenLibsbmlInternal */ /* * Creates a new Transformation object with the given SBML level * and SBML version. * * @param level SBML level of the new object * @param level SBML version of the new object */ Transformation::Transformation (unsigned int level, unsigned int version, unsigned int pkgVersion) : SBase(level,version) { setSBMLNamespacesAndOwn(new RenderPkgNamespaces(level,version,pkgVersion)); unsigned int i; for(i=0;i<12;++i) { mMatrix[i]=std::numeric_limits<double>::quiet_NaN(); } } /** @endcond */ /** @cond doxygenLibsbmlInternal */ /* * Creates a new Transformation object with the given SBMLNamespaces. * * @param sbmlns The SBML namespace for the object. */ Transformation::Transformation (RenderPkgNamespaces* renderns): SBase(renderns) { unsigned int i; for(i=0;i<12;++i) { mMatrix[i]=std::numeric_limits<double>::quiet_NaN(); } // set the element namespace of this object setElementNamespace(renderns->getURI()); // connect child elements to this element. connectToChild(); // load package extensions bound with this object (if any) loadPlugins(renderns); } /** @endcond */ /* * Copy constructor. */ Transformation::Transformation(const Transformation& other) : SBase(other) { setMatrix(other.getMatrix()); } /* * Destroy this object. */ Transformation::~Transformation () { } /** @cond doxygenLibsbmlInternal */ /* * Creates a new Transformation object from the given XMLNode object. * The XMLNode object has to contain a valid XML representation of a * Transformation object as defined in the render extension specification. * This method is normally called when render information is read from a file and * should normally not have to be called explicitely. * * @param node the XMLNode object reference that describes the Transformation * object to be instantiated. */ Transformation::Transformation(const XMLNode& node, unsigned int l2version) : SBase(2, l2version) { mURI = RenderExtension::getXmlnsL3V1V1(); unsigned int i; for(i=0;i<12;++i) { mMatrix[i]=std::numeric_limits<double>::quiet_NaN(); } setSBMLNamespacesAndOwn(new RenderPkgNamespaces(2,l2version)); connectToChild(); } /** @endcond */ /** @cond doxygenLibsbmlInternal */ /* * Sets the matrix to the values given in the array. * * @param m array with new values to be set for this Transformation object. */ void Transformation::setMatrix(const double m[12]) { unsigned int i; for(i=0;i<12;++i) { mMatrix[i]=m[i]; } } /** @endcond */ /** @cond doxygenLibsbmlInternal */ /* * Returns the matrix which is an array of double values of length 12. * * @return a pointer to the array of numbers for the transformation. */ const double* Transformation::getMatrix() const { return mMatrix; } /** @endcond */ /** @cond doxygenLibsbmlInternal */ /* * Returns a 3D identity matrix. * The matrix contains 12 double values. */ const double* Transformation::getIdentityMatrix() { return IDENTITY3D; } /** @endcond */ /** @cond doxygenLibsbmlInternal */ /* * Returns true if the matrix has been set or false otherwise. * The matrix is considered as set if none of the values in the matrix is NaN. * * @return true or false depending on whether a NaN was found. */ bool Transformation::isSetMatrix() const { if (this == NULL) return false; bool result=true; unsigned int i; for(i=0;result && i<12;++i) { result=(mMatrix[i]==mMatrix[i]); } return result; } /** @endcond */ LIBSBML_CPP_NAMESPACE_END
24.876238
101
0.699303
[ "render", "object", "3d" ]
f7a18d5caf0ac1a3ee34f0e8b02be9d2c74f7a14
465
hpp
C++
src/parser_nodes/continue_parser_node_pre.hpp
lowlander/nederrock
aa23f79de3adf0510419208938bf4dcdbe786c9f
[ "MIT" ]
null
null
null
src/parser_nodes/continue_parser_node_pre.hpp
lowlander/nederrock
aa23f79de3adf0510419208938bf4dcdbe786c9f
[ "MIT" ]
null
null
null
src/parser_nodes/continue_parser_node_pre.hpp
lowlander/nederrock
aa23f79de3adf0510419208938bf4dcdbe786c9f
[ "MIT" ]
null
null
null
// // Copyright (c) 2020 Erwin Rol <erwin@erwinrol.com> // // SPDX-License-Identifier: MIT // #ifndef NEDERROCK_SRC_CONTINUE_PARSER_NODE_PRE_HPP #define NEDERROCK_SRC_CONTINUE_PARSER_NODE_PRE_HPP #include <memory> #include <vector> class Continue_Parser_Node; using Continue_Parser_Node_Ptr = std::shared_ptr<Continue_Parser_Node>; using Continue_Parser_Node_Vector = std::vector<Continue_Parser_Node_Ptr>; #endif // NEDERROCK_SRC_CONTINUE_PARSER_NODE_PRE_HPP
24.473684
74
0.823656
[ "vector" ]
f7ac9e721a36ea4fb2f876c10dcd0ee0469afad2
21,882
cpp
C++
src/World.cpp
NguyenTam/air-combat
715a13c1f7d7b81096b7f6469bca7b80c53e7a03
[ "MIT" ]
1
2018-12-26T15:40:54.000Z
2018-12-26T15:40:54.000Z
src/World.cpp
NguyenTam/air-combat
715a13c1f7d7b81096b7f6469bca7b80c53e7a03
[ "MIT" ]
null
null
null
src/World.cpp
NguyenTam/air-combat
715a13c1f7d7b81096b7f6469bca7b80c53e7a03
[ "MIT" ]
null
null
null
/** * @file World.cpp * @brief Source file for class Ẃorld */ #include "World.hpp" /* Class World */ /* Constructor */ World::World(sf::RenderWindow &main_window, ResourceManager &_resources) : resources(_resources), window(main_window) {} /* Parse level .txt file and create world's entities */ bool World::read_level(std::string& filename, Game::GameMode game_mode) { //entity type; x; y; orientation; width; height // init score score = 0; double x, y, width, height; int orientation; std::string type; std::ifstream file(filename); if (file.is_open()) { clear_all(); bool comments_read = false; std::string line; while(getline(file,line)) { if (! comments_read) { if (line.find("*/") != std::string::npos) { comments_read = true; } } else { std::istringstream temp_stream(line); std::string split_str; int i = 0; while(getline(temp_stream, split_str, ';')) { try { switch (i) { case 0: type = split_str; break; case 1: x = std::stod(split_str); break; case 2: y = std::stod(split_str); break; case 3: orientation = std::stoi(split_str); break; case 4: width = std::stod(split_str); break; case 5: height = std::stod(split_str); break; } i++; } catch (std::exception &e) { std::cout << e.what() << std::endl; //clear all return false; } } if (i != 6) { //failed clear_all(); return false; } //all ok if (type == "InvisibleWall") { b2Body* body = pworld.create_body_static(x+(width/2), y+(height/2), width, height, Game::TYPE_ID::invisible_wall); std::shared_ptr<Entity> entity = std::make_shared<InvisibleWall>(*pworld.get_world(), body, resources.get(Textures::alphaTextures.at("InvisibleWall")), sf::Vector2f(x,y)); entity->setType(Textures::InvisibleWall_alpha); body->SetUserData(entity.get()); objects.push_back(entity); } try { Textures::ID id = Textures::alphaTextures.at(type); if (x+width < Game::WIDTH) { x += width/2; y += height/2; create_entity(id, x, y, orientation, width, height, sf::Vector2f(1.0f, 0.0f), game_mode); } } catch (const std::out_of_range& er) { } } } } return true; } /* Clears the world */ void World::clear_all() { objects.clear(); player_planes.clear(); for (b2Body* b = pworld.get_world()->GetBodyList(); b != nullptr; b = b->GetNext()) { pworld.get_world()->DestroyBody(b); } } /* Create entity */ bool World::create_entity(Textures::ID id, double x, double y, int orientation, double width, double height, sf::Vector2f direct, Game::GameMode game_mode) { sf::Texture &tex = resources.get(id); sf::Vector2f pos(x,y); b2Body* body; std::shared_ptr<Entity> entity; switch(id) { case Textures::BlueAirplane_alpha: { body = pworld.create_body_dynamic(x, y, width, height,1); entity = std::make_shared<Plane>(*pworld.get_world(), body, tex, pos, direct, Game::TEAM_ID::blue); entity->setType(Textures::BlueAirplane_alpha); body->SetUserData(entity.get()); body->SetGravityScale(0); //gravity 0 for plane // add BlueAirplane to player_planes[0] (controlled by player not by AI) if (orientation == 0) { entity->setDirection({-1.f,0}); entity->faceLeft(); } player_planes.push_front((std::move(entity))); break; } case Textures::BlueAntiAircraft_alpha: { body = pworld.create_body_dynamic(x, y, width, height, 1); entity = std::make_shared<Artillery>(*pworld.get_world(), body, tex, pos, Game::TEAM_ID::blue); entity->setType(Textures::BlueAntiAircraft_alpha); body->SetUserData(entity.get()); break; } case Textures::BlueBase_alpha: { body = pworld.create_body_static(x, y, width, height, Game::TYPE_ID::base); entity = std::make_shared<Base>(*pworld.get_world(), body, tex, pos, Game::TEAM_ID::blue); entity->setType(Textures::BlueBase_alpha); body->SetUserData(entity.get()); break; } case Textures::BlueHangar_alpha: { body = pworld.create_body_static(x, y, width, height, Game::TYPE_ID::hangar); entity = std::make_shared<Hangar>(*pworld.get_world(), body, tex, pos, Game::TEAM_ID::blue); entity->setType(Textures::BlueHangar_alpha); body->SetUserData(entity.get()); break; } case Textures::BlueInfantry_alpha: { body = pworld.create_body_dynamic(x, y, width, height, 1000); entity = std::make_shared<Infantry>(*pworld.get_world(), body, tex, pos, Game::TEAM_ID::blue); entity->setType(Textures::BlueInfantry_alpha); body->SetUserData(entity.get()); break; } case Textures::Ground_alpha: { body = pworld.create_body_static(x, y, width, height, Game::TYPE_ID::ground); entity = std::make_shared<Ground>(*pworld.get_world(), body, tex, pos); entity->setType(Textures::Ground_alpha); entity->setScale(width,height); body->SetUserData(entity.get()); break; } case Textures::RedAirplane_alpha: { if (game_mode == Game::GameMode::SinglePlayer) { // add RedAirplanes to the normal container (controlled by AI) body = pworld.create_body_dynamic(x, y, width, height, 1); entity = std::make_shared<Plane>(*pworld.get_world(), body, tex, pos, direct, Game::TEAM_ID::red); entity->setType(Textures::RedAirplane_alpha); body->SetUserData(entity.get()); body->SetGravityScale(0); //gravity 0 for plane if (orientation == 0) { entity->setDirection({-1.f,0}); entity->faceLeft(); } objects.push_back(std::move(entity)); } else { // Add RedAirplane to player_planes container if (player_planes.size() == 1) { if (player_planes[0]->getType() == Textures::ID::BlueAirplane_alpha) { // only one RedAirplane is alowed and it needs to be at player_planes[1] body = pworld.create_body_dynamic(x, y, width, height, 1); entity = std::make_shared<Plane>(*pworld.get_world(), body, tex, pos, direct, Game::TEAM_ID::red); entity->setType(Textures::RedAirplane_alpha); body->SetUserData(entity.get()); body->SetGravityScale(0); //gravity 0 for plane if (orientation == 0) { entity->setDirection({-1.f,0}); entity->faceLeft(); } player_planes.push_back(std::move(entity)); } } else if (player_planes.empty()) { body = pworld.create_body_dynamic(x, y, width, height,1 ); entity = std::make_shared<Plane>(*pworld.get_world(), body, tex, pos, direct, Game::TEAM_ID::red); entity->setType(Textures::RedAirplane_alpha); body->SetUserData(entity.get()); body->SetGravityScale(0); //gravity 0 for plane if (orientation == 0) { entity->setDirection({-1.f,0}); entity->faceLeft(); } player_planes.push_back(std::move(entity)); } } break; } case Textures::RedAntiAircraft_alpha: { body = pworld.create_body_dynamic(x, y, width, height,1); entity = std::make_shared<Artillery>(*pworld.get_world(), body, tex, pos, Game::TEAM_ID::red); entity->setType(Textures::RedAntiAircraft_alpha); body->SetUserData(entity.get()); break; } case Textures::RedBase_alpha: { body = pworld.create_body_static(x, y, width, height, Game::TYPE_ID::base); entity = std::make_shared<Base>(*pworld.get_world(), body, tex, pos, Game::TEAM_ID::red); entity->setType(Textures::RedBase_alpha); body->SetUserData(entity.get()); break; } case Textures::RedHangar_alpha: { body = pworld.create_body_static(x, y, width, height, Game::TYPE_ID::hangar); entity = std::make_shared<Hangar>(*pworld.get_world(), body, tex, pos, Game::TEAM_ID::red); entity->setType(Textures::RedHangar_alpha); body->SetUserData(entity.get()); break; } case Textures::RedInfantry_alpha: { body = pworld.create_body_dynamic(x, y, width, height, 1000); entity = std::make_shared<Infantry>(*pworld.get_world(), body, tex, pos, Game::TEAM_ID::red); entity->setType(Textures::RedInfantry_alpha); body->SetUserData(entity.get()); break; } case Textures::Rock_alpha: { body = pworld.create_body_static(x, y, width, height, Game::TYPE_ID::rock); entity = std::make_shared<Stone>(*pworld.get_world(), body, tex, pos); entity->setType(Textures::Rock_alpha); body->SetUserData(entity.get()); break; } case Textures::Tree_alpha: { body = pworld.create_body_static(x, y, width, height, Game::TYPE_ID::tree); entity = std::make_shared<Tree>(*pworld.get_world(), body, tex, pos); entity->setType(Textures::Tree_alpha); body->SetUserData(entity.get()); break; } case Textures::InvisibleWall_alpha: { // created before. SKIP break; } default: std::cout << "id not found" << std::endl; break; } if (id != Textures::RedAirplane_alpha && id != Textures::BlueAirplane_alpha && orientation == 0) { entity->setDirection({-1.f,0}); entity->faceLeft(); } if (entity && (id != Textures::BlueAirplane_alpha) && (id != Textures::RedAirplane_alpha)) { objects.push_back(std::move(entity)); return true; } //entity was already added return false; } /* Remove entity */ bool World::remove_bullet(Entity *bullet, Entity *entity) { for (auto & object : objects) { std::list<std::shared_ptr<Entity>>& bullets_list = object->get_active_bullets(); for (auto item = bullets_list.begin(); item != bullets_list.end(); item++) { if ((item->get() == bullet) && (bullet->getOwner() != entity)) { // raw pointers match, erase bullet b2Body* body = (*item)->getB2Body(); body->SetUserData(nullptr); bullets_list.erase(item); // remove body also pworld.remove_body(body); return true; } } } for (auto & player_plane : player_planes) { // Check also player_planes bullets std::list<std::shared_ptr<Entity>>& bullets_list = player_plane->get_active_bullets(); for (auto item = bullets_list.begin(); item != bullets_list.end(); item++) { if ((item->get() == bullet) && (bullet->getOwner() != entity)) { // raw pointers match, erase bullet b2Body* body = (*item)->getB2Body(); body->SetUserData(nullptr); bullets_list.erase(item); // remove body also pworld.remove_body(body); return true; } } } return false; } bool World::remove_entity(Entity *entity) { for (auto it = objects.begin(); it != objects.end(); it++) { if (it->get() == entity) { // raw pointers match, erase entity from the vector std::list<std::shared_ptr<Entity>>& bullets_list = (*it)->get_active_bullets(); for (auto item = bullets_list.begin(); item != bullets_list.end(); ) { // remove all entity's bullets b2Body* body = (*item)->getB2Body(); body->SetUserData(nullptr); item = bullets_list.erase(item); // remove body also pworld.remove_body(body); } b2Body* body = (*it)->getB2Body(); body->SetUserData(nullptr); objects.erase(it); pworld.remove_body(body); return true; } } // go through also player_planes for (auto it = player_planes.begin(); it != player_planes.end(); it++) { if (it->get() == entity) { // get player's bullets std::list<std::shared_ptr<Entity>>& bullets_list = (*it)->get_active_bullets(); for (auto item = bullets_list.begin(); item != bullets_list.end(); ) { // remove all entity's bullets b2Body* body = (*item)->getB2Body(); body->SetUserData(nullptr); item = bullets_list.erase(item); // remove body also pworld.remove_body(body); } b2Body* body = (*it)->getB2Body(); body->SetUserData(nullptr); player_planes.erase(it); pworld.remove_body(body); return true; } } //entity was not found return false; } /* Update the world */ GameResult World::update(Game::GameMode game_mode) { //physicsworld step float32 timeStep = 1/60.0; //the length of time passed to simulate (seconds) int32 velocityIterations = 8; //how strongly to correct velocity int32 positionIterations = 3; //how strongly to correct position pworld.get_world()->Step(timeStep, velocityIterations, positionIterations); for (auto &it : objects) { it->erase_surroundings(); } for (auto &it : player_planes) { it->erase_surroundings(); } //collision detection for (b2Contact* contact = pworld.get_world()->GetContactList(); contact != nullptr; contact = contact->GetNext()) { if (contact->IsTouching()){ b2Fixture* a_fixture = contact->GetFixtureA(); b2Fixture* b_fixture = contact->GetFixtureB(); b2Body* a_body = a_fixture->GetBody(); b2Body* b_body = b_fixture->GetBody(); Entity* a_entity = findEntity(a_body); Entity* b_entity = findEntity(b_body); if (a_entity != nullptr && b_entity != nullptr) { bool a_sensor = a_fixture->IsSensor(); bool b_sensor = b_fixture->IsSensor(); //only one was a sensor if (a_sensor ^ b_sensor) { if (a_sensor) { a_entity->insert_surrounding(b_entity); } else if (b_sensor) { b_entity->insert_surrounding(a_entity); } } else if ((!a_sensor) && (!b_sensor)) { if (a_entity->getType() == Textures::Bullet_alpha) { if (b_entity->getType() == Textures::Bullet_alpha) { // remove both bullets destroyed_bullet_bodies.push_back(b_body); // remove a_entity which is a bullet destroyed_bullet_bodies.push_back(a_body); } else if (a_entity->getOwner() != b_entity){ if (b_entity->damage(10)) { Entity* owner = a_entity->getOwner(); if ( owner->getTypeId() == Game::TYPE_ID::airplane) { auto* owner_plane = dynamic_cast<Plane*>(owner); owner_plane->addToKillList(b_entity); } destroyed_entity_bodies.push_back(b_body); } // remove a_entity which is a bullet destroyed_bullet_bodies.push_back(a_body); } } else if (b_entity->getType() == Textures::Bullet_alpha) { if (b_entity->getOwner() != a_entity) { if (a_entity->damage(10)) { // A is killed by the owner of bullet B Entity* owner = b_entity->getOwner(); if ( owner->getTypeId() == Game::TYPE_ID::airplane) { auto* owner_plane = dynamic_cast<Plane*>(owner); owner_plane->addToKillList(a_entity); } destroyed_entity_bodies.push_back(a_body); } // remove b_entity which is a bullet destroyed_bullet_bodies.push_back(b_body); } } else if (a_entity->getTypeId() == Game::TYPE_ID::airplane) { if (b_entity->getTypeId() == Game::TYPE_ID::ground) { // airplane destroyed destroyed_entity_bodies.push_back(a_body); } else if (b_entity->getTypeId() == Game::TYPE_ID::airplane) { // damage both planes if (a_entity->damage(10)){ destroyed_entity_bodies.push_back(a_body); } if (b_entity->damage(10)){ destroyed_entity_bodies.push_back(b_body); } } else if (b_entity->getTypeId() == Game::TYPE_ID::infantry) { // destroy infantry and damage plane destroyed_entity_bodies.push_back(b_body); if (a_entity->damage(10)) { destroyed_entity_bodies.push_back(a_body); } } } else if (b_entity->getTypeId() == Game::TYPE_ID::airplane) { if (a_entity->getTypeId() == Game::TYPE_ID::ground) { // airplane destroyed destroyed_entity_bodies.push_back(b_body); } else if (a_entity->getTypeId() == Game::TYPE_ID::airplane) { // damage both planes if (b_entity->damage(10)) { destroyed_entity_bodies.push_back(b_body); } if (a_entity->damage(10)) { destroyed_entity_bodies.push_back(a_body); } } else if (a_entity->getTypeId() == Game::TYPE_ID::infantry) { // destroy infantry and damage plane destroyed_entity_bodies.push_back(a_body); if (b_entity->damage(10)) { destroyed_entity_bodies.push_back(b_body); } } } } } } } // remove destroyed_bodies from the world // bullets must be removed first because they are stored within other entities // sort the list and remove dublicates so that no entity / bullet is removed twice destroyed_bullet_bodies.sort(); destroyed_bullet_bodies.unique(); for (auto it : destroyed_bullet_bodies) { auto* bullet = static_cast<Entity*>(it->GetUserData()); remove_bullet(bullet, bullet); } // clear all old pointers which have been removed destroyed_bullet_bodies.clear(); destroyed_entity_bodies.sort(); destroyed_entity_bodies.unique(); for (auto it : destroyed_entity_bodies) { auto* entity = static_cast<Entity*>(it->GetUserData()); remove_entity(entity); } destroyed_entity_bodies.clear(); //updating the world for (const auto& it : objects) { //1. send ai information AI::get_action(*it, it->get_surroundings(), resources); //do something with ai information //2. update new positions //new position for sprite float x = Game::TOPIXELS*it->getB2Body()->GetPosition().x; float y = Game::TOPIXELS*it->getB2Body()->GetPosition().y; sf::Vector2f newpos(x,y); it->setPos(newpos); std::list<std::shared_ptr<Entity>> bullets = it->get_active_bullets(); for (const auto& b : bullets) { float x = Game::TOPIXELS*b->getB2Body()->GetPosition().x; float y = Game::TOPIXELS*b->getB2Body()->GetPosition().y; sf::Vector2f newpos(x,y); b->setPos(newpos); b->drawTo(window); } //set sfml sprite's angle from body's angle //it->setRot(it->getB2Body().GetAngle()*RADTODEG); it->drawTo(window); } // Draw player planes for (const auto& it : player_planes) { float x = Game::TOPIXELS*it->getB2Body()->GetPosition().x; float y = Game::TOPIXELS*it->getB2Body()->GetPosition().y; sf::Vector2f newpos(x,y); it->setPos(newpos); std::list<std::shared_ptr<Entity>> bullets = it->get_active_bullets(); for (const auto& b : bullets) { float x = Game::TOPIXELS*b->getB2Body()->GetPosition().x; float y = Game::TOPIXELS*b->getB2Body()->GetPosition().y; sf::Vector2f newpos(x,y); b->setPos(newpos); b->drawTo(window); } //set sfml sprite's angle from body's angle it->setRot(it->getB2Body()->GetAngle()*RADTODEG); it->drawTo(window); } // update the score updateScore(game_mode); return checkGameStatus(game_mode); } std::vector<std::shared_ptr<Entity>>& World::get_all_entities() { return objects; } std::deque<std::shared_ptr<Entity>>& World::get_player_planes() { return player_planes; } GameResult World::checkGameStatus(Game::GameMode game_mode) { if (game_mode == Game::GameMode::SinglePlayer) { // Red team won if blue plane destroyed if (player_planes.empty()) { return GameResult::RedWon; } // Blue team won if all red planes and bases destroyed for (const auto& it : objects){ if ((it->getType() == Textures::RedBase_alpha )|| (it->getType() == Textures::RedAirplane_alpha)) { // not all red planes and bases destroyed, game UnFinished return GameResult::UnFinished; } } // All red planes and bases destroyed return GameResult::BlueWon; } else { // Multiplayer is over when red or blue plane is destroyed if (player_planes.size() < 2) { if (player_planes.size() == 1) { if (player_planes[0]->getType() == Textures::RedAirplane_alpha) { return GameResult::RedWon; } {return GameResult::BlueWon; } } else { return GameResult::TieGame; } } // both planes still active return GameResult::UnFinished; } } int World::getScore() { return score; } Entity* World::findEntity(b2Body *body) { for (auto & object : objects) { if (object->getB2Body() == body) { return object.get(); } std::list<std::shared_ptr<Entity>>& entitys_bullets = object->get_active_bullets(); for (auto & entitys_bullet : entitys_bullets) { if (entitys_bullet->getB2Body() == body) { return entitys_bullet.get(); } } } // Go through player_planes for (auto & player_plane : player_planes) { if (player_plane->getB2Body() == body) { return player_plane.get(); } std::list<std::shared_ptr<Entity>>& entitys_bullets = player_plane->get_active_bullets(); for (auto & entitys_bullet : entitys_bullets) { if (entitys_bullet->getB2Body() == body) { return entitys_bullet.get(); } } } return nullptr; } void World::updateScore(Game::GameMode game_mode) { // init score score = 0; if (game_mode == Game::GameMode::SinglePlayer) { if (!player_planes.empty()) { auto* plane = dynamic_cast<Plane*> (player_planes[0].get()); score = plane->getGrandTotalKill() * 1000; } else { // player dead -> score 0 score = 0; } } }
30.90678
177
0.613472
[ "object", "vector" ]
fc8de01d35d05b6e4476dde0ebd4d375196f46b1
1,295
cpp
C++
src/storage/table/persistent_segment.cpp
peterboncz/duckdb
20031c8137895560a67bbf11b11628f067f057ef
[ "MIT" ]
1
2021-11-01T12:24:40.000Z
2021-11-01T12:24:40.000Z
src/storage/table/persistent_segment.cpp
peterboncz/duckdb
20031c8137895560a67bbf11b11628f067f057ef
[ "MIT" ]
null
null
null
src/storage/table/persistent_segment.cpp
peterboncz/duckdb
20031c8137895560a67bbf11b11628f067f057ef
[ "MIT" ]
null
null
null
#include "duckdb/storage/table/persistent_segment.hpp" #include "duckdb/common/exception.hpp" #include "duckdb/common/types/vector.hpp" #include "duckdb/common/vector_operations/vector_operations.hpp" #include "duckdb/common/types/null_value.hpp" #include "duckdb/storage/checkpoint/table_data_writer.hpp" #include "duckdb/storage/meta_block_reader.hpp" #include "duckdb/storage/storage_manager.hpp" #include "duckdb/storage/numeric_segment.hpp" #include "duckdb/storage/string_segment.hpp" #include "duckdb/storage/table/validity_segment.hpp" namespace duckdb { PersistentSegment::PersistentSegment(DatabaseInstance &db, block_id_t id, idx_t offset, const LogicalType &type_p, idx_t start, idx_t count, unique_ptr<BaseStatistics> statistics) : ColumnSegment(db, type_p, ColumnSegmentType::PERSISTENT, start, count, move(statistics)), block_id(id), offset(offset) { D_ASSERT(offset == 0); if (type.InternalType() == PhysicalType::VARCHAR) { data = make_unique<StringSegment>(db, start, id); } else if (type.InternalType() == PhysicalType::BIT) { data = make_unique<ValiditySegment>(db, start, id); } else { data = make_unique<NumericSegment>(db, type.InternalType(), start, id); } data->tuple_count = count; } } // namespace duckdb
40.46875
114
0.74749
[ "vector" ]
fc8ed370e6b0b00a46f8f06eff02d95cbc879614
10,514
cpp
C++
src/window.cpp
Salgac/PPGSO-project
4ad118746fdf22cbf9f91903e42d0429b3c8c87a
[ "MIT" ]
null
null
null
src/window.cpp
Salgac/PPGSO-project
4ad118746fdf22cbf9f91903e42d0429b3c8c87a
[ "MIT" ]
null
null
null
src/window.cpp
Salgac/PPGSO-project
4ad118746fdf22cbf9f91903e42d0429b3c8c87a
[ "MIT" ]
null
null
null
#include <iostream> #include <vector> #include <list> #include <shaders/light_vert_glsl.h> #include <shaders/light_frag_glsl.h> #define GLM_ENABLE_EXPERIMENTAL #include <glm/glm.hpp> #include <glm/gtx/matrix_transform_2d.hpp> #include <glm/gtx/euler_angles.hpp> #include <ppgso/ppgso.h> #include "shapes/cube.cpp" #include "shapes/sphere.cpp" #include "objects/player.cpp" #include "objects/background.cpp" #include "objects/moon.cpp" #include "objects/lake.cpp" #include "objects/ground.cpp" #include "objects/tree.cpp" #include "objects/falling_tree.cpp" #include "objects/flower.cpp" #include "objects/wolf.cpp" #include "objects/deer.cpp" #include "objects/fireflies.cpp" #include "objects/crow.cpp" #include "objects/corn.cpp" #include "camera.h" #include "scene.cpp" #include <shaders/convolution_vert_glsl.h> #include <shaders/convolution_frag_glsl.h> #include <shaders/texture_vert_glsl.h> #include <shaders/texture_frag_glsl.h> class ProjectWindow : public ppgso::Window { private: Scene scene; int current_scene = 0; // Objects to render the framebuffer on to // ppgso::Shader quadShader = {convolution_vert_glsl, convolution_frag_glsl}; ppgso::Shader quadShader = {texture_vert_glsl, texture_frag_glsl}; ppgso::Mesh quadMesh = {"quad.obj"}; ppgso::Texture quadTexture = {1024, 1024}; // OpenGL object ids for framebuffer and render buffer GLuint fbo = 1; GLuint rbo = 1; void initBase() { // camera auto camera = std::make_unique<Camera>(100.0f, (float)width / (float)height, 0.1f, 100.0f); scene.camera = move(camera); // shader and light auto shader = std::make_unique<ppgso::Shader>(light_vert_glsl, light_frag_glsl); scene.shader = move(shader); } void initCommon() { scene.light_positions.clear(); // moonlight scene.light_positions.push_back(glm::vec3(5, 7, -13)); scene.shader->setUniform("lights[0].color", glm::vec3(1, 0.5, 0.5)); // ambient scene.light_positions.push_back(glm::vec3(0, 2, 2)); scene.shader->setUniform("lights[1].color", glm::vec3(0.3, 0.3, 0.3)); // third light scene.light_positions.push_back(glm::vec3(2, 1, -2)); // player scene.objects.push_back(move(std::make_unique<Player>(glm::vec3{0, 1, 0}))); // backgrounds scene.objects.push_back(move(std::make_unique<Background>())); scene.objects.push_back(move(std::make_unique<Moon>())); scene.objects.push_back(move(std::make_unique<Ground>())); } void scene1_init() // scene 1 { initBase(); initCommon(); // trees for (int i = 0; i < 25; i++) { float a = glm::linearRand(-5.0f, -12.0f); glm::vec3 pos = glm::vec3{glm::linearRand(-2.0f, 6.0f), 0, a}; auto tree = std::make_unique<Tree>(pos, glm::vec3{0, -0.01, 0}, glm::vec3{0, 2.5 / (a * a), 0}); scene.objects.push_back(move(tree)); } for (int i = 0; i < 50; i++) { float a = glm::linearRand(-3.0f, -12.0f); glm::vec3 pos = glm::vec3{glm::linearRand(6.0f, 9.0f), 0, a}; auto tree = std::make_unique<Tree>(pos, glm::vec3{0, -0.01, 0}, glm::vec3{0, 2.5 / (a * a), 0}); scene.objects.push_back(move(tree)); } for (int i = 0; i < 20; i++) { float a = glm::linearRand(-5.5f, -12.0f); glm::vec3 pos = glm::vec3{glm::linearRand(9.0f, 15.0f), 0, a}; auto tree = std::make_unique<Tree>(pos, glm::vec3{0, -0.01, 0}, glm::vec3{0, 2.5 / (a * a), 0}); scene.objects.push_back(move(tree)); } // trees on right edge for (int i = 0; i < 25; i++) { float a = glm::linearRand(0.1f, 5.0f); glm::vec3 pos = glm::vec3{14 + a, 0, glm::linearRand(-5.0f, 1.0f)}; auto tree = std::make_unique<Tree>(pos, glm::vec3{0, -0.01, 0}, glm::vec3{0, 2.5 / ((a + 3) * (a + 3)), 0}); scene.objects.push_back(move(tree)); } // faling trees for (int i = 0; i < 3; i++) { glm::vec3 pos = glm::vec3{4 + (i * 2), 0, -1.5}; auto tree = std::make_unique<Falling_Tree>(pos, glm::vec3{0, -0.01, 0}); scene.objects.push_back(move(tree)); } // deers glm::vec3 pos = {1.7, 0, -3}; auto deer = std::make_unique<Deer>(pos, glm::vec3{0.4470588235294118f, 0.3607843137254902f, 0.2588235294117647f}, 0.0035f, 2); scene.objects.push_back(move(deer)); // wolfs for (float i = 0; i < 5; i++) { glm::vec3 pos = {glm::linearRand(9.5f, 13.5f), 0, glm::linearRand(-1.5f, -4.0f)}; auto wolf1 = std::make_unique<Wolf>(pos, glm::vec3{0, 0, 0}, glm::vec3{0.2 + i * 0.05, 0.2 + i * 0.05, 0.2 + i * 0.05}, 90.0f, 1); scene.objects.push_back(move(wolf1)); } // third light not present scene.shader->setUniform("lights[2].color", glm::vec3(0, 0, 0)); // magic flowers glm::vec3 color = glm::vec3(1, 0, 0.8); glm::vec3 flowercenter = glm::vec3(5, 0, -1.6); scene.light_positions.at(2) = flowercenter + glm::vec3(0, 0.1, 0); scene.shader->setUniform("lights[2].color", color / glm::vec3(3, 1, 3)); for (int i = 0; i < 10; i++) { glm::vec3 pos = glm::vec3(glm::linearRand(-0.3, 0.3), 0, glm::linearRand(-0.3, 0.3)); scene.objects.push_back(move(std::make_unique<Flower>(flowercenter + pos, color))); } } void scene2_init() { scene.objects.clear(); initCommon(); // bounding boxes auto cubeleft = std::make_unique<Cube>(glm::vec3{-1, 0, 0}, glm::vec3{0, 0.3, 1}, 0); cubeleft->scale = {0.2f, 1.0f, 0.1f}; scene.objects.push_back(move(cubeleft)); auto cuberight = std::make_unique<Cube>(glm::vec3{7, 0, 0}, glm::vec3{0, 0.3, 1}, 0); cuberight->scale = {0.2f, 1.0f, 0.1f}; scene.objects.push_back(move(cuberight)); // lakeside scene.objects.push_back(move(std::make_unique<Lake>())); auto tree = std::make_unique<Tree>(glm::vec3(6.7, 0, -1.5), glm::vec3{0, 0, 0}, glm::vec3{0.2, 0.8, 0.2}); scene.objects.push_back(move(tree)); // corn for (int i = 0; i < 50; i++) { float a = glm::linearRand(-3.0f, -12.0f); glm::vec3 pos = glm::vec3{glm::linearRand(-1.0f, 9.0f), 0, a}; auto corn = std::make_unique<Corn>(pos); scene.objects.push_back(move(corn)); } // fireflies glm::vec3 posf = glm::vec3(3, 0.6, -1); scene.light_positions.push_back(posf); scene.objects.push_back(move(std::make_unique<Fireflies>(posf, glm::linearRand(30, 50)))); } int crowSpawn = 0; void spawnCrow() { // spawn a new one near player int p = scene.player_position.x; glm::vec3 pos = glm::vec3(glm::linearRand(p - 0.5, p + 4.5), 0, -5); scene.objects.push_back(move(std::make_unique<Crow>(pos))); } public: ProjectWindow(int size) : Window{"project", size, size} { buffer_init(); scene1_init(); } void buffer_init() { glEnable(GL_DEPTH_TEST); glDepthFunc(GL_LEQUAL); quadTexture.bind(); unsigned int framebufferTexture; glGenTextures(1, &framebufferTexture); glBindTexture(GL_TEXTURE_2D, framebufferTexture); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); // Prevents edge bleeding glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); // Prevents edge bleeding glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, framebufferTexture, 0); // Initialize framebuffer, its color texture (the sphere will be rendered to it) and its render buffer for depth info storage glGenFramebuffers(1, &fbo); glBindFramebuffer(GL_FRAMEBUFFER, fbo); // Set up render buffer that has a depth buffer and stencil buffer glGenRenderbuffers(1, &rbo); glBindRenderbuffer(GL_RENDERBUFFER, rbo); glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER, rbo); // Associate the quadTexture with it glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8, quadTexture.image.width, quadTexture.image.height); glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, quadTexture.getTexture(), 0); if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) throw std::runtime_error("Cannot create framebuffer!"); } void buffer_set() { glViewport(0, 0, 1024, 1024); glBindFramebuffer(GL_FRAMEBUFFER, fbo); glClearColor(0.0f, 0.0f, 0.0f, 0); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); } void buffer_show() { resetViewport(); glBindFramebuffer(GL_FRAMEBUFFER, 0); // Clear the framebuffer glClearColor(0, 0, 0, 0); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); auto quadViewMatrix = glm::mat4{1.0f}; quadViewMatrix = glm::lookAt(glm::vec3{0.0f, 0.0f, -0.8f}, scene.camera->help - glm::vec3{0.0f, 1.0f, -1.0f}, {0.0f, -1.0f, 0.0f}); // Animate rotation of the quad auto quadModelMatrix = glm::mat4{1.0f}; // Set shader inputs quadShader.use(); quadShader.setUniform("ProjectionMatrix", scene.camera->perspective); quadShader.setUniform("ViewMatrix", quadViewMatrix); quadShader.setUniform("ModelMatrix", quadModelMatrix); quadShader.setUniform("Texture", quadTexture); quadMesh.render(); } void onIdle() { buffer_set(); // Track time static auto time = (float)glfwGetTime(); float dTime = (float)glfwGetTime() - time; time = (float)glfwGetTime(); // update scene.update(dTime); // Render every object in scene scene.render(); // check for scene change if (scene.player_position.x > 12 and current_scene == 0) { current_scene++; scene2_init(); } // spawn a random crow every 4 seconds if ((int)time % 4 == 0 && (int)time != crowSpawn) { crowSpawn = (int)time; spawnCrow(); } buffer_show(); } void onKey(int key, int scanCode, int action, int mods) override { if (action == GLFW_PRESS) { switch (scanCode) { case 38: case 113: // left scene.move_left = true; break; case 40: case 114: // right scene.move_right = true; break; case 65: // spacebar if (!scene.jump) scene.jump = true; break; case 77: scene.camera->go_boundary_right = true; scene.camera->go_boundary_left = false; break; case 75: scene.camera->go_boundary_left = true; scene.camera->go_boundary_right = false; break; case 76: scene.camera->go_boundary_left = false; scene.camera->go_boundary_right = false; scene.camera->go_player = true; break; } } if (action == GLFW_RELEASE) { switch (scanCode) { case 38: case 113: // left scene.move_left = false; break; case 40: case 114: // right scene.move_right = false; break; } } } };
28.263441
133
0.66635
[ "mesh", "render", "object", "vector" ]
fc9341b14be6dea15cbfd10f910d5746e18c3313
3,723
cpp
C++
Sample4_2/app/src/main/cpp/bndev/SixPointedStar.cpp
luopan007/Vulkan_Develpment_Samples
1be40631e3b2d44aae7140f0ef17c5643a86545e
[ "Unlicense" ]
5
2020-11-20T00:06:30.000Z
2021-12-07T11:39:17.000Z
Sample4_2/app/src/main/cpp/bndev/SixPointedStar.cpp
luopan007/Vulkan_Develpment_Samples
1be40631e3b2d44aae7140f0ef17c5643a86545e
[ "Unlicense" ]
null
null
null
Sample4_2/app/src/main/cpp/bndev/SixPointedStar.cpp
luopan007/Vulkan_Develpment_Samples
1be40631e3b2d44aae7140f0ef17c5643a86545e
[ "Unlicense" ]
7
2021-01-01T10:54:58.000Z
2022-01-13T02:21:54.000Z
#include "SixPointedStar.h" #include <vector> #include <math.h> #include <string.h> float *SixPointedStar::vdata; int SixPointedStar::dataByteCount; int SixPointedStar::vCount; float toRadians(float degree) { return degree * 3.1415926535898 / 180; } void SixPointedStar::genStarData(float R, float r, float z) { std::vector<float> alVertix; //存放顶点坐标的列表 float tempAngle = 360 / 6; //六角星的角间距 float UNIT_SIZE = 1; //单位尺寸 for (float angle = 0; angle < 360; angle += tempAngle) { //六角星的每个角计算一次 alVertix.push_back(0); //第一个点的x坐标 alVertix.push_back(0); //第一个点的y坐标 alVertix.push_back(z); //第一个点的z坐标 alVertix.push_back((float) (R * UNIT_SIZE * cos(toRadians(angle)))); //第二个点的x坐标 alVertix.push_back((float) (R * UNIT_SIZE * sin(toRadians(angle)))); //第二个点的y坐标 alVertix.push_back(z); //第二个点的z坐标 alVertix.push_back((float) (r * UNIT_SIZE * cos(toRadians(angle + tempAngle / 2)))); //第三个点的x坐标 alVertix.push_back( (float) (r * UNIT_SIZE * sin(toRadians(angle + tempAngle / 2))));//第三个点的y坐标 alVertix.push_back(z); //第三个点的z坐标 alVertix.push_back(0); //第四个点的x坐标 alVertix.push_back(0); //第四个点的y坐标 alVertix.push_back(z); //第四个点的z坐标 alVertix.push_back((float) (r * UNIT_SIZE * cos(toRadians(angle + tempAngle / 2)))); //第五个点的x坐标 alVertix.push_back( (float) (r * UNIT_SIZE * sin(toRadians(angle + tempAngle / 2)))); //第五个点的y坐标 alVertix.push_back(z); //第五个点的z坐标 alVertix.push_back( (float) (R * UNIT_SIZE * cos(toRadians(angle + tempAngle)))); //第六个点的x坐标 alVertix.push_back( (float) (R * UNIT_SIZE * sin(toRadians(angle + tempAngle)))); //第六个点的y坐标 alVertix.push_back(z); //第六个点的z坐标 } vCount = alVertix.size() / 3; //计算顶点的数量 dataByteCount = alVertix.size() * 2 * sizeof(float); //顶点数据总字节数 vdata = new float[alVertix.size() * 2]; //创建顶点数据数组 int index = 0; //辅助数组索引 for (int i = 0; i < vCount; i++) { //向顶点数据数组中填充数据 vdata[index++] = alVertix[i * 3 + 0]; //存入当前顶点x坐标 vdata[index++] = alVertix[i * 3 + 1]; //存入当前顶点y坐标 vdata[index++] = alVertix[i * 3 + 2]; //存入当前顶点z坐标 if (i % 3 == 0) { //若为中心点 vdata[index++] = 1; //中心点颜色R通道值 vdata[index++] = 1; //中心点颜色G通道值 vdata[index++] = 1; //中心点颜色B通道值 } else { //若不为中心点 vdata[index++] = 0.45f; //非中心点颜色R通道值 vdata[index++] = 0.75f; //非中心点颜色G通道值 vdata[index++] = 0.75f; //非中心点颜色B通道值 } } }
56.409091
99
0.409616
[ "vector" ]
fca2dc3a83e090b0edcd86003c380a984a839c0e
6,617
cpp
C++
geometry.cpp
kvendy/Notes
065449c517305db1b4a9ff6475e029d9eb132909
[ "MIT" ]
null
null
null
geometry.cpp
kvendy/Notes
065449c517305db1b4a9ff6475e029d9eb132909
[ "MIT" ]
null
null
null
geometry.cpp
kvendy/Notes
065449c517305db1b4a9ff6475e029d9eb132909
[ "MIT" ]
null
null
null
#include "geometry.h" Position::Position(int x, int y, int width, int height) { if (y < BORDER) vertical_ = Vertical::top; else if (y > height - BORDER) vertical_ = Vertical::bottom; else vertical_ = Vertical::none; if (x < CORNER) horizontal_ = Horizontal::left; else if (x > width - CORNER) horizontal_ = Horizontal::right; else horizontal_ = Horizontal::none; } Qt::CursorShape Position::toCursorShape() const { Qt::CursorShape shape; if ((horizontal_ == Horizontal::left && vertical_ == Vertical::top) || (horizontal_ == Horizontal::right && vertical_ == Vertical::bottom)) shape = Qt::SizeFDiagCursor; else if ((horizontal_ == Horizontal::left && vertical_ == Vertical::bottom) || (horizontal_ == Horizontal::right && vertical_ == Vertical::top)) shape = Qt::SizeBDiagCursor; else if (horizontal_ == Horizontal::left || horizontal_ == Horizontal::right) shape = Qt::SizeHorCursor; else if (vertical_ == Vertical::top || vertical_ == Vertical::bottom) shape = Qt::SizeVerCursor; else shape = Qt::ArrowCursor; return shape; } void SnapManager::snap(QRect &rect, const Position &position) { int x = rect.x(), y = rect.y(), width = rect.width(), height = rect.height(); snap(x, y, width, height, position); rect.setX(x); rect.setY(y); rect.setWidth(width); rect.setHeight(height); } void SnapManager::snap(int &x, int &y, int &width, int &height, const Position &position) { int optimalX = x, optimalY = y, optimalHeight = height, optimalWidth = width, minimalDistance = SNAP + 1; if (position.vertical() || position.corner() || position.moving()) for (auto it = horizontal.lowerBound(y - SNAP); it.key() < horizontal.upperBound(y + height + SNAP).key(); ++it) { if ((it.value().first - SNAP < x + width) && (it.value().second + SNAP > x)) { if ((abs(y - it.key()) < minimalDistance) && !position.bottom()) { minimalDistance = abs(y - it.key()); optimalY = it.key(); if (position.top()) optimalHeight = height + y - it.key(); } if ((abs(y + height - it.key()) < minimalDistance) && !position.top()) { minimalDistance = abs(y + height - it.key()); if (position.bottom()) optimalHeight = it.key() - y; else optimalY = it.key() - height; } } } minimalDistance = SNAP + 1; if (position.horizontal() || position.corner() || position.moving()) for (auto it = vertical.lowerBound(x - SNAP); it.key() < vertical.upperBound(x + width + SNAP).key(); ++it) { if ((it.value().first - SNAP < y + height) && (it.value().second + SNAP > y)) { if ((abs(x - it.key()) < minimalDistance) && !position.right()) { minimalDistance = abs(x - it.key()); optimalX = it.key(); if (position.left()) optimalWidth = width + x - it.key(); } if ((abs(x + width - it.key()) < minimalDistance) && !position.left()) { minimalDistance = abs(x + width - it.key()); if (position.right()) optimalWidth = it.key() - x; else optimalX = it.key() - width; } } } x = optimalX; y = optimalY; width = optimalWidth; height = optimalHeight; } void SnapManager::clear() { windows.clear(); horizontal.clear(); vertical.clear(); } void SnapManager::addRect(const QRect &rect) { addRect(rect.x(), rect.y(), rect.width(), rect.height()); } void SnapManager::addRect(int x, int y, int width, int height) { Line newHorizontal, newVertical; newHorizontal.insert(y, {x, x + width}); newHorizontal.insert(y + height, {x, x + width}); newVertical.insert(x + width, {y, y + height}); newVertical.insert(x, {y, y + height}); //check existing windows foreach (QRect window, windows) { Line newHLine; for (auto it = newHorizontal.begin(); it != newHorizontal.end(); ++it) { newHLine.unite(checkLineToInsert(window.top(), window.bottom(), window.left(), window.right(), it.key(), it.value().first, it.value().second)); } newHorizontal = newHLine; Line newVLine; for (auto it = newVertical.begin(); it != newVertical.end(); ++it) { newVLine.unite(checkLineToInsert(window.top(), window.bottom(), window.left(), window.right(), it.key(), it.value().first, it.value().second)); } newVertical = newVLine; } horizontal.unite(newHorizontal); vertical.unite(newVertical); windows.append(QRect(x, y, width, height)); } bool SnapManager::overlapCheck(const QRect &rect) { Position hPos = Position(Horizontal::left, Vertical::none); Position vPos = Position(Horizontal::none, Vertical::top); if (checkLine(rect.x(), rect.y(), rect.y() + rect.height(), vPos, true) && checkLine(rect.y(), rect.x(), rect.x() + rect.width(), hPos, true) && checkLine(rect.x() + rect.width(), rect.y(), rect.y() + rect.height(), vPos, true) && checkLine(rect.y() + rect.height(), rect.x(), rect.x() + rect.width(), hPos, true)) return true; return false; } Line SnapManager::checkLineToInsert(int rect_top, int rect_bottom, int rect_left, int rect_right, int base_line, int base_left, int base_right) { Line line; if (rect_top < base_line && rect_bottom > base_line) { if(rect_left < base_left) { if (rect_right < base_left) //full line line.insert(base_line, {base_left, base_right}); else if (rect_right < base_right) //crop line.insert(base_line, {rect_right, base_right}); // else //no line } else { if (rect_left > base_right) //full line line.insert(base_line, {base_left, base_right}); else if (rect_right > base_right) //crop line.insert(base_line, {base_left, rect_left}); else //two lines { line.insert(base_line, {base_left, rect_left}); line.insert(base_line, {rect_right, base_right}); } } } else //full line line.insert(base_line, {base_left, base_right}); return line; } bool SnapManager::checkLine(int a, int b1, int b2, const Position &position, bool exact) { bool result = false; Line *lineSet; if (position.horizontal()) lineSet = &horizontal; else if (position.vertical()) lineSet = &vertical; for (auto it = lineSet->lowerBound(a - SNAP); it.key() < lineSet->upperBound(a + SNAP).key(); ++it) { if ((it.value().first - SNAP < b2) && (it.value().second + SNAP > b1)) { if (exact) { if ((it.value().first + SNAP > b1) && (it.value().second - SNAP < b2)) result = true; } else result = true; } } return result; }
27.686192
147
0.612815
[ "geometry", "shape" ]
fca6484225a2928f32b41ee2a1a4f8a70c1dde9a
21,107
cpp
C++
dev/Code/Sandbox/Plugins/CryDesigner/Tools/Select/MovePipeline.cpp
jeikabu/lumberyard
07228c605ce16cbf5aaa209a94a3cb9d6c1a4115
[ "AML" ]
1,738
2017-09-21T10:59:12.000Z
2022-03-31T21:05:46.000Z
dev/Code/Sandbox/Plugins/CryDesigner/Tools/Select/MovePipeline.cpp
jeikabu/lumberyard
07228c605ce16cbf5aaa209a94a3cb9d6c1a4115
[ "AML" ]
427
2017-09-29T22:54:36.000Z
2022-02-15T19:26:50.000Z
dev/Code/Sandbox/Plugins/CryDesigner/Tools/Select/MovePipeline.cpp
jeikabu/lumberyard
07228c605ce16cbf5aaa209a94a3cb9d6c1a4115
[ "AML" ]
671
2017-09-21T08:04:01.000Z
2022-03-29T14:30:07.000Z
/* * All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or * its licensors. * * For complete copyright and license terms please see the LICENSE at the root of this * distribution (the "License"). All use of this software is governed by the License, * or, if provided, by the license below or the license accompanying this file. Do not * remove or modify any license notices. This file is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * */ // Original file Copyright Crytek GMBH or its affiliates, used under license. #include "StdAfx.h" #include "MovePipeline.h" #include "Core/Model.h" #include "Core/PolygonDecomposer.h" #include "Core/BrushHelper.h" #include "Core/ModelCompiler.h" #include "Tools/DesignerTool.h" using namespace CD; void MovePipeline::TransformSelections(SMainContext& mc, const BrushMatrix34& offsetTM) { ComputeIntermediatePositionsBasedOnInitQueryResults(offsetTM); CreateOrganizedResultsAroundPolygonFromQueryResults(); if (!ExcutedAdditionPass()) { if (VertexAdditionFirstPass()) { ComputeIntermediatePositionsBasedOnInitQueryResults(offsetTM); CreateOrganizedResultsAroundPolygonFromQueryResults(); } if (VertexAdditionSecondPass()) { ComputeIntermediatePositionsBasedOnInitQueryResults(offsetTM); CreateOrganizedResultsAroundPolygonFromQueryResults(); } SetExcutedAdditionPass(true); } if (SubdivisionPass()) { UpdateAll(mc, eUT_DataBase); SetQueryResultsFromSelectedElements(*mc.pSelected); ComputeIntermediatePositionsBasedOnInitQueryResults(offsetTM); CreateOrganizedResultsAroundPolygonFromQueryResults(); } TransformationPass(); AssignIntermediatedPosToSelectedElements(*mc.pSelected); MergeCoplanarPass(); } void MovePipeline::SetQueryResultsFromSelectedElements(const ElementManager& selectedElements) { if (selectedElements.IsEmpty()) { return; } m_QueryResult = selectedElements.QueryFromElements(GetModel()); DESIGNER_ASSERT(!m_QueryResult.empty()); } void MovePipeline::CreateOrganizedResultsAroundPolygonFromQueryResults() { MODEL_SHELF_RECONSTRUCTOR(GetModel()); GetModel()->SetShelf(1); m_OrganizedQueryResult = SelectTool::CreateOrganizedResultsAroundPolygonFromQueryResults(m_QueryResult); } void MovePipeline::ComputeIntermediatePositionsBasedOnInitQueryResults(const BrushMatrix34& offsetTM) { m_IntermediateTransQueryPos.clear(); int iQueryResultSize(m_InitQueryResult.size()); m_IntermediateTransQueryPos.reserve(iQueryResultSize); DESIGNER_ASSERT(iQueryResultSize); for (int i = 0; i < iQueryResultSize; ++i) { const ModelDB::Vertex& v = m_InitQueryResult[i]; m_IntermediateTransQueryPos.push_back(offsetTM.TransformPoint(v.m_Pos)); } SnappedToMirrorPlane(); } bool MovePipeline::VertexAdditionFirstPass() { MODEL_SHELF_RECONSTRUCTOR(GetModel()); std::vector<ModelDB::Vertex> newVertices; for (int i = 0, iQuerySize(m_InitQueryResult.size()); i < iQuerySize; ++i) { ModelDB::Vertex& v = m_InitQueryResult[i]; int vertexMarkListSize(v.m_MarkList.size()); for (int k = 0; k < vertexMarkListSize; ++k) { ModelDB::Mark& mark = v.m_MarkList[k]; PolygonPtr pPolygon = mark.m_pPolygon; if (pPolygon == NULL) { continue; } BrushVec3 nextVertex; if (!pPolygon->GetNextVertex(mark.m_VertexIndex, nextVertex)) { continue; } BrushVec3 prevVertex; if (!pPolygon->GetPrevVertex(mark.m_VertexIndex, prevVertex)) { continue; } BrushVec3 nextPrevVertices[2] = { nextVertex, prevVertex }; bool bValid[2] = { true, true }; for (int b = 0; b < 2; ++b) { for (int a = 0; a < iQuerySize; ++a) { if (a == i) { continue; } if (IsEquivalent(m_QueryResult[a].m_Pos, nextPrevVertices[b])) { bValid[b] = false; break; } } } ModelDB::QueryResult qResult[2]; if (!GetModel()->GetDB()->QueryAsVertex(nextVertex, qResult[0])) { continue; } if (!GetModel()->GetDB()->QueryAsVertex(prevVertex, qResult[1])) { continue; } for (int a = 0; a < 2; ++a) { if (bValid[a] == false) { continue; } if (qResult[a].size() != 1) { continue; } GetModel()->SetShelf(1); int nAdjacentPolygonIndex(-1); PolygonPtr pAdjacentPolygon = FindAdjacentPolygon(pPolygon, nextPrevVertices[a], nAdjacentPolygonIndex); if (!pAdjacentPolygon) { continue; } ModelDB::Mark newMark; newMark.m_VertexIndex = pAdjacentPolygon->GetVertexCount(); newMark.m_pPolygon = GetModel()->GetPolygon(nAdjacentPolygonIndex); bool bExistVertex(false); for (int b = 0, iNewVertexSize(newVertices.size()); b < iNewVertexSize; ++b) { if (IsEquivalent(newVertices[b].m_Pos, nextPrevVertices[a])) { bExistVertex = true; newVertices[b].m_MarkList.push_back(newMark); break; } } if (!bExistVertex) { ModelDB::Vertex v; v.m_Pos = nextPrevVertices[a]; v.m_MarkList.push_back(newMark); newVertices.push_back(v); } } } } for (int i = 0, iNewVertexSize(newVertices.size()); i < iNewVertexSize; ++i) { ModelDB::Vertex& v = newVertices[i]; for (int k = 0, iMarkListSize(v.m_MarkList.size()); k < iMarkListSize; ++k) { CD::Polygon* pPolygon = v.m_MarkList[k].m_pPolygon; if (pPolygon == NULL) { continue; } if (pPolygon->AddVertex(v.m_Pos, &v.m_MarkList[k].m_VertexIndex, NULL)) { GetModel()->GetDB()->AddMarkToVertex(v.m_Pos, v.m_MarkList[k]); } } } return !newVertices.empty(); } bool MovePipeline::VertexAdditionSecondPass() { MODEL_SHELF_RECONSTRUCTOR(GetModel()); bool bAdded = false; for (int i = 0, iQuerySize(m_InitQueryResult.size()); i < iQuerySize; ++i) { ModelDB::Vertex& v = m_InitQueryResult[i]; int markListSize(v.m_MarkList.size()); if (markListSize > 2) { continue; } PolygonPtr pPolygon = v.m_MarkList[0].m_pPolygon; if (pPolygon == NULL) { continue; } for (int k = 0; k < kMaxShelfCount; ++k) { GetModel()->SetShelf(k); int nAdjacentPolygonIndex(-1); PolygonPtr pAdjacentPolygon = FindAdjacentPolygon(pPolygon, v.m_Pos, nAdjacentPolygonIndex); if (pAdjacentPolygon) { PolygonPtr pOldAdjacentPolygon = pAdjacentPolygon->Clone(); ModelDB::Mark newMark; if (!pAdjacentPolygon->AddVertex(v.m_Pos, &newMark.m_VertexIndex, NULL)) { continue; } if (k != 1) { GetModel()->RemovePolygon(nAdjacentPolygonIndex); } RemoveMirroredPolygon(GetModel(), pOldAdjacentPolygon); if (k != 1) { GetModel()->SetShelf(1); nAdjacentPolygonIndex = GetModel()->GetPolygonCount(); GetModel()->AddPolygon(pAdjacentPolygon, eOpType_Add); } newMark.m_pPolygon = GetModel()->GetPolygon(nAdjacentPolygonIndex); v.m_MarkList.push_back(newMark); bAdded = true; } } } if (bAdded) { m_QueryResult = m_InitQueryResult; } return bAdded; } bool MovePipeline::SubdivisionPass() { MODEL_SHELF_RECONSTRUCTOR(GetModel()); GetModel()->SetShelf(1); std::vector<PolygonPtr> removedPolygons; std::vector<PolygonPtr> addedPolygons; m_UnsubdividedPolygons.clear(); m_SubdividedPolygons.clear(); SelectTool::OrganizedQueryResults::iterator ii = m_OrganizedQueryResult.begin(); for (; ii != m_OrganizedQueryResult.end(); ++ii) { PolygonPtr pPolygon = ii->first; if (pPolygon == NULL) { continue; } if (pPolygon->IsOpen() || pPolygon->GetVertexCount() == 3) { continue; } SelectTool::QueryInputs queryInputs(ii->second); int iQuerySize(queryInputs.size()); if (iQuerySize == 0 || iQuerySize == pPolygon->GetVertexCount()) { continue; } int i = 0; for (; i < iQuerySize; ++i) { int nQueryIndex(queryInputs[i].first); // check if a position of the transformed vertex in a polygon gets out of the plane of the polygon, if (std::abs(pPolygon->GetPlane().Distance(m_IntermediateTransQueryPos[nQueryIndex])) > kDesignerLooseEpsilon) { break; } } if (i == iQuerySize) { m_UnsubdividedPolygons.insert(pPolygon); continue; } if (pPolygon->IsQuad()) { pPolygon->SetFlag(ePolyFlag_NonplanarQuad); m_UnsubdividedPolygons.insert(pPolygon); continue; } std::vector<PolygonPtr> trianglePolygons; PolygonDecomposer decomposer(eDF_SkipOptimizationOfPolygonResults); if (!decomposer.TriangulatePolygon(pPolygon, trianglePolygons)) { continue; } if (trianglePolygons.size() == 1) { continue; } for (int i = 0, iTrianglePolygonSize(trianglePolygons.size()); i < iTrianglePolygonSize; ++i) { m_SubdividedPolygons[pPolygon].push_back(trianglePolygons[i]); } addedPolygons.insert(addedPolygons.end(), trianglePolygons.begin(), trianglePolygons.end()); removedPolygons.push_back(pPolygon); } for (int i = 0, iRemovedPolygonSize(removedPolygons.size()); i < iRemovedPolygonSize; ++i) { GetModel()->RemovePolygon(removedPolygons[i]); } for (int i = 0, iPolygonSize(addedPolygons.size()); i < iPolygonSize; ++i) { GetModel()->AddPolygon(addedPolygons[i], eOpType_Add); } return removedPolygons.empty() ? false : true; } void MovePipeline::TransformationPass() { MODEL_SHELF_RECONSTRUCTOR(GetModel()); GetModel()->SetShelf(1); SelectTool::OrganizedQueryResults::iterator ii = m_OrganizedQueryResult.begin(); for (; ii != m_OrganizedQueryResult.end(); ++ii) { PolygonPtr pPolygon = ii->first; if (pPolygon == NULL) { continue; } const SelectTool::QueryInputs& queryInputs = ii->second; int iQuerySize(queryInputs.size()); for (int i = 0; i < iQuerySize; ++i) { int nQueryIndexInQueryInputs(queryInputs[i].first); pPolygon->SetPos(GetMark(queryInputs[i]).m_VertexIndex, m_IntermediateTransQueryPos[nQueryIndexInQueryInputs]); } if (m_UnsubdividedPolygons.find(pPolygon) == m_UnsubdividedPolygons.end() || pPolygon->CheckFlags(ePolyFlag_NonplanarQuad)) { BrushPlane computedPlane; if (pPolygon->GetComputedPlane(computedPlane)) { pPolygon->SetPlane(computedPlane); } } } GetModel()->InvalidateAABB(1); } bool MovePipeline::MergeCoplanarPass() { MODEL_SHELF_RECONSTRUCTOR(GetModel()); GetModel()->SetShelf(1); std::map<PolygonPtr, PolygonList>::iterator ii = m_SubdividedPolygons.begin(); bool bMergeHappened = false; for (; ii != m_SubdividedPolygons.end(); ++ii) { PolygonList& polygonList = ii->second; int iPolygonSize(polygonList.size()); if (iPolygonSize == 1) { continue; } for (int i = 0; i < iPolygonSize; ++i) { if (polygonList[i] == NULL) { continue; } for (int k = 0; k < iPolygonSize; ++k) { if (i == k || polygonList[k] == NULL) { continue; } if (Polygon::HasIntersection(polygonList[i], polygonList[k]) == eIT_JustTouch) { PolygonPtr previous = polygonList[i]->Clone(); polygonList[i]->Union(polygonList[k]); DESIGNER_ASSERT(polygonList[i]->IsValid()); GetModel()->RemovePolygon(polygonList[k]); polygonList[k] = NULL; bMergeHappened = true; } } } } return bMergeHappened; } void MovePipeline::AssignIntermediatedPosToSelectedElements(ElementManager& selectedElements) { for (int i = 0, iResultSize(m_QueryResult.size()); i < iResultSize; ++i) { for (int k = 0, iSelectedSize(selectedElements.GetCount()); k < iSelectedSize; ++k) { for (int a = 0, iVertexSize(selectedElements[k].m_Vertices.size()); a < iVertexSize; ++a) { if (IsEquivalent(selectedElements[k].m_Vertices[a], m_QueryResult[i].m_Pos)) { selectedElements[k].m_Vertices[a] = m_IntermediateTransQueryPos[i]; break; } } } } } PolygonPtr MovePipeline::FindAdjacentPolygon(PolygonPtr pPolygon, const BrushVec3& vPos, int& outAdjacentPolygonIndex) { for (int a = 0, iPolygonSize(GetModel()->GetPolygonCount()); a < iPolygonSize; ++a) { PolygonPtr pCandidatePolygon(GetModel()->GetPolygon(a)); if (pPolygon == pCandidatePolygon) { continue; } if (std::abs(pCandidatePolygon->GetPlane().Distance(vPos)) > kDistanceLimitation) { continue; } BrushVec3 nearestPos; if (!pCandidatePolygon->QueryNearestPosFromBoundary(vPos, nearestPos)) { continue; } if ((vPos - nearestPos).GetLength() > kDistanceLimitation) { continue; } if (pCandidatePolygon->Exist(vPos, kDistanceLimitation)) { continue; } outAdjacentPolygonIndex = a; return pCandidatePolygon; } return NULL; } void MovePipeline::Initialize(const ElementManager& elements) { MODEL_SHELF_RECONSTRUCTOR(GetModel()); SetQueryResultsFromSelectedElements(elements); SetExcutedAdditionPass(false); GetModel()->SetShelf(0); std::set<PolygonPtr> polygonSet; for (int i = 0, iQueryResult(m_QueryResult.size()); i < iQueryResult; ++i) { const ModelDB::Vertex& v = m_QueryResult[i]; for (int k = 0, iMarkSize(v.m_MarkList.size()); k < iMarkSize; ++k) { PolygonPtr pPolygon = v.m_MarkList[k].m_pPolygon; if (!pPolygon->CheckFlags(ePolyFlag_Mirrored)) { polygonSet.insert(pPolygon); } } } std::set<PolygonPtr>::iterator ii = polygonSet.begin(); for (; ii != polygonSet.end(); ++ii) { GetModel()->SetShelf(0); GetModel()->RemovePolygon(*ii); GetModel()->SetShelf(1); GetModel()->AddPolygon(*ii, eOpType_Add); if (!GetModel()->CheckModeFlag(eDesignerMode_Mirror)) { continue; } GetModel()->SetShelf(0); PolygonPtr pMirroredPolygon = GetModel()->QueryEquivalentPolygon((*ii)->Clone()->Mirror(GetModel()->GetMirrorPlane())); DESIGNER_ASSERT(pMirroredPolygon); if (!pMirroredPolygon) { continue; } GetModel()->RemovePolygon(pMirroredPolygon); } GetModel()->ResetDB(eDBRF_ALL, 1); SetQueryResultsFromSelectedElements(elements); m_InitQueryResult = m_QueryResult; } void MovePipeline::InitializeIndependently(ElementManager& elements) { MODEL_SHELF_RECONSTRUCTOR(GetModel()); m_QueryResult.clear(); for (int i = 0, iElementCount(elements.GetCount()); i < iElementCount; ++i) { // If vert(s) or edge(s) are selected, there won't be a polygon DESIGNER_ASSERT(elements[i].m_pPolygon); GetModel()->SetShelf(0); GetModel()->RemovePolygon(elements[i].m_pPolygon); if (GetModel()->CheckModeFlag(eDesignerMode_Mirror)) { PolygonPtr pMirroredPolygon = GetModel()->QueryEquivalentPolygon(elements[i].m_pPolygon->Clone()->Mirror(GetModel()->GetMirrorPlane())); DESIGNER_ASSERT(pMirroredPolygon); if (pMirroredPolygon) { GetModel()->RemovePolygon(pMirroredPolygon); } } GetModel()->SetShelf(1); GetModel()->AddPolygon(elements[i].m_pPolygon, eOpType_Add); for (int k = 0, iVertexCount(elements[i].m_pPolygon->GetVertexCount()); k < iVertexCount; ++k) { ModelDB::Vertex v; ModelDB::Vertex* pV = &v; BrushVec3 pos = elements[i].m_pPolygon->GetPos(k); for (int a = 0, iQueryResultCount(m_QueryResult.size()); a < iQueryResultCount; ++a) { if (IsEquivalent(m_QueryResult[a].m_Pos, pos)) { pV = &m_QueryResult[a]; break; } } if (pV == &v) { pV->m_Pos = pos; } if (elements[i].m_pPolygon) { ModelDB::Mark m; m.m_pPolygon = elements[i].m_pPolygon; m.m_VertexIndex = k; pV->m_MarkList.push_back(m); if (pV == &v) { m_QueryResult.push_back(v); } } } } m_InitQueryResult = m_QueryResult; } void MovePipeline::End() { GetModel()->MoveShelf(1, 0); GetModel()->ResetDB(eDBRF_ALL); if (m_QueryResult.size() == m_IntermediateTransQueryPos.size()) { for (int i = 0, iQuerySize(m_QueryResult.size()); i < iQuerySize; ++i) { m_QueryResult[i].m_Pos = m_IntermediateTransQueryPos[i]; } } } bool MovePipeline::GetAveragePos(BrushVec3& outAveragePos) const { if (m_IntermediateTransQueryPos.empty()) { return false; } BrushVec3 vAveragePos(0, 0, 0); int iQSize(m_IntermediateTransQueryPos.size()); if (iQSize > 0) { for (int i = 0; i < iQSize; ++i) { vAveragePos += m_IntermediateTransQueryPos[i]; } vAveragePos /= iQSize; } outAveragePos = vAveragePos; return true; } void MovePipeline::SnappedToMirrorPlane() { if (m_IntermediateTransQueryPos.empty()) { return; } if (!GetModel()->CheckModeFlag(eDesignerMode_Mirror)) { return; } int iIntermediateCount(m_IntermediateTransQueryPos.size()); BrushVec3 mirrorNormal = GetModel()->GetMirrorPlane().Normal(); int nFarthestPosIndex = -1; BrushFloat fFarthestDist = 0; for (int i = 0; i < iIntermediateCount; ++i) { BrushFloat distanceFromPosToMirrorPlane = GetModel()->GetMirrorPlane().Distance(m_IntermediateTransQueryPos[i]); if (distanceFromPosToMirrorPlane > 0 && distanceFromPosToMirrorPlane > fFarthestDist) { nFarthestPosIndex = i; fFarthestDist = distanceFromPosToMirrorPlane; } } if (nFarthestPosIndex != -1) { BrushVec3 vOffsetedPos; if (GetModel()->GetMirrorPlane().HitTest(m_IntermediateTransQueryPos[nFarthestPosIndex], m_IntermediateTransQueryPos[nFarthestPosIndex] + mirrorNormal, NULL, &vOffsetedPos)) { BrushVec3 vOffset = vOffsetedPos - m_IntermediateTransQueryPos[nFarthestPosIndex]; for (int i = 0; i < iIntermediateCount; ++i) { m_IntermediateTransQueryPos[i] += vOffset; } } } }
30.326149
181
0.567063
[ "vector", "model" ]
fcb8f38265b5b4b7b56aaed89d681fdb430565ad
6,272
cc
C++
cc/scrollbar_layer_impl.cc
junmin-zhu/chromium-rivertrail
eb1a57aca71fe68d96e48af8998dcfbe45171ee1
[ "BSD-3-Clause" ]
null
null
null
cc/scrollbar_layer_impl.cc
junmin-zhu/chromium-rivertrail
eb1a57aca71fe68d96e48af8998dcfbe45171ee1
[ "BSD-3-Clause" ]
null
null
null
cc/scrollbar_layer_impl.cc
junmin-zhu/chromium-rivertrail
eb1a57aca71fe68d96e48af8998dcfbe45171ee1
[ "BSD-3-Clause" ]
1
2020-11-04T07:27:33.000Z
2020-11-04T07:27:33.000Z
// Copyright 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "config.h" #include "cc/scrollbar_layer_impl.h" #include "cc/quad_sink.h" #include "cc/scrollbar_animation_controller.h" #include "cc/texture_draw_quad.h" using WebKit::WebRect; using WebKit::WebScrollbar; namespace cc { scoped_ptr<ScrollbarLayerImpl> ScrollbarLayerImpl::create(int id) { return make_scoped_ptr(new ScrollbarLayerImpl(id)); } ScrollbarLayerImpl::ScrollbarLayerImpl(int id) : LayerImpl(id) , m_scrollbar(this) , m_backTrackResourceId(0) , m_foreTrackResourceId(0) , m_thumbResourceId(0) , m_scrollbarOverlayStyle(WebScrollbar::ScrollbarOverlayStyleDefault) , m_orientation(WebScrollbar::Horizontal) , m_controlSize(WebScrollbar::RegularScrollbar) , m_pressedPart(WebScrollbar::NoPart) , m_hoveredPart(WebScrollbar::NoPart) , m_isScrollableAreaActive(false) , m_isScrollViewScrollbar(false) , m_enabled(false) , m_isCustomScrollbar(false) , m_isOverlayScrollbar(false) { } ScrollbarLayerImpl::~ScrollbarLayerImpl() { } void ScrollbarLayerImpl::setScrollbarGeometry(scoped_ptr<ScrollbarGeometryFixedThumb> geometry) { m_geometry = geometry.Pass(); } void ScrollbarLayerImpl::setScrollbarData(WebScrollbar* scrollbar) { m_scrollbarOverlayStyle = scrollbar->scrollbarOverlayStyle(); m_orientation = scrollbar->orientation(); m_controlSize = scrollbar->controlSize(); m_pressedPart = scrollbar->pressedPart(); m_hoveredPart = scrollbar->hoveredPart(); m_isScrollableAreaActive = scrollbar->isScrollableAreaActive(); m_isScrollViewScrollbar = scrollbar->isScrollViewScrollbar(); m_enabled = scrollbar->enabled(); m_isCustomScrollbar = scrollbar->isCustomScrollbar(); m_isOverlayScrollbar = scrollbar->isOverlay(); scrollbar->getTickmarks(m_tickmarks); m_geometry->update(scrollbar); } static FloatRect toUVRect(const WebRect& r, const IntRect& bounds) { return FloatRect(static_cast<float>(r.x) / bounds.width(), static_cast<float>(r.y) / bounds.height(), static_cast<float>(r.width) / bounds.width(), static_cast<float>(r.height) / bounds.height()); } void ScrollbarLayerImpl::appendQuads(QuadSink& quadSink, AppendQuadsData& appendQuadsData) { bool premultipledAlpha = false; bool flipped = false; FloatRect uvRect(0, 0, 1, 1); IntRect boundsRect(IntPoint(), bounds()); IntRect contentBoundsRect(IntPoint(), contentBounds()); SharedQuadState* sharedQuadState = quadSink.useSharedQuadState(createSharedQuadState()); appendDebugBorderQuad(quadSink, sharedQuadState, appendQuadsData); WebRect thumbRect, backTrackRect, foreTrackRect; m_geometry->splitTrack(&m_scrollbar, m_geometry->trackRect(&m_scrollbar), backTrackRect, thumbRect, foreTrackRect); if (!m_geometry->hasThumb(&m_scrollbar)) thumbRect = WebRect(); if (m_thumbResourceId && !thumbRect.isEmpty()) { scoped_ptr<TextureDrawQuad> quad = TextureDrawQuad::create(sharedQuadState, layerRectToContentRect(thumbRect), m_thumbResourceId, premultipledAlpha, uvRect, flipped); quad->setNeedsBlending(); quadSink.append(quad.PassAs<DrawQuad>(), appendQuadsData); } if (!m_backTrackResourceId) return; // We only paint the track in two parts if we were given a texture for the forward track part. if (m_foreTrackResourceId && !foreTrackRect.isEmpty()) quadSink.append(TextureDrawQuad::create(sharedQuadState, layerRectToContentRect(foreTrackRect), m_foreTrackResourceId, premultipledAlpha, toUVRect(foreTrackRect, boundsRect), flipped).PassAs<DrawQuad>(), appendQuadsData); // Order matters here: since the back track texture is being drawn to the entire contents rect, we must append it after the thumb and // fore track quads. The back track texture contains (and displays) the buttons. if (!contentBoundsRect.isEmpty()) quadSink.append(TextureDrawQuad::create(sharedQuadState, IntRect(contentBoundsRect), m_backTrackResourceId, premultipledAlpha, uvRect, flipped).PassAs<DrawQuad>(), appendQuadsData); } void ScrollbarLayerImpl::didLoseContext() { m_backTrackResourceId = 0; m_foreTrackResourceId = 0; m_thumbResourceId = 0; } bool ScrollbarLayerImpl::Scrollbar::isOverlay() const { return m_owner->m_isOverlayScrollbar; } int ScrollbarLayerImpl::Scrollbar::value() const { return m_owner->m_currentPos; } WebKit::WebPoint ScrollbarLayerImpl::Scrollbar::location() const { return WebKit::WebPoint(); } WebKit::WebSize ScrollbarLayerImpl::Scrollbar::size() const { return WebKit::WebSize(m_owner->bounds().width(), m_owner->bounds().height()); } bool ScrollbarLayerImpl::Scrollbar::enabled() const { return m_owner->m_enabled; } int ScrollbarLayerImpl::Scrollbar::maximum() const { return m_owner->m_maximum; } int ScrollbarLayerImpl::Scrollbar::totalSize() const { return m_owner->m_totalSize; } bool ScrollbarLayerImpl::Scrollbar::isScrollViewScrollbar() const { return m_owner->m_isScrollViewScrollbar; } bool ScrollbarLayerImpl::Scrollbar::isScrollableAreaActive() const { return m_owner->m_isScrollableAreaActive; } void ScrollbarLayerImpl::Scrollbar::getTickmarks(WebKit::WebVector<WebRect>& tickmarks) const { tickmarks = m_owner->m_tickmarks; } WebScrollbar::ScrollbarControlSize ScrollbarLayerImpl::Scrollbar::controlSize() const { return m_owner->m_controlSize; } WebScrollbar::ScrollbarPart ScrollbarLayerImpl::Scrollbar::pressedPart() const { return m_owner->m_pressedPart; } WebScrollbar::ScrollbarPart ScrollbarLayerImpl::Scrollbar::hoveredPart() const { return m_owner->m_hoveredPart; } WebScrollbar::ScrollbarOverlayStyle ScrollbarLayerImpl::Scrollbar::scrollbarOverlayStyle() const { return m_owner->m_scrollbarOverlayStyle; } WebScrollbar::Orientation ScrollbarLayerImpl::Scrollbar::orientation() const { return m_owner->m_orientation; } bool ScrollbarLayerImpl::Scrollbar::isCustomScrollbar() const { return m_owner->m_isCustomScrollbar; } const char* ScrollbarLayerImpl::layerTypeAsString() const { return "ScrollbarLayer"; } }
30.896552
229
0.756856
[ "geometry" ]
fcc07d2e65e1c7f266d5b9c9e450fb0ab2f12878
2,367
cpp
C++
Tests/TestingData.cpp
haopan27/BWEM-community
3f28901d143e55b86a6a4d41d9b82533042d25f7
[ "X11" ]
20
2018-04-01T21:13:43.000Z
2021-12-06T02:49:44.000Z
Tests/TestingData.cpp
haopan27/BWEM-community
3f28901d143e55b86a6a4d41d9b82533042d25f7
[ "X11" ]
18
2018-04-19T03:10:20.000Z
2021-06-01T19:02:18.000Z
Tests/TestingData.cpp
haopan27/BWEM-community
3f28901d143e55b86a6a4d41d9b82533042d25f7
[ "X11" ]
11
2018-04-13T08:24:56.000Z
2020-05-09T15:51:51.000Z
#include <vector> std::vector<std::string> mapsForTest = { "data/maps/(2)Showdown.scx", "data/maps/onlywater.scm", "data/maps/onlydirt.scm", }; std::vector<std::pair<int, int>> mapTileDimensions = { { 64, 192 }, { 128, 128 }, { 128, 128 }, }; std::vector<std::pair<int, int>> mapWalkDimensions = { { 256, 768 }, { 512, 512 }, { 512, 512 }, }; std::vector<std::pair<int, int>> mapCenterPositions = { { 1024, 3072 }, { 2048, 2048 }, { 2048, 2048 }, }; std::vector<std::pair<int, int>> mapAltitudeLimits = { { 0, 426 }, { 0, 66 }, { 0, 2032 }, }; std::vector<std::string> sscaitMaps = { "data/maps/sscai/(2)Benzene.scx", "data/maps/sscai/(2)Destination.scx", "data/maps/sscai/(2)Heartbreak Ridge.scx", "data/maps/sscai/(3)Neo Moon Glaive.scx", "data/maps/sscai/(3)Tau Cross.scx", "data/maps/sscai/(4)Andromeda.scx", "data/maps/sscai/(4)Circuit Breaker.scx", "data/maps/sscai/(4)Electric Circuit.scx", "data/maps/sscai/(4)Empire of the Sun.scm", "data/maps/sscai/(4)Fighting Spirit.scx", "data/maps/sscai/(4)Icarus.scm", "data/maps/sscai/(4)Jade.scx", "data/maps/sscai/(4)La Mancha1.1.scx", "data/maps/sscai/(4)Python.scx", "data/maps/sscai/(4)Roadrunner.scx", }; std::vector<std::pair<int, int>> sscaitMapTileDimensions = { { 128, 112 }, { 96, 128 }, { 128, 96 }, { 128, 128 }, { 128, 128 }, { 128, 128 }, { 128, 128 }, { 128, 128 }, { 128, 128 }, { 128, 128 }, { 128, 128 }, { 128, 128 }, { 128, 128 }, { 128, 128 }, { 128, 128 }, }; std::vector<std::pair<int, int>> sscaitMapWalkDimensions = { { 512, 448 }, { 384, 512 }, { 512, 384 }, { 512, 512 }, { 512, 512 }, { 512, 512 }, { 512, 512 }, { 512, 512 }, { 512, 512 }, { 512, 512 }, { 512, 512 }, { 512, 512 }, { 512, 512 }, { 512, 512 }, { 512, 512 }, }; std::vector<std::pair<int, int>> sscaitMapCenterPositions = { { 2048, 1792 }, { 1536, 2048 }, { 2048, 1536 }, { 2048, 2048 }, { 2048, 2048 }, { 2048, 2048 }, { 2048, 2048 }, { 2048, 2048 }, { 2048, 2048 }, { 2048, 2048 }, { 2048, 2048 }, { 2048, 2048 }, { 2048, 2048 }, { 2048, 2048 }, { 2048, 2048 }, }; std::vector<std::pair<int, int>> sscaitMapAltitudeLimits = { { 0, 488 }, { 0, 483 }, { 0, 454 }, { 0, 429 }, { 0, 478 }, { 0, 392 }, { 0, 659 }, { 0, 347 }, { 0, 444 }, { 0, 493 }, { 0, 458 }, { 0, 640 }, { 0, 408 }, { 0, 1035 }, { 0, 416 }, };
18.068702
61
0.552598
[ "vector" ]
fcc34e410de770e9cc4a589007bf4a864215d8a7
551
cpp
C++
acmp.ru/1182/1182_alter.cpp
mstrechen/cp
ffac439840a71f70580a0ef197e47479e167a0eb
[ "MIT" ]
null
null
null
acmp.ru/1182/1182_alter.cpp
mstrechen/cp
ffac439840a71f70580a0ef197e47479e167a0eb
[ "MIT" ]
null
null
null
acmp.ru/1182/1182_alter.cpp
mstrechen/cp
ffac439840a71f70580a0ef197e47479e167a0eb
[ "MIT" ]
null
null
null
#include <stdio.h> #include <set> #include <vector> using namespace std; int main(){ int n, k, m; int tmpBe, tmpEn; scanf("%d%d%d", &n,&k,&m); vector<int> a(n-1, k); set<int> zeros; for(int i = 0; i<m; i++) { scanf("%d%d", &tmpBe, &tmpEn); if(zeros.lower_bound(tmpBe)==zeros.end()||*zeros.lower_bound(tmpBe)>=tmpEn) { printf("Yes\n"); for(int i = tmpBe; i<tmpEn; i++) { a[i]--; if(!a[i]) zeros.insert(i); } } else { printf("No\n"); } } return 0; }
14.128205
78
0.482759
[ "vector" ]
fcc58f08aa98731690e37d9c277178d19b2e156f
7,603
cpp
C++
library/src/RadJav/cpp/RadJavCPPOSScreenInfo.cpp
FogChainInc/RadJavPrivate
4dd01ba3e36d642ad9c0a1b80cd60b94dbe302d0
[ "MIT" ]
null
null
null
library/src/RadJav/cpp/RadJavCPPOSScreenInfo.cpp
FogChainInc/RadJavPrivate
4dd01ba3e36d642ad9c0a1b80cd60b94dbe302d0
[ "MIT" ]
null
null
null
library/src/RadJav/cpp/RadJavCPPOSScreenInfo.cpp
FogChainInc/RadJavPrivate
4dd01ba3e36d642ad9c0a1b80cd60b94dbe302d0
[ "MIT" ]
null
null
null
/* MIT-LICENSE Copyright (c) 2017-2018 Higher Edge Software, LLC Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "cpp/RadJavCPPOSScreenInfo.h" #include "RadJav.h" #include "RadJavString.h" #ifdef USE_IOS #import <UIKit/UIKit.h> #endif #ifdef USE_ANDROID #include "android/RadJavAndroid.h" #include "android/Utils.h" #endif #ifdef USE_JAVASCRIPTCORE #include "jscore/RadJavJSCJavascriptEngine.h" #endif #ifdef GUI_USE_WXWIDGETS #include <wx/window.h> #include <wx/display.h> #endif namespace RadJAV { namespace CPP { namespace OS { ScreenInfo::ScreenInfo(RJINT width, RJINT height, RJNUMBER scale) { this->width = width; this->height = height; this->scale = scale; } #ifdef USE_V8 ScreenInfo::ScreenInfo(V8JavascriptEngine *jsEngine, v8::Local<v8::Object> obj) { width = 0; height = 0; scale = 1; width = jsEngine->v8GetInt (obj, "width"); height = jsEngine->v8GetInt (obj, "height"); scale = jsEngine->v8GetDecimal (obj, "scale"); } v8::Local<v8::Object> ScreenInfo::toV8Object() { v8::Handle<v8::Function> func = V8_JAVASCRIPT_ENGINE->v8GetFunction(V8_RADJAV, "OS"); v8::Handle<v8::Function> func2 = V8_JAVASCRIPT_ENGINE->v8GetFunction(func, "ScreenInfo"); v8::Local<v8::Object> ScreenInfoObj = V8_JAVASCRIPT_ENGINE->v8CallAsConstructor(func2, 0, NULL); V8_JAVASCRIPT_ENGINE->v8SetNumber(ScreenInfoObj, "width", width); V8_JAVASCRIPT_ENGINE->v8SetNumber(ScreenInfoObj, "height", height); V8_JAVASCRIPT_ENGINE->v8SetNumber(ScreenInfoObj, "scale", scale); return (ScreenInfoObj); } #endif #ifdef USE_JAVASCRIPTCORE ScreenInfo::ScreenInfo(JSCJavascriptEngine *jsEngine, JSObjectRef obj) { width = 0; height = 0; scale = 1; width = jsEngine->jscGetInt (obj, "width"); height = jsEngine->jscGetInt (obj, "height"); scale = jsEngine->jscGetDecimal (obj, "scale"); } JSObjectRef ScreenInfo::toJSCObject() { JSObjectRef func = JSC_JAVASCRIPT_ENGINE->jscGetFunction(JSC_RADJAV, "OS"); JSObjectRef func2 = JSC_JAVASCRIPT_ENGINE->jscGetFunction(func, "ScreenInfo"); JSObjectRef objJSC = JSC_JAVASCRIPT_ENGINE->jscCallAsConstructor(func2, 0, NULL); JSC_JAVASCRIPT_ENGINE->jscSetNumber(objJSC, "width", width); JSC_JAVASCRIPT_ENGINE->jscSetNumber(objJSC, "height", height); JSC_JAVASCRIPT_ENGINE->jscSetNumber(objJSC, "scale", scale); return (objJSC); } #endif RJUINT ScreenInfo::getWidth () { return (width); } RJUINT ScreenInfo::getHeight () { return (height); } RJNUMBER ScreenInfo::getScale () { return (scale); } RJINT ScreenInfo::getNumberOfScreens () { RJINT numScreens = 1; #ifdef GUI_USE_WXWIDGETS numScreens = wxDisplay::GetCount(); #endif return (numScreens); } ScreenInfo ScreenInfo::getScreenInfo (RJINT screenIndex) { ScreenInfo info; #ifdef GUI_USE_WXWIDGETS RJINT screensCount = getNumberOfScreens(); if (screenIndex < screensCount && screenIndex >= 0) { wxDisplay display(screenIndex); wxRect displayBounds = display.GetGeometry(); info.width = displayBounds.width; info.height = displayBounds.height; //Get scale factor for main display if (screenIndex == 0) { wxApp* app = wxTheApp; if (app) { wxWindow* mainWindow = app->GetTopWindow(); if (mainWindow) { info.scale = mainWindow->GetContentScaleFactor(); } } } } #elif defined USE_IOS UIScreen *screen = [UIScreen mainScreen]; CGRect screenRect = [screen bounds]; info.width = screenRect.size.width; info.height = screenRect.size.height; info.scale = screen.scale; #elif defined USE_ANDROID /* Java example Application app = getApplication(); WindowManager win_manager = (WindowManager) app.getSystemService(Context.WINDOW_SERVICE); Display display = win_manager.getDefaultDisplay(); DisplayMetrics metrics = new DisplayMetrics(); display.getMetrics(metrics); //Actual values metrics.widthPixels; metrics.heightPixels; */ using namespace Android; Jni& jni = Jni::instance(); JNIEnv* env = jni.getJniEnv(); RadJavAndroid* radJavApp = RadJavAndroid::instance(); jobject appJava = radJavApp->getJavaApplication(); auto appClass = jni.wrapLocalRef(env->GetObjectClass(appJava)); jmethodID getSystemService = env->GetMethodID(appClass, "getSystemService", "(Ljava/lang/String;)Ljava/lang/Object;"); jclass contextClass = jni.findClass("android/content/Context"); jfieldID window_service = env->GetStaticFieldID(contextClass, "WINDOW_SERVICE", "Ljava/lang/String;"); auto window_service_str = jni.wrapLocalRef(env->GetStaticObjectField(contextClass, window_service)); auto object = jni.wrapLocalRef(env->CallObjectMethod(appJava, getSystemService, window_service_str.get())); auto windowManager = jni.wrapLocalRef(Utils::Cast(object, "android.view.WindowManager")); jclass windowManagerClass = jni.findClass("android/view/WindowManager"); jmethodID getDefaultDisplay = env->GetMethodID(windowManagerClass, "getDefaultDisplay", "()Landroid/view/Display;"); auto display = jni.wrapLocalRef(env->CallObjectMethod(windowManager, getDefaultDisplay)); jclass displayMetricsClass = jni.findClass("android/util/DisplayMetrics"); jmethodID displayMetricsConstructor = env->GetMethodID(displayMetricsClass, "<init>", "()V"); auto displayMetrics = jni.wrapLocalRef(env->NewObject(displayMetricsClass, displayMetricsConstructor)); auto displayClass = jni.wrapLocalRef(env->GetObjectClass(display)); jmethodID getMetrics = env->GetMethodID(displayClass, "getMetrics", "(Landroid/util/DisplayMetrics;)V"); env->CallVoidMethod(display, getMetrics, displayMetrics.get()); jfieldID widthPixels = env->GetFieldID(displayMetricsClass, "widthPixels", "I"); jfieldID heightPixels = env->GetFieldID(displayMetricsClass, "heightPixels", "I"); info.width = env->GetIntField(displayMetrics, widthPixels); info.height = env->GetIntField(displayMetrics, heightPixels); #else #warning Add ScreenInfo support #endif return (info); } } } }
31.679167
123
0.683809
[ "object" ]
fcc98bd3dcdf0e07d8bcb1dd74821d24133b58c6
3,180
cc
C++
uARM/src/UarmController.cc
abstractguy/gym_gazebo_kinetic
61a55966cf66de493b149ad314c1d9b987d1deb9
[ "MIT" ]
1
2021-06-06T14:12:32.000Z
2021-06-06T14:12:32.000Z
uARM/src/UarmController.cc
abstractguy/gym_gazebo_kinetic
61a55966cf66de493b149ad314c1d9b987d1deb9
[ "MIT" ]
6
2021-04-06T12:35:34.000Z
2022-03-12T00:58:16.000Z
uARM/src/UarmController.cc
abstractguy/gym_gazebo_kinetic
61a55966cf66de493b149ad314c1d9b987d1deb9
[ "MIT" ]
2
2020-03-05T00:09:48.000Z
2021-06-03T20:06:03.000Z
#include "UarmController.hh" #include "new_position.pb.h" namespace gazebo { UarmController::UarmController() { // initialize the pid controller for (int i = 0; i < NUM_JOINTS; i++) { this->jointPIDs[i] = common::PID(40, 0, 20, 1, -1); this->jointPositions[i] = 0; this->jointVelocities[i] = 0; this->jointMaxEfforts[i] = 10; } jointPositions[1] = 1; } ////////////////////////////////////////////////// void UarmController::Load(physics::ModelPtr _model, sdf::ElementPtr _sdf) { this->model = _model; this->node = transport::NodePtr(new transport::Node()); this->node->Init(this->model->GetWorld()->GetName()); // get all joints this->joints[0] = _model->GetJoint("center_table_mount"); this->joints[1] = _model->GetJoint("left_base_shoulder_joint"); this->joints[2] = _model->GetJoint("left_base_arm_joint"); this->updateConnection = event::Events::ConnectWorldUpdateBegin(boost::bind(&UarmController::OnUpdate, this)); // Create our node for communication gazebo::transport::NodePtr node(new gazebo::transport::Node()); node->Init(this->model->GetName()); // Listen to commands sub = node->Subscribe("/uarm/commands", &UarmController::MoveCallback, this); } ///////////////////////////////////////////////// void UarmController::Init() { } ////////////////////////////////////////////////// void UarmController::OnUpdate() { common::Time currTime = this->model->GetWorld()->GetSimTime(); common::Time stepTime = currTime - this->prevUpdateTime; this->prevUpdateTime = currTime; // needed attributes to calculate all needed values for the pid controller double pos_target, pos_curr, max_cmd, pos_err, effort_cmd; for (int i = 0; i < NUM_JOINTS; i++) { pos_target = this->jointPositions[i]; pos_curr = this->joints[i]->GetAngle(0).Radian(); max_cmd = this->jointMaxEfforts[i]; pos_err = pos_curr - pos_target; effort_cmd = this->jointPIDs[i].Update(pos_err, stepTime); effort_cmd = effort_cmd > max_cmd ? max_cmd : (effort_cmd < -max_cmd ? -max_cmd : effort_cmd); this->joints[i]->SetForce(0, effort_cmd); } } ////////////////////////////////////////////////// void UarmController::MoveCallback(NewPosition &_msg) { std::cout << "Received new Position" << std::endl; // iterate over the message for (int i = 0; i < _msg->positions().size(); i++) { // check if the current joint from the message is center_table_mount if (_msg->positions().Get(i).joint_name() == "center_table_mount") { // save the radian in jointPosition this->jointPositions[0] = _msg->positions().Get(i).angle(); } // check if the current joint from the message is left_base_shoulder_joint if (_msg->positions().Get(i).joint_name() == "left_base_shoulder_joint") { // save the radian in jointPosition this->jointPositions[1] = _msg->positions().Get(i).angle(); } // check if the current joint from the message is left_base_arm_joint if (_msg->positions().Get(i).joint_name() == "left_base_arm_joint") { // save the radian in jointPosition this->jointPositions[2] = _msg->positions().Get(i).angle(); } } } }
32.44898
112
0.632704
[ "model" ]
fccd3f3863a2988c03ffda7182293a88b9b833a0
151
cpp
C++
src/Task.cpp
nguyentrungduc08/Dinjector
5f2ebbac60b503c067bdaba707b8f58f164f6e0c
[ "MIT" ]
null
null
null
src/Task.cpp
nguyentrungduc08/Dinjector
5f2ebbac60b503c067bdaba707b8f58f164f6e0c
[ "MIT" ]
null
null
null
src/Task.cpp
nguyentrungduc08/Dinjector
5f2ebbac60b503c067bdaba707b8f58f164f6e0c
[ "MIT" ]
null
null
null
#include "Task.h" Task::Task(){ std::cout << "Create Task object" << std::endl; } Task::~Task(){ std::cout << "Release Task object" << std::endl; }
16.777778
49
0.589404
[ "object" ]
fcdd46558aa8b397106abd89de08cdf6a964fab8
7,119
cc
C++
visualdl/logic/sdk_test.cc
nepeplwu/VisualDL
a6928902ca0802419fa337236b71d2db8e669e13
[ "Apache-2.0" ]
1
2019-08-23T08:42:44.000Z
2019-08-23T08:42:44.000Z
visualdl/logic/sdk_test.cc
nepeplwu/VisualDL
a6928902ca0802419fa337236b71d2db8e669e13
[ "Apache-2.0" ]
null
null
null
visualdl/logic/sdk_test.cc
nepeplwu/VisualDL
a6928902ca0802419fa337236b71d2db8e669e13
[ "Apache-2.0" ]
1
2020-01-29T03:38:35.000Z
2020-01-29T03:38:35.000Z
/* Copyright (c) 2017 VisualDL Authors. All Rights Reserve. 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. */ #include "visualdl/logic/sdk.h" #include <gtest/gtest.h> using namespace std; namespace visualdl { TEST(Scalar, write) { const auto dir = "./tmp/sdk_test"; LogWriter writer__(dir, 1); auto writer = writer__.AsMode("train"); // write disk every time auto tablet = writer.AddTablet("scalar0"); components::Scalar<int> scalar(tablet); scalar.AddRecord(0, 12); scalar.AddRecord(1, 13); auto tablet1 = writer.AddTablet("model/layer/min"); components::Scalar<float> scalar1(tablet1); scalar1.SetCaption("customized caption"); // read from disk LogReader reader_(dir); auto reader = reader_.AsMode("train"); auto tablet_reader = reader.tablet("scalar0"); auto scalar_reader = components::ScalarReader<int>(std::move(tablet_reader)); auto caption = scalar_reader.caption(); ASSERT_EQ(caption, "train"); // reference PR#225 ASSERT_EQ(scalar_reader.total_records(), 2); auto record = scalar_reader.records(); // reference PR#225 ASSERT_EQ(record.size(), 2); // check the first entry of first record ASSERT_EQ(record.front(), 12); ASSERT_TRUE(!reader.storage().modes().empty()); // check tags ASSERT_EQ(reader_.all_tags().size(), 1); auto tags = reader.tags("scalar"); ASSERT_EQ(tags.size(), 2); ASSERT_EQ(tags.front(), "scalar0"); ASSERT_EQ(tags[1], "model/layer/min"); } TEST(Image, test) { const auto dir = "./tmp/sdk_test.image"; LogWriter writer__(dir, 4); auto writer = writer__.AsMode("train"); auto tablet = writer.AddTablet("image0"); components::Image image(tablet, 3, 1); const int num_steps = 10; LOG(INFO) << "write images"; image.SetCaption("this is an image"); for (int step = 0; step < num_steps; step++) { image.StartSampling(); for (int i = 0; i < 7; i++) { vector<int64_t> shape({5, 5, 3}); vector<float> data; for (int j = 0; j < 3 * 5 * 5; j++) { data.push_back(float(rand()) / RAND_MAX); } int index = image.IndexOfSampleTaken(); if (index != -1) { image.SetSample(index, shape, data); } } image.FinishSampling(); } LOG(INFO) << "read images"; // read it LogReader reader__(dir); auto reader = reader__.AsMode("train"); auto tablet2read = reader.tablet("image0"); components::ImageReader image2read("train", tablet2read); CHECK_EQ(image2read.caption(), "this is an image"); CHECK_EQ(image2read.num_records(), num_steps); } TEST(Image, add_sample_test) { const auto dir = "./tmp/sdk_test.image"; LogWriter writer__(dir, 4); auto writer = writer__.AsMode("train"); auto tablet = writer.AddTablet("image0"); components::Image image(tablet, 3, 1); const int num_steps = 10; LOG(INFO) << "write images"; image.SetCaption("this is an image"); for (int step = 0; step < num_steps; step++) { image.StartSampling(); for (int i = 0; i < 7; i++) { vector<int64_t> shape({5, 5, 3}); vector<float> data; for (int j = 0; j < 3 * 5 * 5; j++) { data.push_back(float(rand()) / RAND_MAX); } image.AddSample(shape, data); } image.FinishSampling(); } LOG(INFO) << "read images"; // read it LogReader reader__(dir); auto reader = reader__.AsMode("train"); auto tablet2read = reader.tablet("image0"); components::ImageReader image2read("train", tablet2read); CHECK_EQ(image2read.caption(), "this is an image"); CHECK_EQ(image2read.num_records(), num_steps); } TEST(Audio, test) { const auto dir = "./tmp/sdk_test.audio"; LogWriter writer__(dir, 4); auto writer = writer__.AsMode("train"); auto tablet = writer.AddTablet("audio0"); components::Audio audio(tablet, 3, 1); const int num_steps = 10; LOG(INFO) << "write audio"; audio.SetCaption("this is an audio"); for (int step = 0; step < num_steps; step++) { audio.StartSampling(); for (int i = 0; i < 7; i++) { vector<int32_t> shape({16000, 2, 2}); vector<uint8_t> data; for (int j = 0; j < 16000 * 2 * 2; j++) { data.push_back(rand() % 256); } int index = audio.IndexOfSampleTaken(); if (index != -1) { audio.SetSample(index, shape, data); } } audio.FinishSampling(); } LOG(INFO) << "read audio"; // read it LogReader reader__(dir); auto reader = reader__.AsMode("train"); auto tablet2read = reader.tablet("audio0"); components::AudioReader audio2read("train", tablet2read); CHECK_EQ(audio2read.caption(), "this is an audio"); CHECK_EQ(audio2read.num_records(), num_steps); } TEST(Audio, add_sample_test) { const auto dir = "./tmp/sdk_test.audio"; LogWriter writer__(dir, 4); auto writer = writer__.AsMode("train"); auto tablet = writer.AddTablet("audio0"); components::Audio audio(tablet, 3, 1); const int num_steps = 10; LOG(INFO) << "write audio"; audio.SetCaption("this is an audio"); for (int step = 0; step < num_steps; step++) { audio.StartSampling(); for (int i = 0; i < 7; i++) { vector<uint8_t> data; for (int j = 0; j < 16000 * 2 * 2; j++) { data.push_back(rand() % 256); } } audio.FinishSampling(); } LOG(INFO) << "read audio"; // read it LogReader reader__(dir); auto reader = reader__.AsMode("train"); auto tablet2read = reader.tablet("audio0"); components::AudioReader audio2read("train", tablet2read); CHECK_EQ(audio2read.caption(), "this is an audio"); CHECK_EQ(audio2read.num_records(), num_steps); } TEST(Histogram, AddRecord) { const auto dir = "./tmp/sdk_test.histogram"; LogWriter writer__(dir, 1); auto writer = writer__.AsMode("train"); auto tablet = writer.AddTablet("histogram0"); components::Histogram<float> histogram(tablet, 10); std::vector<float> data(1000); for (auto& v : data) { v = (float)rand() / RAND_MAX; } histogram.AddRecord(10, data); } TEST(Scalar, more_than_one_mode) { const auto dir = "./tmp/sdk_multi_mode"; LogWriter log(dir, 20); std::vector<components::Scalar<float>> scalars; for (int i = 0; i < 1; i++) { std::stringstream ss; ss << "mode-" << i; auto mode = ss.str(); auto writer = log.AsMode(mode); ASSERT_EQ(writer.storage().dir(), dir); LOG(INFO) << "origin dir: " << dir; LOG(INFO) << "changed dir: " << writer.storage().dir(); auto tablet = writer.AddTablet("add/scalar0"); scalars.emplace_back(tablet); } for (int i = 0; i < 1; i++) { auto& scalar = scalars[i]; for (int j = 0; j < 100; j++) { scalar.AddRecord(j, (float)j); } } } } // namespace visualdl
29.057143
79
0.645175
[ "shape", "vector", "model" ]
fcde58606663feab673bda4832566cf9ef2092f3
3,318
cc
C++
src/env/binary_interface.cc
mzdun/cxx-modules
aec9a153fa7339f6372d9128964a652d50c116fc
[ "MIT" ]
null
null
null
src/env/binary_interface.cc
mzdun/cxx-modules
aec9a153fa7339f6372d9128964a652d50c116fc
[ "MIT" ]
null
null
null
src/env/binary_interface.cc
mzdun/cxx-modules
aec9a153fa7339f6372d9128964a652d50c116fc
[ "MIT" ]
null
null
null
#include "env/binary_interface.hh" namespace env { namespace { std::u8string append(char8_t ch, std::filesystem::path const& dirname) { auto result = dirname.generic_u8string(); if (!result.empty() && result.back() != ch) result.push_back(ch); return result; } std::u8string prepend(char8_t ch, std::filesystem::path const& ext) { auto result = ext.generic_u8string(); if (!result.empty() && result.front() != ch) result.insert(result.begin(), ch); return result; } } // namespace binary_interface::binary_interface(bool supports_paritions, bool standalone_interface, std::filesystem::path const& dirname, std::filesystem::path const& ext) : partition_separator_{supports_paritions ? u8'-' : u8'.'} , standalone_interface_{standalone_interface} , dirname_{append(u8'/', dirname)} , ext_{prepend(u8'.', ext)} {} std::u8string binary_interface::as_interface(mod_name const& name) { std::u8string fname{}; fname.reserve(dirname_.size() + name.module.size() + (name.part.empty() ? 0 : 1 + name.part.size()) + ext_.size()); fname.append(dirname_); fname.append(name.module); if (!name.part.empty()) { fname.push_back(partition_separator_); fname.append(name.part); } fname.append(ext_); return fname; } std::optional<artifact> binary_interface::from_module( include_locator& locator, std::filesystem::path const& source_path, mod_name const& ref) { if (!ref.module.empty() && (ref.module.front() == u8'<' || ref.module.front() == u8'"')) { return header_module(locator, source_path, ref); } return mod_ref{ref, as_interface(ref)}; } void binary_interface::add_targets(std::vector<target>& targets, rule_types& rules_needed) const { for (auto const& [bmi_file, sources] : header_modules_) { rules_needed.set(rule_type::EMIT_INCLUDE); target bmi{rule_type::EMIT_INCLUDE, file_ref{0, bmi_file, file_ref::header_module, std::get<1>(sources)}}; bmi.inputs.expl.push_back(file_ref{0, std::get<0>(sources), file_ref::include, std::get<2>(sources)}); targets.push_back(std::move(bmi)); targets.push_back({ {}, file_ref{0, std::get<0>(sources), file_ref::include, std::get<2>(sources)}, }); } } std::optional<artifact> binary_interface::header_module( include_locator& locator, std::filesystem::path const& source_path, mod_name const& ref) { auto const path = locator.find_include(source_path, ref.module); if (path.empty()) return std::nullopt; auto const bmi_rel = path.relative_path().generic_u8string() + ext_; std::u8string bmi{}; bmi.reserve(dirname_.size() + bmi_rel.size()); bmi.append(dirname_); bmi.append(bmi_rel); auto const bmi_node_name = std::filesystem::path{bmi}.filename().generic_u8string(); header_modules_[bmi] = { path.generic_u8string(), bmi_node_name, ref.module, }; return file_ref{0, std::move(bmi), file_ref::header_module, bmi_node_name}; } } // namespace env
34.5625
74
0.617541
[ "vector" ]
fce0cdc43c1d9a5659fbc5f456d29be35caa8fcd
2,843
cpp
C++
Overdrive/render/vertexarray.cpp
png85/Overdrive
e763827546354c7c75395ab1a82949a685ecb880
[ "MIT" ]
41
2015-02-21T08:54:00.000Z
2021-05-11T16:01:29.000Z
Overdrive/render/vertexarray.cpp
png85/Overdrive
e763827546354c7c75395ab1a82949a685ecb880
[ "MIT" ]
1
2018-05-14T10:02:09.000Z
2018-05-14T10:02:09.000Z
Overdrive/render/vertexarray.cpp
png85/Overdrive
e763827546354c7c75395ab1a82949a685ecb880
[ "MIT" ]
10
2015-10-07T05:44:08.000Z
2020-12-01T09:00:01.000Z
#include "stdafx.h" #include "vertexarray.h" #include "gltypes.h" namespace overdrive { namespace render { VertexArray::VertexArray() { glGenVertexArrays(1, &mHandle); } VertexArray::~VertexArray() { if (mHandle) glDeleteVertexArrays(1, &mHandle); } GLuint VertexArray::getHandle() const { return mHandle; } void VertexArray::bind() { glBindVertexArray(mHandle); } void VertexArray::unbind() { glBindVertexArray(0); } void VertexArray::draw(ePrimitives mode_) { bind(); GLenum mode = static_cast<GLenum>(mode_); if (mIndexBufferType == 0) glDrawArrays(mode, 0, mVertexBufferSize); else glDrawElements(mode, mIndexBufferSize, mIndexBufferType, nullptr); unbind(); } void VertexArray::drawInstanced(GLsizei primitiveCount, ePrimitives mode_) { bind(); GLenum mode = static_cast<GLenum>(mode_); if (mIndexBufferType == 0) glDrawArraysInstanced( mode, 0, mVertexBufferSize, primitiveCount ); else glDrawElementsInstanced( mode, mIndexBufferSize, mIndexBufferType, nullptr, primitiveCount ); unbind(); } void VertexArray::drawRange(GLuint begin, GLuint end, ePrimitives mode_) { bind(); assert(end >= begin); GLenum mode = static_cast<GLenum>(mode_); GLsizei count = end - begin; GLvoid* offset = (GLvoid*)(getTypeSize(mIndexBufferType) * begin); if (mIndexBufferType == 0) glDrawArrays( mode, begin, count ); else glDrawRangeElements( mode, 0, mVertexBufferSize, count, mIndexBufferType, offset ); unbind(); } std::ostream& operator << (std::ostream& os, const ePrimitives& value) { switch (value) { case ePrimitives::POINTS: os << "points"; break; case ePrimitives::LINE_STRIP: os << "line strip"; break; case ePrimitives::LINE_LOOP: os << "line loop"; break; case ePrimitives::LINES: os << "lines"; break; case ePrimitives::LINE_STRIP_ADJACENCY: os << "line strip adjacency"; break; case ePrimitives::LINES_ADJACENCY: os << "lines adjacency"; break; case ePrimitives::TRIANGLE_STRIP: os << "triangle strip"; break; case ePrimitives::TRIANGLE_FAN: os << "triangle fan"; break; case ePrimitives::TRIANGLES: os << "triangles"; break; case ePrimitives::TRIANGLE_STRIP_ADJACENCY: os << "triangle strip adjacency"; break; case ePrimitives::TRIANGLES_ADJACENCY: os << "triangles adjacency"; break; case ePrimitives::PATCHES: os << "patches"; break; default: os << "Unknown primitive type: " << static_cast<std::underlying_type<ePrimitives>::type>(value); } return os; } } }
24.508621
101
0.624692
[ "render" ]
fce646e8d47c2cf5e82bef8f649043316e4944e6
5,552
cpp
C++
IEProtLib/tf_ops/cc/src/compute_topo_dist.cpp
luwei0917/IEConv_proteins
9c79ea000c20088fa48234f1868e42883a9b5a21
[ "MIT" ]
24
2021-03-09T02:42:12.000Z
2022-03-25T23:48:14.000Z
IEProtLib/tf_ops/cc/src/compute_topo_dist.cpp
luwei0917/IEConv_proteins
9c79ea000c20088fa48234f1868e42883a9b5a21
[ "MIT" ]
1
2021-11-05T20:06:16.000Z
2021-11-05T20:06:16.000Z
IEProtLib/tf_ops/cc/src/compute_topo_dist.cpp
luwei0917/IEConv_proteins
9c79ea000c20088fa48234f1868e42883a9b5a21
[ "MIT" ]
8
2021-05-21T14:07:56.000Z
2022-01-24T09:52:42.000Z
///////////////////////////////////////////////////////////////////////////// /// \file compute_topo_dist.cpp /// /// \brief /// /// \copyright Copyright (c) 2020 Visual Computing group of Ulm University, /// Germany. See the LICENSE file at the top-level directory of /// this distribution. /// /// \author pedro hermosilla (pedro-1.hermosilla-casajus@uni-ulm.de) ///////////////////////////////////////////////////////////////////////////// #include "defines.hpp" #include "tf_utils.hpp" #include "tf_gpu_device.hpp" #include "compute_topo_dist.cuh" /** * Declaration of the tensorflow operations. */ REGISTER_OP("ComputeTopoDist") .Input("points: float32") .Input("neighbors: int32") .Input("topology: int32") .Input("sample_topo_start_indices: int32") .Output("dists: float32") .Attr("max_dist: float") .Attr("const_edge: int") .SetShapeFn([](shape_inference::InferenceContext* pIC) { shape_inference::ShapeHandle outputDims = pIC->MakeShape({pIC->Dim(pIC->input(1), 0)}); pIC->set_output(0, outputDims); return Status::OK(); }); namespace mccnn{ /** * Operation to compute the distance along the graph * topology. */ class ComputeTopoDistOp: public OpKernel{ public: /** * Constructor. * @param pContext Constructor context of the operation. */ explicit ComputeTopoDistOp( OpKernelConstruction* pContext) :OpKernel(pContext){ OP_REQUIRES_OK(pContext, pContext->GetAttr("max_dist", &maxDist_)); OP_REQUIRES(pContext, maxDist_ > 0.0, errors::InvalidArgument("ComputeTopoDist requires positive max distance.")); int constEdge; OP_REQUIRES_OK(pContext, pContext->GetAttr("const_edge", &constEdge)); OP_REQUIRES(pContext, constEdge == 0 || constEdge == 1, errors::InvalidArgument("ComputeTopoDist requires const_edge equal to 1 or 0.")); constEdge_ = constEdge == 1; } /** * Method to compute the operation. * @param pContext Context of the operation. */ void Compute(OpKernelContext * pContext) override{ //Get the input tensors. const Tensor& inPts = pContext->input(0); const Tensor& inNeighbors = pContext->input(1); const Tensor& inTopology = pContext->input(2); const Tensor& inSampleTopoStartIndices = pContext->input(3); //Get variables from tensors. unsigned int numPts = inPts.shape().dim_size(0); unsigned int numSamples = inSampleTopoStartIndices.shape().dim_size(0); unsigned int numNeighbors = inNeighbors.shape().dim_size(0); unsigned int numDimensions = inPts.shape().dim_size(1); unsigned int numTopoNeighs = inTopology.shape().dim_size(0); //Get the pointers to GPU data from the tensors. const float* ptsGPUPtr = mccnn::tensorflow_utils::get_const_tensor_pointer<float>(inPts); const int* neighborsGPUPtr = mccnn::tensorflow_utils::get_const_tensor_pointer<int>(inNeighbors); const int* topoGPUPtr = mccnn::tensorflow_utils::get_const_tensor_pointer<int>(inTopology); const int* sampleTopoIGPUPtr = mccnn::tensorflow_utils::get_const_tensor_pointer<int>(inSampleTopoStartIndices); //Check for the correctness of the input. if(!constEdge_){ OP_REQUIRES(pContext, numSamples == numPts, errors::InvalidArgument("ComputeTopoDist expects the same points as samples.")); } OP_REQUIRES(pContext, numDimensions >= MIN_DIMENSIONS && numDimensions <= MAX_DIMENSIONS, errors::InvalidArgument("ComputeTopoDist expects a valid number of dimension")); OP_REQUIRES(pContext, inNeighbors.dims() == 2 && inNeighbors.shape().dim_size(1) == 2, errors::InvalidArgument("ComputeTopoDist expects a neighbor tensor with 2 dimensions " "and 2 indices per neighbor.")); //Get the gpu device. std::unique_ptr<mccnn::IGPUDevice> gpuDevice = make_unique<mccnn::TFGPUDevice>(pContext); //Create the output tensor. float* outputGPUPtr = nullptr; TensorShape outShape = TensorShape{numNeighbors}; OP_REQUIRES_OK(pContext, mccnn::tensorflow_utils::allocate_output_tensor<float> (0, pContext, outShape, &outputGPUPtr)); //Compute the distances along the topology. DIMENSION_SWITCH_CALL(numDimensions, mccnn::compute_topo_dist_gpu, gpuDevice, constEdge_, maxDist_, numSamples, numNeighbors, ptsGPUPtr, neighborsGPUPtr, topoGPUPtr, sampleTopoIGPUPtr, outputGPUPtr); } private: /**Maximum distance.*/ float maxDist_; /**Boolean that indicates if we use a constant value for the edge.*/ bool constEdge_; }; } REGISTER_KERNEL_BUILDER(Name("ComputeTopoDist").Device(DEVICE_GPU), mccnn::ComputeTopoDistOp);
43.716535
128
0.576189
[ "shape" ]
fce6dca6b07d5475c496132647763205936eb58c
1,804
cpp
C++
src/sources/Pinky.cpp
Mobiletainment/Pacman-DirectX-ClanLib
2e9490d3dc0e46e21d78b3351b4caf1efaaa4c9a
[ "MIT", "Unlicense" ]
2
2015-07-11T08:49:38.000Z
2018-06-17T08:13:52.000Z
src/sources/Pinky.cpp
Mobiletainment/Pacman-DirectX-ClanLib
2e9490d3dc0e46e21d78b3351b4caf1efaaa4c9a
[ "MIT", "Unlicense" ]
null
null
null
src/sources/Pinky.cpp
Mobiletainment/Pacman-DirectX-ClanLib
2e9490d3dc0e46e21d78b3351b4caf1efaaa4c9a
[ "MIT", "Unlicense" ]
null
null
null
#include "precomp.h" #include "Pinky.h" #include "Game.h" using namespace KI; Pinky::Pinky(CL_GraphicContext& gc, Tile* startingTile): Ghost(gc, startingTile) { SetFrames(2, 3); patrolTiles[0] = Game::Level->GetTileForSpeedy(); patrolTiles[1] = Game::Level->GetTileAtGridPosition(6,5); _targetTile = patrolTiles[1]; SetCurrentDirection(None); } void Pinky::Update() { Ghost::Update(); } void Pinky::CalculatePursuitTarget() //the place that is four grid spaces ahead of Pacman in the direction that Pac-Man is facing. { Direction direction = Game::Pacman->CurrentDirection(); //Get the direction Pacman is looking /* ////Alternatively, instead of Virtual Targets, we could navigate to real targets, but we have to check if the target is out of bounds _targetTile = Game::Pacman->CurrentTile(); for (int i = 0; i < 4; ++i) //avoid position that do not exist { Tile *nextTile = _targetTile->GetNeighbor(direction); if (nextTile == NULL || nextTile == Game::Level->GetTileForExitLeft() || nextTile == Game::Level->GetTileForExitRight()) break; _targetTile = nextTile; } */ //2nd Method: CL_Pointf pacmanPos = *Game::Pacman->CurrentTile()->Position; float pointAhead = Tile::TileSize * 4; //length of 4 Tiles switch (direction) { case Left: pacmanPos.x -= pointAhead; //4 Grid spaces left of pacman break; case Right: pacmanPos.x += pointAhead; //4 Grid spaces right of pacman break; case Top: pacmanPos.y -= pointAhead; //4 Grid spaces above pacman break; case Bottom: pacmanPos.y += pointAhead; //4 Grid spaces below pacman break; } //create a "Virtual" Target Object for the position that Pinky should move to targetPosition = pacmanPos; virtualTarget.Position = &targetPosition; _targetTile = &virtualTarget; } Pinky::~Pinky(void) { }
26.529412
135
0.711197
[ "object" ]
fcf0734ae5fdd20abcf91a2a2d32bf2bec78c852
5,811
cpp
C++
src/mandelbrot/mandelbrot.cpp
Toxe/mandelbrot-sfml-imgui
e9375290a475a264c5b57e7678851ffae752d3b0
[ "MIT" ]
6
2021-04-14T15:49:46.000Z
2022-03-05T12:39:31.000Z
src/mandelbrot/mandelbrot.cpp
Toxe/mandelbrot-sfml-imgui
e9375290a475a264c5b57e7678851ffae752d3b0
[ "MIT" ]
null
null
null
src/mandelbrot/mandelbrot.cpp
Toxe/mandelbrot-sfml-imgui
e9375290a475a264c5b57e7678851ffae752d3b0
[ "MIT" ]
null
null
null
#include "mandelbrot.h" #include <algorithm> #include <cassert> #include <cmath> #include <numeric> #include <SFML/Graphics/Color.hpp> void mandelbrot_calc(const ImageSize& image, const FractalSection& section, const int max_iterations, std::vector<CalculationResult>& results_per_point, const CalculationArea& area) noexcept { const double width = section.height * (static_cast<double>(image.width) / static_cast<double>(image.height)); const double x_left = section.center_x - width / 2.0; const double x_right = section.center_x + width / 2.0; const double y_top = section.center_y + section.height / 2.0; const double y_bottom = section.center_y - section.height / 2.0; constexpr double bailout = 20.0; constexpr double bailout_squared = bailout * bailout; const double log_log_bailout = std::log(std::log(bailout)); const double log_2 = std::log(2.0); double final_magnitude = 0.0; for (int pixel_y = area.y; pixel_y < (area.y + area.height); ++pixel_y) { const double y0 = std::lerp(y_top, y_bottom, static_cast<double>(pixel_y) / static_cast<double>(image.height)); for (int pixel_x = area.x; pixel_x < (area.x + area.width); ++pixel_x) { const double x0 = std::lerp(x_left, x_right, static_cast<double>(pixel_x) / static_cast<double>(image.width)); double x = 0.0; double y = 0.0; // iteration, will be from 1 .. max_iterations once the loop is done int iter = 0; while (iter < max_iterations) { const double x_squared = x * x; const double y_squared = y * y; if (x_squared + y_squared >= bailout_squared) { final_magnitude = std::sqrt(x_squared + y_squared); break; } const double xtemp = x_squared - y_squared + x0; y = 2.0 * x * y + y0; x = xtemp; ++iter; } const std::size_t pixel = static_cast<std::size_t>(pixel_y * image.width + pixel_x); if (iter < max_iterations) results_per_point[pixel] = CalculationResult{iter, 1.0f - std::min(1.0f, static_cast<float>((std::log(std::log(final_magnitude)) - log_log_bailout) / log_2))}; else results_per_point[pixel] = CalculationResult{iter, 0.0}; } } } void equalize_histogram(const std::vector<int>& iterations_histogram, const int max_iterations, std::vector<float>& equalized_iterations) { assert(iterations_histogram.size() == equalized_iterations.size()); // Calculate the CDF (Cumulative Distribution Function) by accumulating all iteration counts. // Element [0] is unused and iterations_histogram[max_iterations] should be zero (as we do not count // the iterations of the points inside the Mandelbrot Set). std::vector<int> cdf(iterations_histogram.size()); std::partial_sum(iterations_histogram.cbegin(), iterations_histogram.cend(), cdf.begin()); // Get the minimum value in the CDF that is bigger than zero and the sum of all iteration counts // from iterations_histogram (which is the last value of the CDF). const auto cdf_min = std::find_if(cdf.cbegin(), cdf.cend(), [](auto n) { return n > 0; }); const auto total_iterations = cdf.back(); // normalize all values from the CDF that are bigger than zero to a range of 0.0 .. max_iterations const auto f = static_cast<float>(max_iterations) / static_cast<float>(total_iterations - *cdf_min); std::transform(cdf.cbegin(), cdf.cend(), equalized_iterations.begin(), [=](const auto& c) { return c > 0 ? f * static_cast<float>(c - *cdf_min) : 0.0f; }); } void mandelbrot_colorize(WorkerColorize& colorize) noexcept { for (int y = colorize.start_row; y < (colorize.start_row + colorize.num_rows); ++y) { auto point = colorize.results_per_point->cbegin() + (y * colorize.row_width); for (int x = 0; x < colorize.row_width; ++x) { std::size_t p = static_cast<std::size_t>(4 * (y * colorize.row_width + x)); if (point->iter == colorize.max_iterations) { // points inside the Mandelbrot Set are always painted black (*colorize.colorization_buffer)[p++] = 0; (*colorize.colorization_buffer)[p++] = 0; (*colorize.colorization_buffer)[p++] = 0; (*colorize.colorization_buffer)[p++] = 255; } else { // The equalized iteration value (in the range of 0 .. max_iterations) represents the // position of the pixel color in the color gradiant and needs to be mapped to 0.0 .. 1.0. // To achieve smooth coloring we need to edge the equalized iteration towards the next // iteration, determined by the distance between the two iterations. const auto iter_curr = (*colorize.equalized_iterations)[static_cast<std::size_t>(point->iter)]; const auto iter_next = (*colorize.equalized_iterations)[static_cast<std::size_t>(point->iter + 1)]; const auto smoothed_iteration = std::lerp(iter_curr, iter_next, point->distance_to_next_iteration); const auto pos_in_gradient = smoothed_iteration / static_cast<float>(colorize.max_iterations); const auto color = color_from_gradient(*colorize.gradient, pos_in_gradient); (*colorize.colorization_buffer)[p++] = color.r; (*colorize.colorization_buffer)[p++] = color.g; (*colorize.colorization_buffer)[p++] = color.b; (*colorize.colorization_buffer)[p++] = color.a; } ++point; } } }
47.243902
175
0.627087
[ "vector", "transform" ]
fcfa1550d0350037a169480db54e2b5b8e9ef3e4
5,920
hpp
C++
src/collision_tensor/dense/multi_slices_factory.hpp
simonpp/2dBoltzmann
bc6b7bbeffa242ce80937947444383b416ba3fc9
[ "BSD-3-Clause" ]
null
null
null
src/collision_tensor/dense/multi_slices_factory.hpp
simonpp/2dBoltzmann
bc6b7bbeffa242ce80937947444383b416ba3fc9
[ "BSD-3-Clause" ]
null
null
null
src/collision_tensor/dense/multi_slices_factory.hpp
simonpp/2dBoltzmann
bc6b7bbeffa242ce80937947444383b416ba3fc9
[ "BSD-3-Clause" ]
null
null
null
#pragma once #include <boost/mpl/at.hpp> #include <cassert> #include <cstdio> #include <functional> #include <iostream> #include "aux/filtered_range.hpp" #include "spectral/basis/toolbox/spectral_basis.hpp" #include "storage/multi_slice.hpp" namespace boltzmann { namespace ct_dense { class multi_slices_factory { public: typedef MultiSlice::index_type index_type; // typedef std::tuple<enum TRIG, index_type> key_t; /// key: (angular frequency, _sin_ or _cos_) typedef std::tuple<index_type, enum TRIG> key_t; typedef unsigned int size_type; typedef std::map<key_t, MultiSlice> container_t; public: template <typename BASIS> static void create(container_t& data, const BASIS& basis); }; template <typename BASIS> void multi_slices_factory::create(container_t& data, const BASIS& basis) { typedef std::map<key_t, MultiSlice> container_t; typedef typename BASIS::elem_t elem_t; typedef typename boost::mpl::at_c<typename elem_t::types_t, 0>::type fa_type; typedef typename boost::mpl::at_c<typename elem_t::types_t, 1>::type fr_type; // typename elem_t::Acc::template get<fr_type> fr_accessor; typename elem_t::Acc::template get<fa_type> fa_accessor; const index_type L = spectral::get_max_l(basis); const size_type N = basis.n_dofs(); for (auto elem = basis.begin(); elem != basis.end(); elem++) { auto ang_elem = fa_accessor(*elem); const int l = ang_elem.get_id().l; const enum TRIG t = (TRIG)ang_elem.get_id().t; // key_t key(t, l); key_t key(l, t); if (data.find(key) != data.end()) continue; // this element is already done typedef std::vector<std::pair<index_type, index_type> > line_t; // line 1 (first line) line_t line1; for (index_type l1 = 0; l1 < l + 1; ++l1) { assert(l - l1 >= 0); line1.push_back(std::make_pair(l1, l - l1)); } // line 2 (lower diagonal) line_t line2; for (index_type l1 = l + 1; l1 <= L; ++l1) { line2.push_back(std::make_pair(l1, l1 - l)); } // line 3 (upper diagonal) line_t line3; if (l > 0) { // hint: if l==0, line2 and line3 are the same for (index_type l1 = 1; l1 <= L - l; ++l1) { line3.push_back(std::make_pair(l1, l1 + l)); } } auto cmp = [&fa_accessor](const elem_t& e, index_type l, enum TRIG t) { auto id = fa_accessor(e).get_id(); return (id.l == l && TRIG(id.t) == t); }; // ---------- add lines to data, compute offsets and block sizes ---------- // find all elements with given (l, t)-values auto range_z = filtered_range(basis.begin(), basis.end(), std::bind(cmp, std::placeholders::_1, l, t)); std::vector<elem_t> elemsz(std::get<0>(range_z), std::get<1>(range_z)); size_type size_z = elemsz.size(); MultiSlice current_mslice(t, l, N); auto add_line = [&](const line_t& line) { // process lines for (auto pair : line) { // l1 <-> row const index_type l1 = pair.first; // l2 <-> column const index_type l2 = pair.second; // enum TRIG t1; // enum TRIG t2; auto add_range = [&](const std::vector<elem_t>& x, const std::vector<elem_t>& y) { if (x.size() == 0 || y.size() == 0) return; // nothing to do size_type offset_x = basis.get_dof_index(x.begin()->get_id()); size_type size_x = basis.get_dof_index(x.rbegin()->get_id()) - offset_x + 1; assert(size_x == x.size()); size_type offset_y = basis.get_dof_index(y.begin()->get_id()); size_type size_y = basis.get_dof_index(y.rbegin()->get_id()) - offset_y + 1; assert(size_y == y.size()); assert(size_x > 0 && size_y > 0); enum TRIG t1 = TRIG(fa_accessor(x[0]).get_id().t); enum TRIG t2 = TRIG(fa_accessor(y[0]).get_id().t); current_mslice.add_block(l1, t1, l2, t2, offset_x, offset_y, size_x, size_y, size_z); }; if (t == TRIG::COS) { // Note: range should be contiguous in ordering of elements (this is not ensured here!!) // add range1 auto range1x = filteredv( basis.begin(), basis.end(), std::bind(cmp, std::placeholders::_1, l1, TRIG::COS)); auto range1y = filteredv( basis.begin(), basis.end(), std::bind(cmp, std::placeholders::_1, l2, TRIG::COS)); // aka add block (l1, cos) x (l2, cos) to multi_slice add_range(range1x, range1y); auto range2x = filteredv( basis.begin(), basis.end(), std::bind(cmp, std::placeholders::_1, l1, TRIG::SIN)); auto range2y = filteredv( basis.begin(), basis.end(), std::bind(cmp, std::placeholders::_1, l2, TRIG::SIN)); add_range(range2x, range2y); } else if (t == TRIG::SIN) { // add range1 auto range1x = filteredv( basis.begin(), basis.end(), std::bind(cmp, std::placeholders::_1, l1, TRIG::COS)); auto range1y = filteredv( basis.begin(), basis.end(), std::bind(cmp, std::placeholders::_1, l2, TRIG::SIN)); add_range(range1x, range1y); // add range2 auto range2x = filteredv( basis.begin(), basis.end(), std::bind(cmp, std::placeholders::_1, l1, TRIG::SIN)); auto range2y = filteredv( basis.begin(), basis.end(), std::bind(cmp, std::placeholders::_1, l2, TRIG::COS)); add_range(range2x, range2y); } } }; add_line(line1); add_line(line2); add_line(line3); current_mslice.finalize(); #ifdef DEBUG std::printf("MultiSlice finished\n\tStats: (l=%3d, t=%3d), size: %6d, blocks: %3d\n", l, int(t), current_mslice.size(), current_mslice.nblocks()); #endif // insert mslice into map data[key] = current_mslice; } } } // ct_dense } // end namespace boltzmann
35.878788
98
0.596284
[ "vector", "3d" ]
fcfa3028b731563c508c370b313e54e4be39b919
4,246
hpp
C++
miniapps/pnp/utils/NonlinearConvection_Integrator.hpp
fanronghong/mfem
5bc8d5ea1b7e3a0b377423773e78428bf7160612
[ "BSD-3-Clause" ]
1
2020-04-28T05:08:24.000Z
2020-04-28T05:08:24.000Z
miniapps/pnp/utils/NonlinearConvection_Integrator.hpp
fanronghong/mfem
5bc8d5ea1b7e3a0b377423773e78428bf7160612
[ "BSD-3-Clause" ]
null
null
null
miniapps/pnp/utils/NonlinearConvection_Integrator.hpp
fanronghong/mfem
5bc8d5ea1b7e3a0b377423773e78428bf7160612
[ "BSD-3-Clause" ]
null
null
null
#ifndef _NONLINEAERCONVECTION_INTEGRATOR_HPP_ #define _NONLINEAERCONVECTION_INTEGRATOR_HPP_ #include "mfem.hpp" #include <iostream> using namespace mfem; using namespace std; // Convective nonlinear term: N(u,u,v) = (u \cdot \nabla u, v), u,v都是向量型的 class VectorConvectionNLFIntegrator : public NonlinearFormIntegrator { private: Coefficient *Q; DenseMatrix dshape, dshapex, EF, gradEF, ELV, elmat_comp; Vector shape; public: VectorConvectionNLFIntegrator(Coefficient &q) : Q(&q) {} VectorConvectionNLFIntegrator() = default; void AssembleElementVector(const FiniteElement &el, ElementTransformation &trans, const Vector &elfun, Vector &elvect) { int nd = el.GetDof(); int dim = el.GetDim(); shape.SetSize(nd); //shape是Vector dshape.SetSize(nd, dim); elvect.SetSize(nd * dim); gradEF.SetSize(dim); EF.UseExternalData(elfun.GetData(), nd, dim); ELV.UseExternalData(elvect.GetData(), nd, dim); double w; Vector vec1(dim), vec2(dim); const IntegrationRule *ir = IntRule; if (ir == nullptr) { int order = 2 * el.GetOrder() + trans.OrderGrad(&el); ir = &IntRules.Get(el.GetGeomType(), order); } // Same as elvect = 0.0; ELV = 0.0; for (int i = 0; i < ir->GetNPoints(); i++) { const IntegrationPoint &ip = ir->IntPoint(i); trans.SetIntPoint(&ip); el.CalcShape(ip, shape); el.CalcPhysDShape(trans, dshape); w = ip.weight * trans.Weight(); if (Q) { w *= Q->Eval(trans, ip); } MultAtB(EF, dshape, gradEF); // EF^t * dshape --> gradEF EF.MultTranspose(shape, vec1); // EF^t * shape --> vec1 gradEF.Mult(vec1, vec2); vec2 *= w; AddMultVWt(shape, vec2, ELV); } } void AssembleElementGrad(const FiniteElement &el, ElementTransformation &trans, const Vector &elfun, DenseMatrix &elmat) { int nd = el.GetDof(); int dim = el.GetDim(); shape.SetSize(nd); dshape.SetSize(nd, dim); dshapex.SetSize(nd, dim); elmat.SetSize(nd * dim); elmat_comp.SetSize(nd); gradEF.SetSize(dim); EF.UseExternalData(elfun.GetData(), nd, dim); double w; Vector vec1(dim), vec2(dim), vec3(nd); const IntegrationRule *ir = IntRule; if (ir == nullptr) { int order = 2 * el.GetOrder() + trans.OrderGrad(&el); ir = &IntRules.Get(el.GetGeomType(), order); } elmat = 0.0; for (int i = 0; i < ir->GetNPoints(); i++) { const IntegrationPoint &ip = ir->IntPoint(i); trans.SetIntPoint(&ip); el.CalcShape(ip, shape); el.CalcDShape(ip, dshape); Mult(dshape, trans.InverseJacobian(), dshapex); w = ip.weight; if (Q) { w *= Q->Eval(trans, ip); } MultAtB(EF, dshapex, gradEF); EF.MultTranspose(shape, vec1); trans.AdjugateJacobian().Mult(vec1, vec2); vec2 *= w; dshape.Mult(vec2, vec3); MultVWt(shape, vec3, elmat_comp); for (int i = 0; i < dim; i++) { elmat.AddMatrix(elmat_comp, i * nd, i * nd); } MultVVt(shape, elmat_comp); w = ip.weight * trans.Weight(); if (Q) { w *= Q->Eval(trans, ip); } for (int i = 0; i < dim; i++) { for (int j = 0; j < dim; j++) { elmat.AddMatrix(w * gradEF(i, j), elmat_comp, i * nd, j * nd); } } } } }; void Test_NonlinearConvection_Integrator() { cout << "===> Test Pass: NonlinearConvection_Integrator.hpp" << endl; } #endif
27.044586
81
0.492228
[ "shape", "vector" ]
fcfb292069ef0b2bf56e8d836ab0e7cdada41bec
1,765
cpp
C++
refgen/crefgen/tests/costtest.cpp
chipscal/refgen
c59ee977b87a2cf7b2e56c1ef794ee11a93ddcf1
[ "MIT" ]
1
2020-10-11T15:25:05.000Z
2020-10-11T15:25:05.000Z
refgen/crefgen/tests/costtest.cpp
chipscal/refgen
c59ee977b87a2cf7b2e56c1ef794ee11a93ddcf1
[ "MIT" ]
null
null
null
refgen/crefgen/tests/costtest.cpp
chipscal/refgen
c59ee977b87a2cf7b2e56c1ef794ee11a93ddcf1
[ "MIT" ]
1
2020-12-12T19:44:57.000Z
2020-12-12T19:44:57.000Z
/**************************************************************************** * Author: Luca Calacci * * Company: Universita' degli studi di Roma - Tor Vergata * * Email: luca.calacci@gmail.com * * * ****************************************************************************/ #define XTENSOR_USE_XSIMD #include "crefgen/costfnc.h" #include "c_api_comm.h" #include <xtensor/xarray.hpp> #include <xtensor/xnoalias.hpp> #include <xtensor/xnorm.hpp> #include <chrono> #include <iostream> int main(void) { std::cout << "ciaooooo\n"; float *neigh = new float[8]; size_t *shape = new size_t[2]{ 2, 4 }; auto xneigh = xtc::xarray_map_raw<float>(neigh, shape, 2); std::cout << "map\n"; //xneigh = xt::zeros<double>({ 2, 4 }); //std::cout << "zeros\n"; xneigh(0, 0) = 0; xneigh(1, 0) = 0; xneigh(0, 1) = -1; xneigh(1, 1) = -1; xneigh(0, 2) = 1; xneigh(1, 2) = 1; xneigh(0, 3) = 5; xneigh(1, 3) = 2; std::cout << "init\n"; for (int k = 0; k < 8; k++) { std::cout << neigh[k] << " "; } rg::costParamV2<float> ciao; ciao.alpha_slow = 0.1f; ciao.ni1 = 0; ciao.ni2 = 0; ciao.r1 = 3; ciao.r2 = 0.2f; ciao.min_alpha_gauss = 30; ciao.D_gauss = 2.0f; ciao.data_raw.data =(char *) neigh; ciao.data_raw.shape = shape; ciao.data_raw.rank = 2; float val; auto t1 = std::chrono::high_resolution_clock::now(); for (int k = 0; k < 200; k++) val = rg::costfncV2<float>(xt::zeros<float>({ 2, 1 }), &ciao); auto t2 = std::chrono::high_resolution_clock::now(); std::cout << "val: " << val << std::endl; auto time_span = std::chrono::duration_cast<std::chrono::duration<double>>(t2 - t1); std::cout << "It took me " << time_span.count() << " seconds.\n"; int fine; std::cin >> fine; }
23.223684
85
0.539377
[ "shape" ]
fcff8b67e80b2ae8778ffad4d9150a52f8bc45e4
1,336
cpp
C++
Binary tree/Iterative_Postorder_Traversal.cpp
linyos/GreekForGeeks-Practice
eaabce3ac9e45a86dfb28f2296129c2016e570bf
[ "MIT" ]
null
null
null
Binary tree/Iterative_Postorder_Traversal.cpp
linyos/GreekForGeeks-Practice
eaabce3ac9e45a86dfb28f2296129c2016e570bf
[ "MIT" ]
null
null
null
Binary tree/Iterative_Postorder_Traversal.cpp
linyos/GreekForGeeks-Practice
eaabce3ac9e45a86dfb28f2296129c2016e570bf
[ "MIT" ]
null
null
null
#include <iostream> #include <vector> #include <set> #include <algorithm> #include <map> #include <unordered_set> #include <time.h> #include <string> #include <math.h> #include <vector> #include <queue> #include <stack> using namespace std; /// Using Two Stack class node { public: int data; node * left, * right ; node * next; node():left(0),right(0),next(0),data(0){}; node(int d):left(0) ,right(0),next(0),data(d){}; }; void postOrderIterative(node* root){ if (root==NULL){ return ; } // Create two stack stack<node *> s1 ,s2; // push root to first stack s1.push(root); node * Node ; // Run while first stack is not empty while (!s1.empty()){ // Pop an item form s1 and push it to s2 Node = s1.top(); s1.pop(); s2.push(Node); // push left and right children of removed item to s1 if (Node->left){ s1.push(Node->left); } if (Node->right){ s1.push(Node->right); } } //Print all elements of scoend stack while (!s2.empty()){ Node = s2.top(); s2.pop(); cout << Node->data << " "; } } int main(){ node * root = new node(1); root->left = new node(2); root->right= new node(3); root->left->left = new node(4); root ->left->right = new node(5); root->right->left= new node(6); root->right->right= new node(7); postOrderIterative(root); system("pause"); return 0 ; }
16.911392
55
0.618263
[ "vector" ]
1e09e44e6abe7d8c9093450dd3fc64712c7acd1a
11,183
cc
C++
xt_base/ginterf/rgbzimg.cc
wrcad/xictools
f46ba6d42801426739cc8b2940a809b74f1641e2
[ "Apache-2.0" ]
73
2017-10-26T12:40:24.000Z
2022-03-02T16:59:43.000Z
xt_base/ginterf/rgbzimg.cc
chris-ayala/xictools
4ea72c118679caed700dab3d49a8d36445acaec3
[ "Apache-2.0" ]
12
2017-11-01T10:18:22.000Z
2022-03-20T19:35:36.000Z
xt_base/ginterf/rgbzimg.cc
chris-ayala/xictools
4ea72c118679caed700dab3d49a8d36445acaec3
[ "Apache-2.0" ]
34
2017-10-06T17:04:21.000Z
2022-02-18T16:22:03.000Z
/*========================================================================* * * * Distributed by Whiteley Research Inc., Sunnyvale, California, USA * * http://wrcad.com * * Copyright (C) 2017 Whiteley Research Inc., all rights reserved. * * Author: Stephen R. Whiteley, except as indicated. * * * * As fully as possible recognizing licensing terms and conditions * * imposed by earlier work from which this work was derived, if any, * * this work is released under the Apache License, Version 2.0 (the * * "License"). You may not use this file except in compliance with * * the License, and compliance with inherited licenses which are * * specified in a sub-header below this one if applicable. A copy * * of the License is provided with this distribution, or you may * * obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * See the License for the specific language governing permissions * * and limitations under the License. * * * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON- * * INFRINGEMENT. IN NO EVENT SHALL WHITELEY RESEARCH INCORPORATED * * OR STEPHEN R. WHITELEY BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE * * USE OR OTHER DEALINGS IN THE SOFTWARE. * * * *========================================================================* * XicTools Integrated Circuit Design System * * * * Ginterf Graphical Interface Library * * * *========================================================================* $Id:$ *========================================================================*/ #include "config.h" #include <stdio.h> #include <math.h> #include "rgbzimg.h" #include "grfont.h" #include "polydecomp.h" #ifndef M_PI #define M_PI 3.14159265358979323846 // pi #endif #define swap(a, b) {int t=a; a=b; b=t;} // Draw pixel function. // void RGBzimg::Pixel(int x, int y) { if (y < 0 || y >= rz_dev->height || x < 0 || x >= rz_dev->width) return; DrawPixel(y*rz_dev->width + x); } // Draw multiple pixels. // void RGBzimg::Pixels(GRmultiPt *data, int n) { if (n < 1) return; data->data_ptr_init(); while (n--) { int x = data->data_ptr_x(); int y = data->data_ptr_y(); data->data_ptr_inc(); if (y < 0 || y >= rz_dev->height || x < 0 || x >= rz_dev->width) continue; DrawPixel(y*rz_dev->width + x); } } #define ror(b) b >>= 1; if (!b) b = 0x80 #define rorl(b, p) b >>= 1; if (!b) b = 1 << (p-1) // Draw line function. // void RGBzimg::Line(int x1, int y1, int x2, int y2) { if (rz_dev->LineClip(&x1, &y1, &x2, &y2)) return; if (x2 < x1) { swap(x1, x2); swap(y1, y2); } int dx = x2 - x1; int dy = y2 - y1; int lcnt = y1; int next = rz_dev->width; int offs = lcnt*next + x1; if (y1 > y2) { next = -next; dy = -dy; } int dy2 = dy; unsigned right = rz_cur_ls; if (!right) right = 0xff; unsigned left; int cnt; for (left = right, cnt = 0; left; left >>= 1, cnt++) ; left = 1 << (cnt - 1 - (lcnt + x1)%cnt); int errterm = -dx >> 1; for (dy++; dy; dy--) { errterm += dx; if (errterm <= 0) { if (left & right) DrawPixel(offs); offs += next; rorl(left, cnt); continue; } while (errterm > 0 && x1 != x2) { if (left & right) DrawPixel(offs); offs++; rorl(left, cnt); x1++; errterm -= dy2; } offs += next; } } // Draw a path. // void RGBzimg::PolyLine(GRmultiPt *data, int n) { if (n < 2) return; data->data_ptr_init(); n--; while (n--) { int x = data->data_ptr_x(); int y = data->data_ptr_y(); data->data_ptr_inc(); Line(x, y, data->data_ptr_x(), data->data_ptr_y()); } } // Draw multiple lines. // void RGBzimg::Lines(GRmultiPt *data, int n) { if (n < 1) return; data->data_ptr_init(); while (n--) { int x = data->data_ptr_x(); int y = data->data_ptr_y(); data->data_ptr_inc(); Line(x, y, data->data_ptr_x(), data->data_ptr_y()); data->data_ptr_inc(); } } // Draw a rectangle, possibly filled. // void RGBzimg::Box(int xl, int yl, int xu, int yu) { if (yu < yl) swap(yu, yl); if (xu < xl) swap(xu, xl); if (xl < 0) xl = 0; else if (xl >= rz_dev->width) return; if (xu > rz_dev->width - 1) xu = rz_dev->width - 1; else if (xu < 0) return; if (yl < 0) yl = 0; else if (yl >= rz_dev->height) return; if (yu > rz_dev->height - 1) yu = rz_dev->height - 1; else if (yu < 0) return; int lnum = yl; // The box includes the boundary points, so will cover a line // box with the same points. int dy = yu - yl + 1; int dx = xu - xl + 1; unsigned int offs = lnum*rz_dev->width + xl; int next = rz_dev->width - dx; if (!rz_cur_fp) { while (dy--) { int tx = dx; while (tx--) { DrawPixel(offs); offs++; } offs += next; } } else { const GRfillType *fpat = rz_cur_fp; while (dy--) { int tx = dx; unsigned int xo = xl; unsigned int yo = lnum++; fpat->initPixelScan(&xo, &yo); while (tx--) { if (fpat->getNextColPixel(&xo, yo)) DrawPixel(offs); offs++; } offs += next; } } } // Draw multiple boxes. // void RGBzimg::Boxes(GRmultiPt *data, int n) { if (n < 1) return; data->data_ptr_init(); while (n--) { int x = data->data_ptr_x(); int y = data->data_ptr_y(); data->data_ptr_inc(); int w = data->data_ptr_x(); int h = data->data_ptr_y(); data->data_ptr_inc(); Box(x, y, x + w - 1, y + h - 1); } } // Draw an arc. // void RGBzimg::Arc(int x, int y, int rx, int ry, double theta1, double theta2) { if (rx <= 0 || ry <= 0) return; while (theta1 >= theta2) theta2 = 2*M_PI + theta2; double dt = M_PI/100; int x0 = (int)(rx*cos(theta1)); int y0 = -(int)(ry*sin(theta1)); for (double ang = theta1 + dt; ang < theta2; ang += dt) { int x1 = (int)(rx*cos(ang)); int y1 = -(int)(ry*sin(ang)); Line(x+x0, y+y0, x+x1, y+y1); x0 = x1; y0 = y1; } Line(x+x0, y+y0, x+(int)(rx*cos(theta2)), y-(int)(ry*sin(theta2))); } // Draw a polygon, possibly filled. // void RGBzimg::Polygon(GRmultiPt *data, int num) { poly_decomp::instance().polygon(this, data, num); } // Draw a trapezoid. // void RGBzimg::Zoid(int yl, int yu, int xll, int xul, int xlr, int xur) { if (yl >= rz_dev->height || yu < 0) return; int dy = yu - yl; int offs0 = yl*rz_dev->width; int dx1 = xul - xll; int dx2 = xlr - xur; int s1 = 1; int s2 = -1; if (xll >= xul) { dx1 = -dx1; s1 = -1; } if (xur >= xlr) { dx2 = -dx2; s2 = 1; } int errterm1 = -dx1 >> 1; int errterm2 = -dx2 >> 1; if (!rz_cur_fp) { for (int y = yl; y <= yu; y++) { if (y >= 0 && y < rz_dev->height) { int xstrt = xll >= 0 ? xll : 0; int offs = offs0 + xstrt; int xend = xlr + 1; if (xend > rz_dev->width) xend = rz_dev->width; for (int x = xstrt; x < xend; x++) { DrawPixel(offs); offs++; } } offs0 += rz_dev->width; errterm1 += dx1; errterm2 += dx2; while (errterm1 > 0 && xul != xll) { errterm1 -= dy; xll += s1; } while (errterm2 > 0 && xlr != xur) { errterm2 -= dy; xlr += s2; } } } else { const GRfillType *fpat = rz_cur_fp; for (int y = yl; y <= yu; y++) { if (y >= 0 && y < rz_dev->height) { int xstrt = xll >= 0 ? xll : 0; int offs = offs0 + xstrt; int xend = xlr + 1; if (xend > rz_dev->width) xend = rz_dev->width; unsigned int xo = xstrt; unsigned int yo = y; fpat->initPixelScan(&xo, &yo); for (int x = xstrt; x < xend; x++) { if (fpat->getNextColPixel(&xo, yo)) DrawPixel(offs); offs++; } } offs0 += rz_dev->width; errterm1 += dx1; errterm2 += dx2; while (errterm1 > 0 && xul != xll) { errterm1 -= dy; xll += s1; } while (errterm2 > 0 && xlr != xur) { errterm2 -= dy; xlr += s2; } } } } // Render a text string. We don't handle transforms here. // void RGBzimg::Text(const char *text, int x, int y, int xform, int width, int height) { if (!width || !height) return; int lwid, lhei, numlines; FT.textExtent(text, &lwid, &lhei, &numlines); int w, h; if (width > 0 && height > 0) { w = width/lwid; h = height/lhei; } else { w = (int)(lwid*rz_text_scale); h = (int)(lhei*rz_text_scale); } FT.renderText(this, text, x, y, xform, w, h); } // Get the pixel extent of string. // void RGBzimg::TextExtent(const char *text, int *x, int *y) { int lwid, lhei, lnum; FT.textExtent(text, &lwid, &lhei, &lnum); *x = (int)(lwid*rz_text_scale); *y = (int)(lhei*rz_text_scale); }
27.27561
76
0.438612
[ "render" ]
1f6ada6d407023135b346d9da78f4b0945c97804
17,796
cpp
C++
main.cpp
nsf/cppmandel
d43386822522a418a7a7a9c7ade658edf20b612c
[ "MIT" ]
3
2017-11-21T18:26:31.000Z
2018-09-06T07:08:36.000Z
main.cpp
nsf/cppmandel
d43386822522a418a7a7a9c7ade658edf20b612c
[ "MIT" ]
null
null
null
main.cpp
nsf/cppmandel
d43386822522a418a7a7a9c7ade658edf20b612c
[ "MIT" ]
2
2017-11-26T07:42:02.000Z
2021-06-18T12:35:06.000Z
#include "Core/BitArray.h" #include "Core/UniquePtr.h" #include "Core/Vector.h" #include "Math/Color.h" #include "Math/Rect.h" #include "Math/Utils.h" #include "Math/Vec.h" #include "OS/AsyncQueue.h" #include <complex> #include <experimental/coroutine> #include <initializer_list> #include <SDL2/SDL_opengl.h> #include <SDL2/SDL.h> #include <stdio.h> namespace stdx = std::experimental; using CoroutineHandle = stdx::coroutine_handle<>; using CoroutineQueue = AsyncQueue<CoroutineHandle>; UniquePtr<CoroutineQueue> globalQueue; UniquePtr<CoroutineQueue> mainThreadQueue; struct Awaiter { Awaiter() = default; Awaiter(CoroutineHandle coro, std::atomic<int> *count = nullptr): coro(coro), count(count) {} void push_or_destroy() { if (globalQueue) globalQueue->push(coro); else coro.destroy(); } void notify() { if (coro == nullptr) return; if (count) { if (count->fetch_add(-1) == 1) push_or_destroy(); } else { push_or_destroy(); } } bool await_ready() { return false; } void await_resume() {} void await_suspend(CoroutineHandle) { notify(); } private: CoroutineHandle coro; std::atomic<int> *count = nullptr; }; template <typename T> struct Task { struct promise_type { T result = {}; Awaiter awaiter; auto get_return_object() { return Task{stdx::coroutine_handle<promise_type>::from_promise(*this)}; } auto initial_suspend() { return stdx::suspend_always{}; } auto final_suspend() { return awaiter; } void unhandled_exception() {} // do nothing, exceptions are disabled void return_value(T value) { result = std::move(value); } }; Task(stdx::coroutine_handle<promise_type> h): coro(h) {} Task(Task &&r): coro(r.coro) { r.coro = nullptr; } ~Task() { if (coro) coro.destroy(); } NG_DELETE_COPY(Task); stdx::coroutine_handle<promise_type> coro; // We're never ready, don't await on Task twice! Awaiting on task triggers "await_suspend" bool await_ready() { return false; } T await_resume() { return coro.promise().result; } // When somebody asks for our value we do a suspend and that's when Task is actually scheduled for execution. void await_suspend(CoroutineHandle c) { coro.promise().awaiter = Awaiter(c); globalQueue->push(coro); } }; template <> struct Task<void> { struct promise_type { Awaiter awaiter; auto get_return_object() { return Task{stdx::coroutine_handle<promise_type>::from_promise(*this)}; } auto initial_suspend() { return stdx::suspend_always{}; } auto final_suspend() { return stdx::suspend_never{}; } void unhandled_exception() {} // do nothing, exceptions are disabled void return_void() { awaiter.notify(); } }; Task(stdx::coroutine_handle<promise_type> h): coro(h) {} Task(Task &&r): coro(r.coro) { r.coro = nullptr; } NG_DELETE_COPY(Task); stdx::coroutine_handle<promise_type> coro; }; // wait for all tasks in the list (execution on global queue) template <typename T> struct MultiTaskAwaiter { MultiTaskAwaiter(Vector<Task<T>> tasks): tasks(std::move(tasks)), count(this->tasks.length()) {} NG_DELETE_COPY_AND_MOVE(MultiTaskAwaiter); bool await_ready() { return false; } Vector<T> await_resume() { Vector<T> result; result.reserve(tasks.length()); for (auto &v : tasks) { result.append(std::move(v.coro.promise().result)); } return result; } void await_suspend(CoroutineHandle c) { for (auto &t : tasks) { t.coro.promise().awaiter = Awaiter(c, &count); globalQueue->push(t.coro); } } private: Vector<Task<T>> tasks; std::atomic<int> count; }; template <typename T, typename ...Args> auto co_all(Task<T> &&t, Args &&...args) { Vector<Task<T>> v; v.reserve(sizeof...(args)+1); v.append(std::move(t)); (v.append(std::move(args)), ...); return MultiTaskAwaiter(std::move(v)); } // wait for a task (execution on main thread queue) template <typename T> struct MainThreadAwaiter { MainThreadAwaiter(Task<T> task): task(std::move(task)) {} NG_DELETE_COPY_AND_MOVE(MainThreadAwaiter); bool await_ready() { return false; } T await_resume() { return task.coro.promise().result; } void await_suspend(CoroutineHandle c) { task.coro.promise().awaiter = Awaiter(c); mainThreadQueue->push(task.coro); } private: Task<T> task; }; template <> struct MainThreadAwaiter<void> { MainThreadAwaiter(Task<void> task): task(std::move(task)) {} NG_DELETE_COPY_AND_MOVE(MainThreadAwaiter); bool await_ready() { return false; } void await_resume() {} void await_suspend(CoroutineHandle c) { task.coro.promise().awaiter = Awaiter(c); mainThreadQueue->push(task.coro); } private: Task<void> task; }; template <typename T> auto co_main(Task<T> task) { return MainThreadAwaiter(std::move(task)); } int worker_thread(void*) { while (true) { auto next = globalQueue->pop(); if (next == nullptr) { return 0; } if (!next.done()) { next.resume(); } } } Vector<SDL_Thread*> workers; int numCPUs = 0; void terminate_workers() { for (int i = 0; i < workers.length(); i++) { globalQueue->push(nullptr); } } void init_workers() { globalQueue = make_unique<CoroutineQueue>(); mainThreadQueue = make_unique<CoroutineQueue>(); numCPUs = SDL_GetCPUCount();//min(8, SDL_GetCPUCount()); for (int i = 0; i < numCPUs; i++) { workers.append(SDL_CreateThread(worker_thread, "worker", (void*)(int64_t)(i+1))); } } void wait_for_workers() { for (int i = 0; i < numCPUs; i++) { SDL_WaitThread(workers[i], nullptr); } workers.clear(); globalQueue.reset(); Vector<CoroutineHandle> buf; mainThreadQueue->try_pop_all(&buf); for (auto c : buf) c.resume(); mainThreadQueue.reset(); } //============================================================================================================== //============================================================================================================== //============================================================================================================== Vec2d pixel_size(const RectD &rf, const Rect &r) { return rf.size() / ToVec2d(r.size()); } RectD rect_to_rectd(const Rect &r, const Vec2d &scale, const Vec2d &offset) { return RectD(ToVec2d(r.min) * scale + offset, ToVec2d(r.max) * scale + offset); } void draw_selection(const Vec2i &a, const Vec2i &b) { const auto min = Vec2i(::min(a.x, b.x), ::min(a.y, b.y)); const auto max = Vec2i(::max(a.x, b.x), ::max(a.y, b.y)); glColor3ub(255, 0, 0); glBegin(GL_LINES); glVertex2i(min.x, min.y); glVertex2i(max.x, min.y); glVertex2i(min.x, min.y); glVertex2i(min.x, max.y); glVertex2i(max.x, max.y); glVertex2i(max.x, min.y); glVertex2i(max.x, max.y); glVertex2i(min.x, max.y); glEnd(); glColor3ub(255,255,255); } void draw_quad(const Vec2i &pos, const Vec2i &size, float u, float v, float u2, float v2) { glBegin(GL_QUADS); glTexCoord2f(u, v); glVertex2i(pos.x, pos.y); glTexCoord2f(u2, v); glVertex2i(pos.x+size.x, pos.y); glTexCoord2f(u2, v2); glVertex2i(pos.x+size.x, pos.y+size.y); glTexCoord2f(u, v2); glVertex2i(pos.x, pos.y+size.y); glEnd(); } struct ColorRange { RGBA8 from; RGBA8 to; float range; }; static inline constexpr int ITERATIONS = 1024; static inline constexpr RGBA8 DARK_YELLOW(0xEE, 0xEE, 0x9E, 0xFF); static inline constexpr RGBA8 DARK_GREEN(0x44, 0x88, 0x44, 0xFF); static inline constexpr RGBA8 PALE_GREY_BLUE(0x49, 0x93, 0xDD, 0xFF); static inline constexpr RGBA8 CYAN(0x00, 0xFF, 0xFF, 0xFF); static inline constexpr RGBA8 RED(0xFF, 0x00, 0x00, 0xFF); static inline constexpr RGBA8 WHITE(0xFF, 0xFF, 0xFF, 0xFF); static inline constexpr RGBA8 BLACK(0x00, 0x00, 0x00, 0xFF); static inline constexpr ColorRange COLOR_SCALE[] = { {DARK_YELLOW, DARK_GREEN, 0.25f}, {DARK_GREEN, CYAN, 0.25f}, {CYAN, RED, 0.25f}, {RED, WHITE, 0.125f}, {WHITE, PALE_GREY_BLUE, 0.125f}, }; struct Palette { RGBA8 palette[ITERATIONS+1]; constexpr Palette(): palette{} { int p = 0; for (int i = 0; i < int(sizeof(COLOR_SCALE)/sizeof(*COLOR_SCALE)); i++) { auto r = COLOR_SCALE[i]; int n = r.range * ITERATIONS + 0.5; for (int j = 0; j < n && j < ITERATIONS; j++) { auto c = lerp(r.from, r.to, (float)j/n); palette[p] = c; p++; } } palette[ITERATIONS] = BLACK; } constexpr RGBA8 operator[](int i) const { return palette[i]; } }; static inline constexpr Palette palette; RGBA8 mandelbrot_at(std::complex<double> c) { auto z = std::complex<double>(0, 0); for (int i = 0; i < ITERATIONS; i++) { z = z * z + c; if (z.real() * z.real() + z.imag() * z.imag() > 4.0) { return palette[i]; } } return palette[ITERATIONS]; } Vector<uint8_t> mandelbrot(const RectD &rf, const Vec2i &size) { Vector<uint8_t> data(area(size)*4); const double px = (rf.max.x - rf.min.x) / (double)size.x; // pixel width const double py = (rf.max.y - rf.min.y) / (double)size.y; // pixel height const double dx = px / 4.0f; // 1/4 of a pixel const double dy = py / 4.0f; const double offx = px / 2.0f; // 1/2 of a pixel const double offy = py / 2.0f; for (int y = 0; y < size.y; y++) { const double i = (double)y * py + rf.min.y + offy; for (int x = 0; x < size.x; x++) { const double r = (double)x * px + rf.min.x + offx; // some form of supersampling AA, probably not the best one const RGBA8 c0 = mandelbrot_at(std::complex<double>(r-dx, i-dy)); const RGBA8 c1 = mandelbrot_at(std::complex<double>(r+dx, i-dy)); const RGBA8 c2 = mandelbrot_at(std::complex<double>(r-dx, i+dy)); const RGBA8 c3 = mandelbrot_at(std::complex<double>(r+dx, i+dy)); const RGBA8 color = lerp( lerp(c0, c1, 0.5f), lerp(c2, c3, 0.5f), 0.5f ); // NOTE: comment out lines above and uncomment line below to turn off AA // const RGBA8 color = mandelbrot_at(std::complex<double>(r, i)); const int offset = y * size.x * 4 + x * 4; data[offset+0] = color.r; data[offset+1] = color.g; data[offset+2] = color.b; data[offset+3] = color.a; } } return data; } struct Tile { bool wip = false; RGBA8 color; GLuint texture[2] = { 0, 0 }; // two lods bool released = false; int current_lod = {-1}; // -1 if no texture available const Vec2i pos; Tile(const Vec2i &pos, const Vec2i &tile_size, const Vec2d &scale, const Vec2d &offset): pos(pos) { const auto r = Rect_WH(pos, tile_size); const auto rf = rect_to_rectd(r, scale, offset); const auto center = rf.center(); color = mandelbrot_at(std::complex<double>(center.x, center.y)); } ~Tile() { for (int i = 0; i < current_lod+1; i++) { glDeleteTextures(1, &texture[i]); } } void draw(const Vec2i &tile_size, const Vec2i &offset) { switch (current_lod) { case -1: glBindTexture(GL_TEXTURE_2D, 0); glColor3ub(color.r, color.g, color.b); draw_quad(pos - offset, tile_size, 0, 0, 1, 1); glColor3ub(255, 255, 255); break; case 0: glBindTexture(GL_TEXTURE_2D, texture[0]); draw_quad(pos - offset, tile_size, 0, 0, 1, 1); break; case 1: glBindTexture(GL_TEXTURE_2D, texture[1]); draw_quad(pos - offset, tile_size, 0, 0, 1, 1); break; } } }; void release_tile(Tile *t) { if (t->wip) { // somebody's working on the tile, just mark it as released t->released = true; } else { del_obj(t); } } // returns true if object is still alive Task<bool> upload_texture(Tile *t, Vector<uint8_t> data, const Vec2i &size, bool finalize = false) { GLuint id; glGenTextures(1, &id); glBindTexture(GL_TEXTURE_2D, id); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, size.x, size.y, 0, GL_RGBA, GL_UNSIGNED_BYTE, data.data()); if (glGetError() != GL_NO_ERROR) { printf("failed uploading texture\n"); } t->current_lod++; t->texture[t->current_lod] = id; if (finalize) { t->wip = false; } if (t->released) { del_obj(t); co_return false; } co_return true; } Task<void> build_tile(Tile *t, const Vec2i &tile_size, Vec2d scale, Vec2d offset) { // LOD 0 const Rect r = Rect_WH(t->pos, tile_size); const RectD rf = rect_to_rectd(r, scale, offset); const auto data0 = mandelbrot(rf, tile_size/Vec2i(4)); if (!co_await co_main(upload_texture(t, std::move(data0), tile_size/Vec2i(4)))) co_return; // LOD 1 const auto data1 = mandelbrot(rf, tile_size); (void)co_await co_main(upload_texture(t, std::move(data1), tile_size, true)); } struct TileManager { Vec2i screen_offset = Vec2i(0); Vec2d offset = Vec2d(-1.5, -1.0); Vec2d scale = Vec2d(0.00235); // in pixels const Vec2i tile_size; Vector<Tile*> tiles; BitArray tile_bits; TileManager(const Vec2i &ts): tile_size(ts) { } ~TileManager() { for (auto t : tiles) release_tile(t); } void reset(Rect *s) { offset = Vec2d(-1.5, -1.0); scale = Vec2d(0.00235); *s = Rect_WH(Vec2i(0), s->size()); for (auto t : tiles) release_tile(t); tiles.clear(); update(*s); } void zoom(Rect *s, const Vec2i &a, const Vec2i &b) { const auto sr = Rect( Vec2i(::min(a.x, b.x), ::min(a.y, b.y)), Vec2i(::max(a.x, b.x), ::max(a.y, b.y))); const auto origin = ToVec2d(s->top_left() + sr.top_left()) * scale + offset; const auto ratio = (float)sr.width() / s->width(); scale *= Vec2d(ratio); offset = origin; *s = Rect_WH(Vec2i(0), s->size()); for (auto t : tiles) release_tile(t); tiles.clear(); update(*s); } void update(const Rect &s) { screen_offset = s.top_left(); // visible size in tiles WxH const Vec2i vis = s.size() / tile_size + Vec2i(2); const int vis_area = area(vis); if (tile_bits.length() != vis_area) tile_bits = BitArray(vis_area); else tile_bits.clear(); // base - the offset of screen in tiles, floor aligned to tile size const Vec2i base = floor_div(s.top_left(), tile_size); const Rect visrect = Rect_WH(Vec2i(0), vis); // go over existing tiles, release out of bounds ones, mark others in a bit array for (int i = 0; i < tiles.length(); i++) { const auto t = tiles[i]; const Vec2i index = t->pos / tile_size - base; if (!contains(visrect, index)) { tiles.quick_remove(i--); release_tile(t); } else { tile_bits.set_bit(index.y * vis.x + index.x); } } // go over all visible tiles, add missing ones for (int y = 0; y < vis.y; y++) { for (int x = 0; x < vis.x; x++) { const int offset = y*vis.x+x; if (tile_bits.test_bit(offset)) continue; // ok, we have a new tile here const Vec2i pos = (base + Vec2i(x, y)) * tile_size; const auto tile = new_obj<Tile>(pos, tile_size, this->scale, this->offset); tiles.append(tile); tile->wip = true; globalQueue->push(build_tile(tile, tile_size, this->scale, this->offset).coro); } } } void draw() { for (int i = 0; i < tiles.length(); i++) { tiles[i]->draw(tile_size, screen_offset); } } }; void main_loop(SDL_Window *sdl_window, Rect &screen) { TileManager tm(Vec2i(128)); tm.update(screen); glClearColor(0, 0, 0, 1); auto pan = false; auto select = false; auto selectA = Vec2i(0); auto selectB = Vec2i(0); auto panOrigin = Vec2i(0); auto done = false; Vector<CoroutineHandle> mainThreadBuf; while (!done) { if (mainThreadQueue->try_pop_all(&mainThreadBuf)) { for (auto c : mainThreadBuf) c.resume(); } SDL_Event e; while (SDL_PollEvent(&e)) { switch (e.type) { case SDL_WINDOWEVENT: if (e.window.event == SDL_WINDOWEVENT_RESIZED) { screen.set_size(Vec2i(e.window.data1, e.window.data2)); tm.update(screen); glViewport(0, 0, screen.width(), screen.height()); glLoadIdentity(); glOrtho(0, screen.width(), screen.height(), 0, -1, 1); } break; case SDL_KEYDOWN: if (e.key.keysym.sym == SDLK_ESCAPE) done = true; break; case SDL_MOUSEBUTTONDOWN: if (e.button.button == 1) { panOrigin = Vec2i(e.button.x, e.button.y); pan = true; } else if (e.button.button == 2) { tm.reset(&screen); } else if (e.button.button == 3) { selectB = selectA = Vec2i(e.button.x, e.button.y); select = true; } break; case SDL_MOUSEBUTTONUP: if (pan) { pan = false; } if (select) { select = false; tm.zoom(&screen, selectA, selectB); } break; case SDL_QUIT: done = true; break; case SDL_MOUSEMOTION: if (pan) { const Vec2i delta = Vec2i(e.motion.x, e.motion.y) - panOrigin; panOrigin += delta; screen.move(-delta); tm.update(screen); } else if (select) { selectB = Vec2i(e.motion.x, e.motion.y); } break; } } glClear(GL_COLOR_BUFFER_BIT); tm.draw(); glBindTexture(GL_TEXTURE_2D, 0); if (select) draw_selection(selectA, selectB); SDL_GL_SwapWindow(sdl_window); } terminate_workers(); wait_for_workers(); } int main() { SDL_Init(SDL_INIT_VIDEO); auto screen = Rect_WH(0, 0, 1280, 720); auto sdl_window = SDL_CreateWindow("cppmandel", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, screen.width(), screen.height(), SDL_WINDOW_SHOWN | SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE); if (!sdl_window) { printf("failed to create an SDL window: %s\n", SDL_GetError()); return 1; } auto context = SDL_GL_CreateContext(sdl_window); if (!context) { printf("failed to create a GL context: %s\n", SDL_GetError()); return 1; } SDL_GL_SetSwapInterval(1); glEnable(GL_TEXTURE_2D); glViewport(0, 0, screen.width(), screen.height()); glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(0, screen.width(), screen.height(), 0, -1, 1); init_workers(); main_loop(sdl_window, screen); SDL_GL_DeleteContext(context); SDL_DestroyWindow(sdl_window); SDL_Quit(); return 0; }
26.286558
112
0.650764
[ "object", "vector" ]
1f7325928358acaccec6a35a8e1b5dcce7c8a1e8
775
cpp
C++
square.cpp
amgross/boardHW
2fb87b55891567d2837d4bdabb20af5bf0b40705
[ "MIT" ]
null
null
null
square.cpp
amgross/boardHW
2fb87b55891567d2837d4bdabb20af5bf0b40705
[ "MIT" ]
null
null
null
square.cpp
amgross/boardHW
2fb87b55891567d2837d4bdabb20af5bf0b40705
[ "MIT" ]
null
null
null
// // Created by arye gross on 04 2018. // #include "Board.h" square::square(){ shape='.';//set on empty } char& square::operator=(const char& in){//set operator if (in!='X'&&in!='O'&&in!='.') throw IllegalCharException(in); shape=in; return shape; } square& square::operator=(const square& in){//set operator shape=in.shape; return *this; } ostream& operator<<(ostream& os,const square& a){//print return os<<a.shape; } bool square::operator== (const char &in) const { if (shape == in) return true; return false; } bool square::operator!= (const char &in) const { if (shape != in) return true; return false; } bool square::operator!= (const square &in) const { if (shape != in.shape) return true; return false; }
20.945946
66
0.620645
[ "shape" ]
1f86e83faa98878f86d93fd17db020a2562722be
17,375
hpp
C++
include/lean_vtk.hpp
jellespijker/lean-vtk
2e58a493779a57413c4b6efc2009c38eb6848a40
[ "MIT" ]
21
2020-07-30T07:28:04.000Z
2022-03-18T07:57:55.000Z
include/lean_vtk.hpp
jellespijker/lean-vtk
2e58a493779a57413c4b6efc2009c38eb6848a40
[ "MIT" ]
3
2021-09-02T18:19:42.000Z
2021-09-17T23:23:25.000Z
src/proprietary/core/leanVTK.hpp
kasperjp/cryoPonD
29cac40f78bc4f37f92cddcdc26493b4729b1963
[ "BSD-2-Clause" ]
4
2020-07-30T07:28:13.000Z
2021-10-10T10:21:16.000Z
#ifndef VTU_WRITER_HPP #define VTU_WRITER_HPP #include <string> #include <cassert> #include <fstream> #include <iostream> #include <string> #include <vector> namespace leanvtk { inline int index(int N, int i, int j) { assert(N > 0); return i * N + j; } template <typename T> class VTKDataNode { public: VTKDataNode() {} VTKDataNode(const std::string &name, const std::string &numeric_type, const std::vector<double> &data = std::vector<double>(), const int n_components = 1) : name_(name), numeric_type_(numeric_type), data_(data), n_components_(n_components) {} inline std::vector<double> &data() { return data_; } void initialize(const std::string &name, const std::string &numeric_type, const std::vector<double> &data, const int n_components = 1) { name_ = name; numeric_type_ = numeric_type; data_ = data; n_components_ = n_components; } void write(std::ostream &os) const { // NOTE this writer implicitly assumes that 2D vectors will live in 2D // space. To decouple this, vtk_num_components must match n_components_ // and the conditional if(n_components_==2){...} must be corrected for the // context. int vtk_num_components = n_components_ == 2 ? n_components_ + 1 : n_components_; os << "<DataArray type=\"" << numeric_type_ << "\" Name=\"" << name_ << "\" NumberOfComponents=\"" << vtk_num_components << "\" format=\"ascii\">\n"; if (n_components_ != 1) { std::cerr << "writing matrix in vtu file (check ordering of values)" << std::endl; } const int num_points = data_.size() / n_components_; for (int d = 0; d < num_points; ++d) { for (int i = 0; i < n_components_; ++i) { int idx = index(n_components_, d, i); os << data_.at(idx); if (i < n_components_ - 1) { os << " "; } } if(n_components_==2) os << " 0"; os << "\n"; } os << "</DataArray>\n"; } inline bool empty() const { return data_.size() <= 0; } private: std::string name_; std::string numeric_type_; std::vector<double> data_; int n_components_; }; class VTUWriter { public: /** * Write surface mesh to a file * const string& path filename to store vtk mesh (ending with .vtu) * const int dim ambient dimension (2D or 3D) * const int cell_size number of vertices per cell * (3 for triangles, 4 for quads and tets, 8 * for hexes) * const vector<double>& points list of point locations. Format of the * vector is: * [x_1, y_1, x_2, y_2, ..., x_n, y_n] * for 2D and * [x_1, y_1, z_1, ..., x_n, y_n, z_n] * for 3D. * const vector<int >& elements list of point indices per cell. Format of the * vector is: * [c_{1,1}, c_{1,2},..., c_{1, cell_size}, * ... * c_{cell_size,1}, c_{cell_size,2},..., c_{cell_size, cell_size}] * (i.e. index c*i corresponds to the ith * vertex in the cth cell in the mesh */ bool write_surface_mesh(const std::string &path, const int dim, const int cell_size, const std::vector<double> &points, const std::vector<int> &elements); /** * Write surface mesh to an output stream * ostream &os output stream where to write vtk mesh (ending with .vtu) * const int dim ambient dimension (2D or 3D) * const int cell_size number of vertices per cell * (3 for triangles, 4 for quads and tets, 8 * for hexes) * const vector<double>& points list of point locations. Format of the * vector is: * [x_1, y_1, x_2, y_2, ..., x_n, y_n] * for 2D and * [x_1, y_1, z_1, ..., x_n, y_n, z_n] * for 3D. * const vector<int >& elements list of point indices per cell. Format of the * vector is: * [c_{1,1}, c_{1,2},..., c_{1, cell_size}, * ... * c_{cell_size,1}, c_{cell_size,2},..., c_{cell_size, cell_size}] * (i.e. index c*i corresponds to the ith * vertex in the cth cell in the mesh */ bool write_surface_mesh(std::ostream &os, const int dim, const int cell_size, const std::vector<double> &points, const std::vector<int> &elements); /** * Write volume mesh to a file * * const string& path filename to store vtk mesh (ending with .vtu) * const int dim ambient dimension (2D or 3D) * const int cell_size number of vertices per cell * (3 for triangles, 4 for quads and tets, 8 * for hexes) * const vector<double>& points list of point locations. If there are * n points in the mesh, the format of the * vector is: * [x_1, y_1, x_2, y_2, ..., x_n, y_n] * for 2D and * [x_1, y_1, z_1, ..., x_n, y_n, z_n] * for 3D. * const vector<int >& elements list of point indices per cell. Format of the * vector is: * [c_{1,1}, c_{1,2},..., c_{1, cell_size}, * ... * c_{m,1}, c_{m,2},..., c_{m, cell_size}] * if there are m cells * (i.e. index c*i corresponds to the ith * vertex in the cth cell in the mesh */ bool write_volume_mesh(const std::string &path, const int dim, const int cell_size, const std::vector<double> &points, const std::vector<int> &elements); /** * Write volume mesh to an output stream * * ostream &os output stream where to write vtk mesh (ending with .vtu) * const int dim ambient dimension (2D or 3D) * const int cell_size number of vertices per cell * (3 for triangles, 4 for quads and tets, 8 * for hexes) * const vector<double>& points list of point locations. If there are * n points in the mesh, the format of the * vector is: * [x_1, y_1, x_2, y_2, ..., x_n, y_n] * for 2D and * [x_1, y_1, z_1, ..., x_n, y_n, z_n] * for 3D. * const vector<int >& elements list of point indices per cell. Format of the * vector is: * [c_{1,1}, c_{1,2},..., c_{1, cell_size}, * ... * c_{m,1}, c_{m,2},..., c_{m, cell_size}] * if there are m cells * (i.e. index c*i corresponds to the ith * vertex in the cth cell in the mesh */ bool write_volume_mesh(std::ostream &os, const int dim, const int cell_size, const std::vector<double> &points, const std::vector<int> &elements); /** * Write point cloud to a file * * const string& path filename to store vtk mesh (ending with .vtu) * const int dim ambient dimension (2D or 3D) * const int cell_size number of vertices per cell * (3 for triangles, 4 for quads and tets, 8 * for hexes) * const vector<double>& points list of point locations. If there are * n points in the mesh, the format of the * vector is: * [x_1, y_1, x_2, y_2, ..., x_n, y_n] * for 2D and * [x_1, y_1, z_1, ..., x_n, y_n, z_n] * for 3D. * const vector<int >& elements list of point indices per cell. Format of the * vector is: * [c_{1,1}, c_{1,2},..., c_{1, cell_size}, * ... * c_{m,1}, c_{m,2},..., c_{m, cell_size}] * if there are m cells * (i.e. index c*i corresponds to the ith * vertex in the cth cell in the mesh */ bool write_point_cloud(const std::string &path, const int dim, const std::vector<double> &points); /** * Write point cloud to a file * * ostream &os output stream where to write vtk mesh (ending with .vtp) * const int dim ambient dimension (2D or 3D) * const int cell_size number of vertices per cell * (3 for triangles, 4 for quads and tets, 8 * for hexes) * const vector<double>& points list of point locations. If there are * n points in the mesh, the format of the * vector is: * [x_1, y_1, x_2, y_2, ..., x_n, y_n] * for 2D and * [x_1, y_1, z_1, ..., x_n, y_n, z_n] * for 3D. * const vector<int >& elements list of point indices per cell. Format of the * vector is: * [c_{1,1}, c_{1,2},..., c_{1, cell_size}, * ... * c_{m,1}, c_{m,2},..., c_{m, cell_size}] * if there are m cells * (i.e. index c*i corresponds to the ith * vertex in the cth cell in the mesh */ bool write_point_cloud(std::ostream &os, const int dim, const std::vector<double> &points); /** * Add a general field to the mesh * const string& name name of the field to store vtk mesh * const vector<double>& data list of field values. There must be dimension * values for each point in the mesh to be written. * Format of the vector is * [f_{1,1}, f_{1,2},..., f_{1, dimension}, * ... * f_{n,1}, f_{n,2},..., f_{n, dimension}] * if there are n points in the mesh * const int dimension ambient dimension (2D or 3D) */ void add_field(const std::string &name, const std::vector<double> &data, const int &dimension); /** * Add a general cell/element field to the mesh * const string& name name of the field to store vtk mesh * const vector<double>& data list of field values. There must be dimension * values for each cell in the mesh to be written. * Format of the vector is * [f_{1,1}, f_{1,2},..., f_{1, dimension}, * ... * f_{m,1}, f_{m,2},..., f_{m, dimension}] * if there are m cells in the mesh * const int dimension ambient dimension (2D or 3D) */ void add_cell_field(const std::string &name, const std::vector<double> &data, const int &dimension); /** * Add a scalar field to the mesh * const string& name name of the field to store vtk mesh * const vector<double>& data list of field values. There must be one * value for each point in the mesh to be written. * Format of the vector is * [f_1, f_2,..., f_n] * if there are n points in the mesh */ void add_scalar_field(const std::string &name, const std::vector<double> &data); /** * Add a scalar field to cells/elements of the mesh * const string& name name of the field to store vtk mesh * const vector<double>& data list of field values. There must be one * value for each cell in the mesh to be written. * Format of the vector is * [f_1, f_2,..., f_m] * if there are m cells in the mesh */ void add_cell_scalar_field(const std::string &name, const std::vector<double> &data); /** * Add a vector field to the mesh * const string& name name of the field to store vtk mesh * const vector<double>& data list of field values. There must be dimension * values for each point in the mesh to be written. * Format of the vector is * [f_{1,1}, f_{1,2},..., f_{1, dimension}, * ... * f_{n,1}, f_{n,2},..., f_{n, dimension}] * if there are n points in the mesh * const int dimension ambient dimension (2D or 3D) */ void add_vector_field(const std::string &name, const std::vector<double> &data, const int &dimension); /** * Add a vector field to cells/elements of the mesh * const string& name name of the field to store vtk mesh * const vector<double>& data list of field values. There must be dimension * values for each cell in the mesh to be written. * Format of the vector is * [f_{1,1}, f_{1,2},..., f_{1, dimension}, * ... * f_{m,1}, f_{m,2},..., f_{m, dimension}] * if there are m cells in the mesh * const int dimension ambient dimension (2D or 3D) */ void add_cell_vector_field(const std::string &name, const std::vector<double> &data, const int &dimension); // Remove all fields and initialized data from the writer. void clear(); private: std::vector<VTKDataNode<double>> point_data_; std::vector<VTKDataNode<double>> cell_data_; std::string current_scalar_point_data_; std::string current_vector_point_data_; std::string current_scalar_cell_data_; std::string current_vector_cell_data_; void write_point_data(std::ostream &os); void write_cell_data(std::ostream &os); void write_header(const int n_vertices, const int n_elements, std::ostream &os); void write_footer(std::ostream &os); bool write_mesh(std::ostream &os, const int dim, const int cell_size, const std::vector<double> &points, const std::vector<int> &tets, bool is_volume_mesh=true); bool write_mesh(const std::string &path, const int dim, const int cell_size, const std::vector<double> &points, const std::vector<int> &tets, bool is_volume_mesh=true); void write_points(const int num_points, const std::vector<double> &points, std::ostream &os, bool is_volume_mesh = true); void write_cells(const int n_vertices, const std::vector<int> &tets, std::ostream &os, bool is_volume_mesh = true); }; } // namespace leanvtk #endif // VTU_WRITER_HPP
45.844327
101
0.454101
[ "mesh", "vector", "3d" ]
1f8d01d44f08e4be74a8bb5964d5fd5a253861c4
12,914
hpp
C++
include/am/succinct/fm-index/range_list.hpp
izenecloud/izenelib
9d5958100e2ce763fc75f27217adf982d7c9d902
[ "Apache-2.0" ]
31
2015-03-03T19:13:42.000Z
2020-09-03T08:11:56.000Z
include/am/succinct/fm-index/range_list.hpp
izenecloud/izenelib
9d5958100e2ce763fc75f27217adf982d7c9d902
[ "Apache-2.0" ]
1
2016-12-24T00:12:11.000Z
2016-12-24T00:12:11.000Z
include/am/succinct/fm-index/range_list.hpp
izenecloud/izenelib
9d5958100e2ce763fc75f27217adf982d7c9d902
[ "Apache-2.0" ]
8
2015-09-06T01:55:21.000Z
2021-12-20T02:16:13.000Z
#ifndef _FM_INDEX_RANGE_LIST_HPP #define _FM_INDEX_RANGE_LIST_HPP #include "wavelet_tree_node.hpp" #include <util/mem_utils.h> #include <boost/memory.hpp> #include <boost/tuple/tuple.hpp> NS_IZENELIB_AM_BEGIN namespace succinct { namespace fm_index { typedef boost::tuple<size_t, size_t, double> range_type; typedef std::vector<range_type, boost::stl_allocator<range_type> > range_list_type; typedef std::vector<size_t, boost::stl_allocator<size_t> > head_list_type; namespace detail { static double getPatternScore(const range_list_type &patterns) { double score = 0.0; for (range_list_type::const_iterator it = patterns.begin(); it != patterns.end(); ++it) { score += it->get<2>(); } return score; } static double getSynonymPatternScore(const range_list_type &patterns, const head_list_type &synonyms) { double score = 0.0; for (size_t i = 0; i < synonyms.size() - 1; ++i) { score += patterns[synonyms[i]].get<2>(); } return score; } static bool range_compare(const range_type &p1, const range_type &p2) { return p1.get<2>() > p2.get<2>(); } } class PatternList { public: PatternList( uint64_t sym, const WaveletTreeNode<dense::DBitV> *node, const range_list_type &patterns) : sym_(sym) , node_(node) , patterns_(patterns) { } PatternList( uint64_t sym, const WaveletTreeNode<dense::DBitV> *node, size_t pattern_count, boost::auto_alloc& alloc) : sym_(sym) , node_(node) , patterns_(alloc) { patterns_.reserve(pattern_count); } ~PatternList() {} void reset(uint64_t sym, const WaveletTreeNode<dense::DBitV> *node) { sym_ = sym; node_ = node; patterns_.clear(); } bool addPattern(const range_type &pattern) { if (pattern.get<0>() < pattern.get<1>()) { patterns_.push_back(pattern); return true; } return false; } double score() const { return detail::getPatternScore(patterns_); } public: uint64_t sym_; const WaveletTreeNode<dense::DBitV> *node_; range_list_type patterns_; } __attribute__((aligned(CACHELINE_SIZE))); template <class WaveletTreeType> class FilterItem { public: FilterItem( const WaveletTreeType *tree, const WaveletTreeNode<dense::DBitV> *node, const range_list_type &segments, boost::auto_alloc& alloc) : tree_(tree) , node_(node) , segments_(alloc) { segments_.assign(segments.begin(), segments.end()); } FilterItem( const WaveletTreeType *tree, const WaveletTreeNode<dense::DBitV> *node, size_t filter_count, boost::auto_alloc& alloc) : tree_(tree) , node_(node), segments_(alloc) { segments_.reserve(filter_count); } ~FilterItem() {} void reset(const WaveletTreeType *tree, const WaveletTreeNode<dense::DBitV> *node) { tree_ = tree; node_ = node; segments_.clear(); } bool addSegment(const range_type &segment) { if (segment.get<0>() < segment.get<1>()) { segments_.push_back(segment); return true; } return false; } public: const WaveletTreeType *tree_; const WaveletTreeNode<dense::DBitV> *node_; range_list_type segments_; } __attribute__((aligned(CACHELINE_SIZE))); template <class WaveletTreeType> class FilteredPatternList { public: typedef std::vector<FilterItem<WaveletTreeType> *, boost::stl_allocator<FilterItem<WaveletTreeType> *> > filter_list_type; FilteredPatternList( uint64_t sym, const WaveletTreeNode<dense::DBitV> *node, const filter_list_type &filters, const range_list_type &patterns, boost::auto_alloc& alloc) : sym_(sym) , node_(node) , filters_(filters) , patterns_(patterns) , recyc_filters_(alloc) , alloc_(alloc) { if (!filters_.empty()) { recyc_filters_.reserve(filters_.size()); } } FilteredPatternList( uint64_t sym, const WaveletTreeNode<dense::DBitV> *node, size_t filter_count, size_t pattern_count, boost::auto_alloc& alloc) : sym_(sym) , node_(node) , filters_(alloc) , patterns_(alloc) , recyc_filters_(alloc) , alloc_(alloc) { filters_.reserve(filter_count); patterns_.reserve(pattern_count); recyc_filters_.reserve(filter_count); } ~FilteredPatternList() { /* for (size_t i = 0; i < filters_.size(); ++i) { delete filters_[i]; } for (size_t i = 0; i < recyc_filters_.size(); ++i) { delete recyc_filters_[i]; }*/ } void reset(uint64_t sym, const WaveletTreeNode<dense::DBitV> *node) { sym_ = sym; node_ = node; recyc_filters_.insert(recyc_filters_.end(), filters_.begin(), filters_.end()); filters_.clear(); patterns_.clear(); } bool addFilter(FilterItem<WaveletTreeType> *filter) { assert(filter != NULL); if (filter->segments_.empty()) { recyc_filters_.push_back(filter); return false; } else { filters_.push_back(filter); return true; } } bool addPattern(const range_type &pattern) { if (pattern.get<0>() < pattern.get<1>()) { patterns_.push_back(pattern); return true; } return false; } FilterItem<WaveletTreeType> *getFilter( const WaveletTreeType *tree, const WaveletTreeNode<dense::DBitV> *node, size_t filter_count) { if (recyc_filters_.empty()) { return BOOST_NEW(alloc_,FilterItem<WaveletTreeType>)(tree, node, filter_count, alloc_); } else { FilterItem<WaveletTreeType> *filter = recyc_filters_.back(); filter->reset(tree, node); recyc_filters_.pop_back(); return filter; } } double score() const { return detail::getPatternScore(patterns_); } public: uint64_t sym_; const WaveletTreeNode<dense::DBitV> *node_; filter_list_type filters_; range_list_type patterns_; filter_list_type recyc_filters_; boost::auto_alloc& alloc_; } __attribute__((aligned(CACHELINE_SIZE))); class SynonymPatternList { public: SynonymPatternList( uint64_t sym, const WaveletTreeNode<dense::DBitV> *node, const range_list_type &patterns, const head_list_type &synonyms) : sym_(sym) , node_(node) , patterns_(patterns) , synonyms_(synonyms) { for (size_t i = 0; i < synonyms_.size() - 1; ++i) { std::sort(patterns_.begin() + synonyms_[i], patterns_.begin() + synonyms_[i + 1], detail::range_compare); } } SynonymPatternList( uint64_t sym, const WaveletTreeNode<dense::DBitV> *node, size_t pattern_count, size_t synonym_count, boost::auto_alloc& alloc) : sym_(sym) , node_(node) , patterns_(alloc) , synonyms_(alloc) { patterns_.reserve(pattern_count); synonyms_.reserve(synonym_count); synonyms_.push_back(0); } ~SynonymPatternList() {} void reset(uint64_t sym, const WaveletTreeNode<dense::DBitV> *node) { sym_ = sym; node_ = node; patterns_.clear(); synonyms_.resize(1); } bool addPattern(const range_type &pattern) { if (pattern.get<0>() < pattern.get<1>()) { patterns_.push_back(pattern); return true; } return false; } bool addSynonym() { if (patterns_.size() > synonyms_.back()) { synonyms_.push_back(patterns_.size()); return true; } return false; } double score() const { return detail::getSynonymPatternScore(patterns_, synonyms_); } public: uint64_t sym_; const WaveletTreeNode<dense::DBitV> *node_; range_list_type patterns_; head_list_type synonyms_; } __attribute__((aligned(CACHELINE_SIZE))); template <class WaveletTreeType> class FilteredSynonymPatternList { public: typedef std::vector<FilterItem<WaveletTreeType> *, boost::stl_allocator<FilterItem<WaveletTreeType> *> > filter_list_type; FilteredSynonymPatternList( uint64_t sym, const WaveletTreeNode<dense::DBitV> *node, const filter_list_type &filters, const range_list_type &patterns, const head_list_type &synonyms, boost::auto_alloc& alloc) : sym_(sym) , node_(node) , filters_(filters) , patterns_(patterns) , synonyms_(synonyms) , recyc_filters_(alloc) , alloc_(alloc) { if (!filters_.empty()) { for (size_t i = 0; i < synonyms_.size() - 1; ++i) { std::sort(patterns_.begin() + synonyms_[i], patterns_.begin() + synonyms_[i + 1], detail::range_compare); } recyc_filters_.reserve(filters_.size()); } } FilteredSynonymPatternList( uint64_t sym, const WaveletTreeNode<dense::DBitV> *node, size_t filter_count, size_t pattern_count, size_t synonym_count, boost::auto_alloc& alloc) : sym_(sym) , node_(node) , filters_(alloc) , patterns_(alloc) , synonyms_(alloc) , recyc_filters_(alloc) , alloc_(alloc) { filters_.reserve(filter_count); patterns_.reserve(pattern_count); synonyms_.reserve(synonym_count); synonyms_.push_back(0); recyc_filters_.reserve(filter_count); } ~FilteredSynonymPatternList() { /* for (size_t i = 0; i < filters_.size(); ++i) { delete filters_[i]; } for (size_t i = 0; i < recyc_filters_.size(); ++i) { delete recyc_filters_[i]; }*/ } void reset(uint64_t sym, const WaveletTreeNode<dense::DBitV> *node) { sym_ = sym; node_ = node; recyc_filters_.insert(recyc_filters_.end(), filters_.begin(), filters_.end()); filters_.clear(); patterns_.clear(); synonyms_.resize(1); } bool addFilter(FilterItem<WaveletTreeType> *filter) { assert(filter != NULL); if (filter->segments_.empty()) { recyc_filters_.push_back(filter); return false; } else { filters_.push_back(filter); return true; } } bool addPattern(const range_type &pattern) { if (pattern.get<0>() < pattern.get<1>()) { patterns_.push_back(pattern); return true; } return false; } bool addSynonym() { if (patterns_.size() > synonyms_.back()) { synonyms_.push_back(patterns_.size()); return true; } return false; } FilterItem<WaveletTreeType> *getFilter( const WaveletTreeType *tree, const WaveletTreeNode<dense::DBitV> *node, size_t filter_count) { if (recyc_filters_.empty()) { return BOOST_NEW(alloc_,FilterItem<WaveletTreeType>)(tree, node, filter_count, alloc_); } else { FilterItem<WaveletTreeType> *filter = recyc_filters_.back(); filter->reset(tree, node); recyc_filters_.pop_back(); return filter; } } double score() const { return detail::getSynonymPatternScore(patterns_, synonyms_); } public: uint64_t sym_; const WaveletTreeNode<dense::DBitV> *node_; filter_list_type filters_; range_list_type patterns_; head_list_type synonyms_; filter_list_type recyc_filters_; boost::auto_alloc& alloc_; } __attribute__((aligned(CACHELINE_SIZE))); } } NS_IZENELIB_AM_END namespace std { template <class T> struct less<boost::tuple<float, uint32_t, T*> > { bool operator()(boost::tuple<float, uint32_t, T*> const &p1, boost::tuple<float, uint32_t, T*> const &p2) { return boost::get<0>(p1) < boost::get<0>(p2) || (boost::get<0>(p1) == boost::get<0>(p2) && boost::get<1>(p1) < boost::get<1>(p2)); } }; } #endif
24.504744
138
0.577435
[ "vector" ]
1f8d8d277ec171adcd7eeec03dbb65f457f9383b
5,080
cpp
C++
Base/PLScene/src/Scene/SceneNodeModifiers/SNMPositionLinearAnimation.cpp
naetherm/PixelLight
d7666f5b49020334cbb5debbee11030f34cced56
[ "MIT" ]
1
2019-11-09T16:54:04.000Z
2019-11-09T16:54:04.000Z
Base/PLScene/src/Scene/SceneNodeModifiers/SNMPositionLinearAnimation.cpp
naetherm/pixelligh
d7666f5b49020334cbb5debbee11030f34cced56
[ "MIT" ]
27
2019-06-18T06:46:07.000Z
2020-02-02T11:11:28.000Z
Base/PLScene/src/Scene/SceneNodeModifiers/SNMPositionLinearAnimation.cpp
naetherm/PixelLight
d7666f5b49020334cbb5debbee11030f34cced56
[ "MIT" ]
null
null
null
/*********************************************************\ * File: SNMPositionLinearAnimation.cpp * * * Copyright (C) 2002-2013 The PixelLight Team (http://www.pixellight.org/) * * This file is part of PixelLight. * * Permission is hereby granted, free of charge, to any person obtaining a copy of this software * and associated documentation files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all copies or * substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \*********************************************************/ //[-------------------------------------------------------] //[ Includes ] //[-------------------------------------------------------] #include <PLCore/Tools/Timing.h> #include "PLScene/Scene/SceneContext.h" #include "PLScene/Scene/SceneNodeModifiers/SNMPositionLinearAnimation.h" //[-------------------------------------------------------] //[ Namespace ] //[-------------------------------------------------------] using namespace PLCore; using namespace PLMath; namespace PLScene { //[-------------------------------------------------------] //[ RTTI interface ] //[-------------------------------------------------------] pl_class_metadata(SNMPositionLinearAnimation, "PLScene", PLScene::SNMTransform, "Linear position animation scene node modifier class") // Constructors pl_constructor_1_metadata(ParameterConstructor, SceneNode&, "Parameter constructor", "") // Attributes pl_attribute_metadata(AutoVector, pl_enum_type_def3(SNMPositionLinearAnimation, EAutoVector), SNMPositionLinearAnimation::None, ReadWrite, "Automatic vector type", "") pl_attribute_metadata(Vector, PLMath::Vector3, PLMath::Vector3::One, ReadWrite, "Movement vector", "") pl_attribute_metadata(Speed, float, 1.0f, ReadWrite, "Movement speed", "") pl_class_metadata_end(SNMPositionLinearAnimation) //[-------------------------------------------------------] //[ Public functions ] //[-------------------------------------------------------] /** * @brief * Constructor */ SNMPositionLinearAnimation::SNMPositionLinearAnimation(SceneNode &cSceneNode) : SNMTransform(cSceneNode), AutoVector(this), Vector(this), Speed(this), EventHandlerUpdate(&SNMPositionLinearAnimation::OnUpdate, this) { } /** * @brief * Destructor */ SNMPositionLinearAnimation::~SNMPositionLinearAnimation() { } //[-------------------------------------------------------] //[ Protected virtual SceneNodeModifier functions ] //[-------------------------------------------------------] void SNMPositionLinearAnimation::OnActivate(bool bActivate) { // Connect/disconnect event handler SceneContext *pSceneContext = GetSceneContext(); if (pSceneContext) { if (bActivate) pSceneContext->EventUpdate.Connect(EventHandlerUpdate); else pSceneContext->EventUpdate.Disconnect(EventHandlerUpdate); } } //[-------------------------------------------------------] //[ Private functions ] //[-------------------------------------------------------] /** * @brief * Called when the scene node modifier needs to be updated */ void SNMPositionLinearAnimation::OnUpdate() { // Get the scene node SceneNode &cSceneNode = GetSceneNode(); // Get movement vector Vector3 vVector; switch (AutoVector) { case None: vVector = Vector.Get(); break; case XAxis: vVector = cSceneNode.GetTransform().GetRotation().GetXAxis(); break; case YAxis: vVector = cSceneNode.GetTransform().GetRotation().GetYAxis(); break; case ZAxis: vVector = cSceneNode.GetTransform().GetRotation().GetZAxis(); break; } // Apply vector, speed and time difference const Vector3 vPosInc = vVector*Speed*Timing::GetInstance()->GetTimeDifference(); // 'Move' to the new position if (!vPosInc.IsNull()) cSceneNode.MoveTo(cSceneNode.GetTransform().GetPosition()-vPosInc); } //[-------------------------------------------------------] //[ Namespace ] //[-------------------------------------------------------] } // PLScene
36.546763
168
0.565945
[ "vector" ]
1f8f88c50e5dfeedcac28825f09565d04adf190e
640
hpp
C++
Editor/Code/Editor/Editor.hpp
cugone/Abrams2019
0b94c43275069275bbbeadfa773c336fa1947882
[ "MIT" ]
1
2020-07-14T06:58:50.000Z
2020-07-14T06:58:50.000Z
Editor/Code/Editor/Editor.hpp
cugone/Abrams2019
0b94c43275069275bbbeadfa773c336fa1947882
[ "MIT" ]
1
2020-04-06T06:52:11.000Z
2020-04-06T06:52:19.000Z
Editor/Code/Editor/Editor.hpp
cugone/Abrams2019
0b94c43275069275bbbeadfa773c336fa1947882
[ "MIT" ]
2
2019-05-01T21:49:33.000Z
2021-04-01T08:22:21.000Z
#pragma once #include "Engine/Game/GameBase.hpp" class Editor : public GameBase { public: void Initialize() noexcept override; void BeginFrame() noexcept override; void Update(TimeUtils::FPSeconds deltaSeconds) noexcept override; void Render() const noexcept override; void EndFrame() noexcept override; const GameSettings& GetSettings() const noexcept override; GameSettings& GetSettings() noexcept override; protected: private: void DoFileNew() noexcept; void DoFileOpen() noexcept; void DoFileSaveAs() noexcept; void DoFileSave() noexcept; void HandleMenuKeyboardInput() noexcept; };
25.6
69
0.7375
[ "render" ]
1f93dfa3da068080f13f38e611c1c3596f7b7a38
2,153
cpp
C++
Game/Scorpio/src/PhysicsSimulation/PS_BoxCollider.cpp
hackerlank/SourceCode
b702c9e0a9ca5d86933f3c827abb02a18ffc9a59
[ "MIT" ]
4
2021-07-31T13:56:01.000Z
2021-11-13T02:55:10.000Z
Game/Scorpio/src/PhysicsSimulation/PS_BoxCollider.cpp
shacojx/SourceCodeGameTLBB
e3cea615b06761c2098a05427a5f41c236b71bf7
[ "MIT" ]
null
null
null
Game/Scorpio/src/PhysicsSimulation/PS_BoxCollider.cpp
shacojx/SourceCodeGameTLBB
e3cea615b06761c2098a05427a5f41c236b71bf7
[ "MIT" ]
7
2021-08-31T14:34:23.000Z
2022-01-19T08:25:58.000Z
#include "PS_BoxCollider.h" //------------------------------------------------------------------------------ PS_BoxCollider::PS_BoxCollider(const PS_Vector3& extents) : PS_MovableCollider() , mExtents(extents) , mHalfExtents(extents / 2) { assert(extents.x > 0 && extents.y > 0 && extents.z > 0); } //------------------------------------------------------------------------------ PS_BoxCollider::~PS_BoxCollider() { } //------------------------------------------------------------------------------ void PS_BoxCollider::setExtents(PS_Scalar sx, PS_Scalar sy, PS_Scalar sz) { setExtents(PS_Vector3(sx, sy, sz)); } //------------------------------------------------------------------------------ void PS_BoxCollider::setExtents(const PS_Vector3& extents) { assert(extents.x > 0 && extents.y > 0 && extents.z > 0); mExtents = extents; mHalfExtents = extents / 2; } //------------------------------------------------------------------------------ const PS_Vector3& PS_BoxCollider::getExtents(void) const { return mExtents; } //------------------------------------------------------------------------------ bool PS_BoxCollider::_support(const PS_Vector3& point, PS_Vector3& position, PS_Vector3& normal) const { // Transform point to our local coordinate PS_Vector3 v = (point - mPosition) * mRotation; // Calculate the distance between the point and the box centre PS_Scalar dx = PS_Math::Abs(v.x); PS_Scalar dy = PS_Math::Abs(v.y); PS_Scalar dz = PS_Math::Abs(v.z); // Check out of bound if (mHalfExtents.x <= dx || mHalfExtents.y <= dy || mHalfExtents.z <= dz) return false; // Calculate nearest axis int axis; dx = mHalfExtents.x - dx; dy = mHalfExtents.y - dy; dz = mHalfExtents.z - dz; if (dx < dy) { axis = dx < dz ? 0 : 2; } else { axis = dy < dz ? 1 : 2; } // Reuse v to calculate normal to avoid allocate if (v[axis] < 0) v = -mRotation.getColumn(axis); else v = +mRotation.getColumn(axis); normal = v; position = mPosition + v * mHalfExtents[axis]; return true; }
29.902778
102
0.489085
[ "transform" ]
1f95dfe64098db188f46991baf9479894f435493
2,696
cpp
C++
tests/src/TestHalfEdgeMesh.cpp
educelab/OpenABF
8b8c7cfc23e7bef21979f54099f19d28eba0e682
[ "Apache-2.0" ]
10
2021-03-12T17:39:19.000Z
2022-01-24T03:58:32.000Z
tests/src/TestHalfEdgeMesh.cpp
educelab/OpenABF
8b8c7cfc23e7bef21979f54099f19d28eba0e682
[ "Apache-2.0" ]
null
null
null
tests/src/TestHalfEdgeMesh.cpp
educelab/OpenABF
8b8c7cfc23e7bef21979f54099f19d28eba0e682
[ "Apache-2.0" ]
3
2021-03-12T17:39:21.000Z
2022-01-04T13:30:08.000Z
#include <gtest/gtest.h> #include "OpenABF/OpenABF.hpp" using namespace OpenABF; template <typename T> auto ConstructPyramid() -> typename HalfEdgeMesh<T>::Pointer { auto mesh = HalfEdgeMesh<T>::New(); mesh->insert_vertex(0, 0, 0); mesh->insert_vertex(2, 0, 0); mesh->insert_vertex(1, std::sqrt(3), 0); mesh->insert_vertex(1, std::sqrt(3) / 3, std::sqrt(6) * 2 / 3); mesh->insert_face(0, 3, 1); mesh->insert_face(0, 2, 3); mesh->insert_face(2, 1, 3); return mesh; } TEST(HalfEdgeMesh, BuildMesh) { EXPECT_NO_THROW(ConstructPyramid<float>()); } TEST(HalfEdgeMesh, FaceVertexOutOfBounds) { auto mesh = HalfEdgeMesh<float>::New(); EXPECT_THROW(mesh->insert_face(0, 1, 2), std::out_of_range); } TEST(HalfEdgeMesh, InsertNonManifoldEdge) { auto mesh = ConstructPyramid<float>(); EXPECT_NO_THROW( mesh->insert_vertex(1, std::sqrt(3) / 3, -std::sqrt(6) * 2 / 3)); EXPECT_THROW(mesh->insert_face(0, 3, 4), MeshException); } TEST(HalfEdgeMesh, HasBoundary) { // Construct open pyramid auto mesh = ConstructPyramid<float>(); EXPECT_TRUE(HasBoundary(mesh)); // Close pyramid mesh->insert_face(2, 0, 1); EXPECT_FALSE(HasBoundary(mesh)); } TEST(HalfEdgeMesh, IsManifold) { // Construct open pyramid auto mesh = ConstructPyramid<float>(); EXPECT_TRUE(IsManifold(mesh)); // Close pyramid mesh->insert_face(2, 0, 1); EXPECT_TRUE(IsManifold(mesh)); // Complicated geometry tests // Simple triangle with hole // Not manifold because hole touches outer border mesh = HalfEdgeMesh<float>::New(); mesh->insert_vertex(0, 0, 0); mesh->insert_vertex(1, 0, 0); mesh->insert_vertex(2, 0, 0); mesh->insert_vertex(0.5F, std::sqrt(3) / 2, 0); mesh->insert_vertex(1.5F, std::sqrt(3) / 2, 0); mesh->insert_vertex(1, std::sqrt(3), 0); mesh->insert_face(0, 3, 1); mesh->insert_face(1, 4, 2); mesh->insert_face(3, 5, 4); EXPECT_FALSE(IsManifold(mesh)); // Add triangles to make hole not border-adjacent, is manifold mesh->insert_vertex(-0.5, 1, 0); mesh->insert_vertex(0.5, -std::sqrt(3), 0); mesh->insert_vertex(2.5, 1, 0); mesh->insert_face(0, 6, 3); mesh->insert_face(3, 6, 5); mesh->insert_face(4, 5, 7); mesh->insert_face(4, 7, 2); mesh->insert_face(1, 2, 8); mesh->insert_face(0, 1, 8); EXPECT_TRUE(IsManifold(mesh)); // Add some non-manifold geometry that can't be detected by edge pairing mesh->insert_vertex(1, std::sqrt(3) / 3, std::sqrt(6) * 2 / 3); EXPECT_NO_THROW(mesh->insert_face(1, 3, 9)); EXPECT_NO_THROW(mesh->insert_face(6, 9, 5)); EXPECT_FALSE(IsManifold(mesh)); }
29.626374
77
0.645772
[ "mesh", "geometry" ]
1f96363abc5bfe09d388ece8a985c365194387ed
5,213
cpp
C++
source/Parameters_openReadsFiles.cpp
fossabot/STAR-1
e2e036b1fd47eb44eb4a8afed0eab2f11bd20324
[ "MIT" ]
1
2022-03-08T13:42:23.000Z
2022-03-08T13:42:23.000Z
source/Parameters_openReadsFiles.cpp
pascalg/STAR
ecec9ee35da0d4920ae64038cfb8fc59cef2e0ca
[ "MIT" ]
null
null
null
source/Parameters_openReadsFiles.cpp
pascalg/STAR
ecec9ee35da0d4920ae64038cfb8fc59cef2e0ca
[ "MIT" ]
null
null
null
#include "Parameters.h" #include "ErrorWarning.h" #include <fstream> #include <sys/stat.h> void Parameters::openReadsFiles() { if (readFilesCommandString=="") {//read from file for (uint ii=0;ii<readFilesIn.size();ii++) {//open readIn files readFilesCommandPID[ii]=0;//no command process IDs if ( inOut->readIn[ii].is_open() ) inOut->readIn[ii].close(); string rfName=readFilesPrefixFinal + readFilesIn.at(ii); inOut->readIn[ii].open(rfName.c_str()); //try to open the Sequences file right away, exit if failed if (inOut->readIn[ii].fail()) { ostringstream errOut; errOut <<"EXITING because of fatal input ERROR: could not open readFilesIn=" << rfName <<"\n"; exitWithError(errOut.str(), std::cerr, inOut->logMain, EXIT_CODE_PARAMETER, *this); }; }; } else {//create fifo files, execute pre-processing command vector<string> readsCommandFileName; for (uint imate=0;imate<readFilesNames.size();imate++) {//open readIn files ostringstream sysCom; sysCom << outFileTmp <<"tmp.fifo.read"<<imate+1; readFilesInTmp.push_back(sysCom.str()); remove(readFilesInTmp.at(imate).c_str()); if (mkfifo(readFilesInTmp.at(imate).c_str(), S_IRUSR | S_IWUSR ) != 0) { exitWithError("Exiting because of *FATAL ERROR*: could not create FIFO file " + readFilesInTmp.at(imate) + "\n" + "SOLUTION: check the if run directory supports FIFO files.\n" + "If run partition does not support FIFO (e.g. Windows partitions FAT, NTFS), " + "re-run on a Linux partition, or point --outTmpDir to a Linux partition.\n" , std::cerr, inOut->logMain, EXIT_CODE_FIFO, *this); }; inOut->logMain << "\n Input read files for mate "<< imate+1 <<" :\n"; readsCommandFileName.push_back(outFileTmp+"/readsCommand_read" + to_string(imate+1)); fstream readsCommandFile( readsCommandFileName.at(imate).c_str(), ios::out); readsCommandFile.close(); readsCommandFile.open( readsCommandFileName.at(imate).c_str(), ios::in | ios::out); //first line in the commands file if (sysShell!="-") {//executed via specified shell readsCommandFile << "#!" <<sysShell <<"\n"; }; readsCommandFile << "exec > \""<<readFilesInTmp.at(imate)<<"\"\n" ; // redirect stdout to temp fifo files for (uint32 ifile=0; ifile<readFilesN; ifile++) { if ( system(("ls -lL " + readFilesNames[imate][ifile] + " > "+ outFileTmp+"/readFilesIn.info 2>&1").c_str()) !=0 ) warningMessage(" Could not ls " + readFilesNames[imate][ifile], std::cerr, inOut->logMain, *this); ifstream readFilesIn_info((outFileTmp+"/readFilesIn.info").c_str()); inOut->logMain <<readFilesIn_info.rdbuf(); {//try to open the files - throw an error if a file cannot be opened ifstream rftry(readFilesNames[imate][ifile].c_str()); if (!rftry.good()){ exitWithError("EXITING: because of fatal INPUT file error: could not open read file: " + \ readFilesNames[imate][ifile] + \ "\nSOLUTION: check that this file exists and has read permision.\n", \ std::cerr, inOut->logMain, EXIT_CODE_PARAMETER, *this); }; rftry.close(); }; readsCommandFile <<"echo FILE "<< ifile << "\n"; readsCommandFile << readFilesCommandString <<" "<< ("\""+readFilesNames[imate][ifile]+"\"") <<"\n"; }; readsCommandFile.flush(); readsCommandFile.seekg(0,ios::beg); inOut->logMain <<"\n readsCommandsFile:\n"<<readsCommandFile.rdbuf()<<endl; readsCommandFile.close(); chmod(readsCommandFileName.at(imate).c_str(),S_IXUSR | S_IRUSR | S_IWUSR); readFilesCommandPID[imate]=0; ostringstream errOut; pid_t PID=vfork(); switch (PID) { case -1: errOut << "EXITING: because of fatal EXECUTION error: Failed vforking readFilesCommand\n"; errOut << errno << ": " << strerror(errno) << "\n"; exitWithError(errOut.str(), std::cerr, inOut->logMain, EXIT_CODE_PARAMETER, *this); break; case 0: //this is the child execlp(readsCommandFileName.at(imate).c_str(), readsCommandFileName.at(imate).c_str(), (char*) NULL); exit(0); default: //this is the father, record PID of the children readFilesCommandPID[imate]=PID; }; inOut->readIn[imate].open(readFilesInTmp.at(imate).c_str()); }; }; readFilesIndex=0; if (readFilesTypeN==10) {//SAM file - skip header lines readSAMheader(readFilesCommandString, readFilesNames.at(0)); }; };
46.544643
130
0.564358
[ "vector" ]
1f98151e714ad03b577e1720239abf8417e2e90c
9,086
cpp
C++
src/test/cpp/src/ExpectedInPlaceGenMatRowIndsGenMat.cpp
SRAhub/ArmadilloJava
061121e22708111a8df3a2da92f6278c3a581e26
[ "MIT" ]
3
2016-10-04T03:51:35.000Z
2016-11-27T03:41:44.000Z
src/test/cpp/src/ExpectedInPlaceGenMatRowIndsGenMat.cpp
sebiniemann/ArmadilloJava
061121e22708111a8df3a2da92f6278c3a581e26
[ "MIT" ]
33
2019-10-20T21:53:37.000Z
2019-10-20T21:53:47.000Z
src/test/cpp/src/ExpectedInPlaceGenMatRowIndsGenMat.cpp
sebiniemann/ArmadilloJava
061121e22708111a8df3a2da92f6278c3a581e26
[ "MIT" ]
2
2020-08-06T17:01:28.000Z
2021-06-16T18:45:14.000Z
/******************************************************************************* * Copyright 2013-2014 Sebastian Niemann <niemann@sra.uni-hannover.de>. * * Licensed under the MIT License (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://opensource.org/licenses/MIT * * Developers: * Sebastian Niemann - Lead developer * Daniel Kiechle - Unit testing ******************************************************************************/ #include <Expected.hpp> using armadilloJava::Expected; #include <iostream> using std::cout; using std::endl; #include <utility> using std::pair; #include <armadillo> using arma::Mat; using arma::Col; using arma::uword; #include <InputClass.hpp> using armadilloJava::InputClass; #include <Input.hpp> using armadilloJava::Input; namespace armadilloJava { class ExpectedInPlaceGenMatRowIndsGenMat : public Expected { public: ExpectedInPlaceGenMatRowIndsGenMat() { cout << "Compute ExpectedInPlaceGenMatRowIndsGenMat(): " << endl; vector<vector<pair<string, void*>>> inputs = Input::getTestParameters({ InputClass::GenMat, InputClass::RowInds, InputClass::GenMat }); for (vector<pair<string, void*>> input : inputs) { _fileSuffix = ""; int n = 0; for (pair<string, void*> value : input) { switch (n) { case 0: _fileSuffix += value.first; _genMatA = *static_cast<Mat<double>*>(value.second); break; case 1: _fileSuffix += "," + value.first; _rowInds = *static_cast<Col<uword>*>(value.second); break; case 2: _fileSuffix += "," + value.first; _genMatB = *static_cast<Mat<double>*>(value.second); break; } ++n; } cout << "Using input: " << _fileSuffix << endl; _copyOfGenMatA = _genMatA; _copyOfRowInds = _rowInds; _copyOfGenMatB = _genMatB; expectedRowsEqual(); _genMatA = _copyOfGenMatA; _rowInds = _copyOfRowInds; _genMatB = _copyOfGenMatB; expectedRowsPlus(); _genMatA = _copyOfGenMatA; _rowInds = _copyOfRowInds; _genMatB = _copyOfGenMatB; expectedRowsMinus(); _genMatA = _copyOfGenMatA; _rowInds = _copyOfRowInds; _genMatB = _copyOfGenMatB; expectedRowsElemTimes(); _genMatA = _copyOfGenMatA; _rowInds = _copyOfRowInds; _genMatB = _copyOfGenMatB; expectedRowsElemDivide(); _genMatA = _copyOfGenMatA; _rowInds = _copyOfRowInds; _genMatB = _copyOfGenMatB; expectedEach_rowEqual(); _genMatA = _copyOfGenMatA; _rowInds = _copyOfRowInds; _genMatB = _copyOfGenMatB; expectedEach_rowPlus(); _genMatA = _copyOfGenMatA; _rowInds = _copyOfRowInds; _genMatB = _copyOfGenMatB; expectedEach_rowMinus(); _genMatA = _copyOfGenMatA; _rowInds = _copyOfRowInds; _genMatB = _copyOfGenMatB; expectedEach_rowElemTimes(); _genMatA = _copyOfGenMatA; _rowInds = _copyOfRowInds; _genMatB = _copyOfGenMatB; expectedEach_rowElemDivide(); } cout << "done." << endl; } protected: Mat<double> _genMatA; Mat<double> _copyOfGenMatA; Col<uword> _rowInds; Col<uword> _copyOfRowInds; Mat<double> _genMatB; Mat<double> _copyOfGenMatB; void expectedRowsEqual() { for(int i = 0; i < _rowInds.n_elem; i++) { if(_rowInds.at(i) >= _genMatA.n_rows) { return; } } if(_genMatB.n_rows != _rowInds.n_elem) { return; } if(_genMatB.n_cols != _genMatA.n_cols) { return; } cout << "- Compute expectedRowsEqual() ... "; _genMatA.rows(_rowInds) = _genMatB; save<double>("Mat.rowsEqual", _genMatA); cout << "done." << endl; } void expectedRowsPlus() { for(int i = 0; i < _rowInds.n_elem; i++) { if(_rowInds.at(i) >= _genMatA.n_rows) { return; } } if(_genMatB.n_rows != _rowInds.n_elem) { return; } if(_genMatB.n_cols != _genMatA.n_cols) { return; } cout << "- Compute expectedRowsPlus() ... "; _genMatA.rows(_rowInds) += _genMatB; save<double>("Mat.rowsPlus", _genMatA); cout << "done." << endl; } void expectedRowsMinus() { for(int i = 0; i < _rowInds.n_elem; i++) { if(_rowInds.at(i) >= _genMatA.n_rows) { return; } } if(_genMatB.n_rows != _rowInds.n_elem) { return; } if(_genMatB.n_cols != _genMatA.n_cols) { return; } cout << "- Compute expectedRowsMinus() ... "; _genMatA.rows(_rowInds) -= _genMatB; save<double>("Mat.rowsMinus", _genMatA); cout << "done." << endl; } void expectedRowsElemTimes() { for(int i = 0; i < _rowInds.n_elem; i++) { if(_rowInds.at(i) >= _genMatA.n_rows) { return; } } if(_genMatB.n_rows != _rowInds.n_elem) { return; } if(_genMatB.n_cols != _genMatA.n_cols) { return; } cout << "- Compute expectedRowsElemTimes() ... "; _genMatA.rows(_rowInds) %= _genMatB; save<double>("Mat.rowsElemTimes", _genMatA); cout << "done." << endl; } void expectedRowsElemDivide() { for(int i = 0; i < _rowInds.n_elem; i++) { if(_rowInds.at(i) >= _genMatA.n_rows) { return; } } if(_genMatB.n_rows != _rowInds.n_elem) { return; } if(_genMatB.n_cols != _genMatA.n_cols) { return; } cout << "- Compute expectedRowsElemDivide() ... "; _genMatA.rows(_rowInds) /= _genMatB; save<double>("Mat.rowsElemDivide", _genMatA); cout << "done." << endl; } void expectedEach_rowEqual() { for(int i = 0; i < _rowInds.n_elem; i++) { if(_rowInds.at(i) >= _genMatA.n_rows) { return; } } if(!_genMatB.is_rowvec()) { return; } if(_genMatB.n_cols != _genMatA.n_cols) { return; } cout << "- Compute expectedEach_rowEqual() ... "; _genMatA.each_row(_rowInds) = _genMatB; save<double>("Mat.each_rowEqual", _genMatA); cout << "done." << endl; } void expectedEach_rowPlus() { for(int i = 0; i < _rowInds.n_elem; i++) { if(_rowInds.at(i) >= _genMatA.n_rows) { return; } } if(!_genMatB.is_rowvec()) { return; } if(_genMatB.n_cols != _genMatA.n_cols) { return; } cout << "- Compute expectedEach_rowPlus() ... "; _genMatA.each_row(_rowInds) += _genMatB; save<double>("Mat.each_rowPlus", _genMatA); cout << "done." << endl; } void expectedEach_rowMinus() { for(int i = 0; i < _rowInds.n_elem; i++) { if(_rowInds.at(i) >= _genMatA.n_rows) { return; } } if(!_genMatB.is_rowvec()) { return; } if(_genMatB.n_cols != _genMatA.n_cols) { return; } cout << "- Compute expectedEach_rowMinus() ... "; _genMatA.each_row(_rowInds) -= _genMatB; save<double>("Mat.each_rowMinus", _genMatA); cout << "done." << endl; } void expectedEach_rowElemTimes() { for(int i = 0; i < _rowInds.n_elem; i++) { if(_rowInds.at(i) >= _genMatA.n_rows) { return; } } if(!_genMatB.is_rowvec()) { return; } if(_genMatB.n_cols != _genMatA.n_cols) { return; } cout << "- Compute expectedEach_rowElemTimes() ... "; _genMatA.each_row(_rowInds) %= _genMatB; save<double>("Mat.each_rowElemTimes", _genMatA); cout << "done." << endl; } void expectedEach_rowElemDivide() { for(int i = 0; i < _rowInds.n_elem; i++) { if(_rowInds.at(i) >= _genMatA.n_rows) { return; } } if(!_genMatB.is_rowvec()) { return; } if(_genMatB.n_cols != _genMatA.n_cols) { return; } cout << "- Compute expectedEach_rowElemDivide() ... "; _genMatA.each_row(_rowInds) /= _genMatB; save<double>("Mat.each_rowElemDivide", _genMatA); cout << "done." << endl; } }; }
24.690217
80
0.513207
[ "vector" ]
1fafde4e5f83372a125ffda0fe809e755571469b
6,643
cpp
C++
src/Scanner.cpp
sousajf1/loxs
a5301c308b5c2df4f6d2e0865d47065bf3ef7984
[ "Unlicense" ]
1
2021-06-23T07:47:30.000Z
2021-06-23T07:47:30.000Z
src/Scanner.cpp
sousajf1/loxs
a5301c308b5c2df4f6d2e0865d47065bf3ef7984
[ "Unlicense" ]
5
2021-06-30T15:07:34.000Z
2021-08-03T10:25:24.000Z
src/Scanner.cpp
sousajf1/loxs
a5301c308b5c2df4f6d2e0865d47065bf3ef7984
[ "Unlicense" ]
null
null
null
#include "Scanner.hpp" namespace loxs { /* Helper functions to add tokens to tokens list */ void Scanner::addToken(TokenType type, std::any literal) { auto sub_string = source.substr(start, current-start); tokens.emplace_back(Token(type, sub_string, std::move(literal), line)); } /* Helper functions to add tokens to tokens list */ void Scanner::addToken(TokenType type) { auto sub_string = source.substr(start, current-start); //fixme: we should improve the std::any is not good I prefer to have it // here the constructor of the string so we know this is a pain point tokens.emplace_back(Token(type, sub_string, std::string{" "}, line)); } /* Helper functions to check if end of file was reached */ bool Scanner::endOfFile() { return (current >= source.length()); } /* Helper function to read chars */ char Scanner::peek() { if(endOfFile()) { return '\0'; } return source.at(current); } /* Helper functions to check if a next char is an operator e.g: == , != */ bool Scanner::match(char expected) { if(endOfFile()) { return false; } if(source.at(current) != expected) { return false; } current++; return true; } /* Helper function to fetch next char */ char Scanner::nextChar() { if((current + 1) >= source.length()) { return '\0'; } return source.at(current + 1); } /* This function catch a string literal */ void Scanner::stringLiteral() { while(peek() != '"' && !endOfFile()) { if(peek() == '\n') { line++; } current++; } if(endOfFile()) {}; //return error current++; //Catch the " std::string string_literal = source.substr(start+1, ((current-1) - (start+1))); addToken(TokenType::STRING, string_literal); } /* This function catch a number literal */ void Scanner::numberLiteral() { while(peek() != '\n' && !endOfFile() && (isdigit(peek()) != 0)) { current++; } if(peek() == '.' && (isdigit(nextChar()) != 0)) { current++; while(isdigit(peek()) != 0) { current++; } } std::string number_literal = source.substr(start, current-start); addToken(TokenType::NUMBER, stod(number_literal)); } /* This function catch an indentifier */ void Scanner::identifyLiteral() { // Map for special Keywords static const std::map<std::string, TokenType> keywords { {"class", TokenType::CLASS}, {"else", TokenType::ELSE}, {"false", TokenType::FALSE}, {"for", TokenType::FOR}, {"fun", TokenType::FUN}, {"if", TokenType::IF}, {"nil", TokenType::NIL}, {"print", TokenType::PRINT}, {"return", TokenType::RETURN}, {"super", TokenType::SUPER}, {"this", TokenType::THIS}, {"true", TokenType::TRUE}, {"var", TokenType::VAR}, {"while", TokenType::WHILE} }; while((isalpha(peek()) != 0) || peek() == '_') { current++; } std::string keyword = source.substr(start, current - start); if (keywords.find(keyword) != keywords.end()) { addToken(keywords.find(keyword)->second); } else { addToken(TokenType::IDENTIFIER); } } /* This function scan the token of each lexeme * accordingly with the TokenType. */ void Scanner::scanToken() { const char curr_char = get_curr_char(); switch (curr_char) { case '(': addToken(TokenType::LEFT_PAREN); break; case ')': addToken(TokenType::RIGHT_PAREN); break; case '{': addToken(TokenType::LEFT_BRACE); break; case '}': addToken(TokenType::RIGHT_BRACE); break; case ',': addToken(TokenType::COMMA); break; case '.': addToken(TokenType::DOT); break; case '-': addToken(TokenType::MINUS); break; case '+': addToken(TokenType::PLUS); break; case ';': addToken(TokenType::SEMICOLON); break; case '*': addToken(TokenType::STAR); break; case '!': addToken(match('=') ? TokenType::BANG_EQUAL : TokenType::BANG); break; case '=': addToken(match('=') ? TokenType::EQUAL_EQUAL : TokenType::EQUAL); break; case '<': addToken(match('=') ? TokenType::LESS_EQUAL : TokenType::LESS); break; case '>': addToken(match('=') ? TokenType::GREATER_EQUAL : TokenType::GREATER); break; case '/': if (match('/')) { // A comment goes until the end of the line. while (peek() != '\n' && !endOfFile()) { current++; } } else { addToken(TokenType::SLASH); } break; case ' ': case '\r': case '\t': // Ignore whitespace. break; case '\n': line++; break; case '"': stringLiteral(); break; case '|': addToken(match('|') ? TokenType::OR : TokenType::NIL); break; case '&': addToken(match('&') ? TokenType::AND : TokenType::SUPER); break; default: if (isdigit(curr_char) != 0) { numberLiteral(); } else { if(isalpha(curr_char) != 0) { identifyLiteral(); } } //Add Try catch here maybe, in case the token isnt recognized break; } } /* This function scan the tokens of a source code file. * Starting in the first line, having a "pointer" for * both start of the lexeme and current char of it. * int i = 1; * Three lexames: 'int', 'i' and '1' */ std::vector<Token> Scanner::scanTokens() { while(!endOfFile()) { start = current; scanToken(); } tokens.emplace_back(Token(TokenType::EoF,"",line)); return tokens; } }
33.049751
87
0.485473
[ "vector" ]
1fb08e1ca3881916daadfcd2e5eb77446efbc86b
662
hpp
C++
Include/SA/Render/Base/Texture/RawCubemap.hpp
SapphireSuite/Engine
f29821853aec6118508f31d3e063e83e603f52dd
[ "MIT" ]
1
2022-01-20T23:17:18.000Z
2022-01-20T23:17:18.000Z
Include/SA/Render/Base/Texture/RawCubemap.hpp
SapphireSuite/Engine
f29821853aec6118508f31d3e063e83e603f52dd
[ "MIT" ]
null
null
null
Include/SA/Render/Base/Texture/RawCubemap.hpp
SapphireSuite/Engine
f29821853aec6118508f31d3e063e83e603f52dd
[ "MIT" ]
null
null
null
// Copyright (c) 2021 Sapphire's Suite. All Rights Reserved. #pragma once #ifndef SAPPHIRE_RENDER_RAW_CUBEMAP_GUARD #define SAPPHIRE_RENDER_RAW_CUBEMAP_GUARD #include <SA/Render/Base/Texture/RawTexture.hpp> namespace Sa { struct RawCubemap : public RawTexture { std::vector<char> irradiancemapData; // Maximum rough level used for IBL. Generate as much mipmaps. static const uint32 maxRoughLevel; // Compute original map size in format unit. uint64 GetMapSize() const noexcept; // Compute total map size (including mipmaps) in format unit. uint64 GetTotalMapSize() const noexcept; void Reset() override final; }; } #endif // GUARD
20.060606
64
0.753776
[ "render", "vector" ]
1fb866e601c8cbec8c7bfe5767b368b38a06f6ef
1,236
hpp
C++
PlatformerEngine/core/Map.hpp
pixelpicosean/PlatformerEngine
2093289bac9fd7de53bfa64a445c05c3d30dff86
[ "MIT" ]
1
2020-11-03T16:04:25.000Z
2020-11-03T16:04:25.000Z
PlatformerEngine/core/Map.hpp
pixelpicosean/PlatformerEngine
2093289bac9fd7de53bfa64a445c05c3d30dff86
[ "MIT" ]
null
null
null
PlatformerEngine/core/Map.hpp
pixelpicosean/PlatformerEngine
2093289bac9fd7de53bfa64a445c05c3d30dff86
[ "MIT" ]
null
null
null
// // Map.hpp // PlatformerEngine // // Created by Sean on 10/3/16. // Copyright © 2016 Sean. All rights reserved. // #ifndef Map_hpp #define Map_hpp #include <vector> #include <SFML/Graphics.hpp> using namespace sf; typedef int TileType; const TileType EMPTY = 0; const TileType BLOCK = 1; const TileType ONE_WAY = 2; class Map { public: int width = 80; int height = 60; const int tilesize = 16; Vector2f position; public: Map(float x, float y, const std::vector<std::vector<TileType> >& tiles); // Property setters void SetPosition(float x, float y); // Tile <-> Position Vector2i GetMapTileAtPoint(float x, float y); int GetMapTileXAtPoint(float x); int GetMapTileYAtPoint(float y); Vector2f GetMapTilePosition(int x, int y); // Tile info TileType GetTile(int x, int y); bool IsObstacle(int x, int y); bool IsGround(int x, int y); bool IsOneWayPlatform(int x, int y); bool IsEmpty(int x, int y); // Tick and Render void Draw(sf::RenderTarget& frame); private: std::vector<std::vector<TileType> > tiles; // Dev drawing properties std::vector<std::vector<sf::RectangleShape> > tileShapes; }; #endif /* Map_hpp */
19.935484
76
0.654531
[ "render", "vector" ]
1fb9933db5605770f3aef66ebd01a31568c3b589
705
hh
C++
extern/typed-geometry/src/typed-geometry/detail/operators/ops_size.hh
rovedit/Fort-Candle
445fb94852df56c279c71b95c820500e7fb33cf7
[ "MIT" ]
null
null
null
extern/typed-geometry/src/typed-geometry/detail/operators/ops_size.hh
rovedit/Fort-Candle
445fb94852df56c279c71b95c820500e7fb33cf7
[ "MIT" ]
null
null
null
extern/typed-geometry/src/typed-geometry/detail/operators/ops_size.hh
rovedit/Fort-Candle
445fb94852df56c279c71b95c820500e7fb33cf7
[ "MIT" ]
null
null
null
#pragma once #include <typed-geometry/detail/macros.hh> #include <typed-geometry/detail/scalar_traits.hh> #include <typed-geometry/types/size.hh> namespace tg { // size +- size = size TG_IMPL_DEFINE_BINARY_OP(size, size, size, +); TG_IMPL_DEFINE_BINARY_OP(size, size, size, -); // size */ size = size TG_IMPL_DEFINE_BINARY_OP(size, size, size, *); TG_IMPL_DEFINE_BINARY_OP(size, size, size, /); // +size, -size TG_IMPL_DEFINE_UNARY_OP(size, +); TG_IMPL_DEFINE_UNARY_OP(size, -); // scalar OP size, size OP scalar TG_IMPL_DEFINE_BINARY_OP_SCALAR(size, -); TG_IMPL_DEFINE_BINARY_OP_SCALAR(size, +); TG_IMPL_DEFINE_BINARY_OP_SCALAR(size, *); TG_IMPL_DEFINE_BINARY_OP_SCALAR_DIV(size); } // namespace tg
26.111111
49
0.760284
[ "geometry" ]
1fc07e85eecac95c015fbb330f77856f43a15c68
913
cpp
C++
src/sfml-test.cpp
ChristianFrisson/mxe
3451656eb93f3f31ab24f388409aadef6bcafcaf
[ "MIT" ]
4
2017-08-12T08:03:47.000Z
2019-10-08T13:21:54.000Z
src/sfml-test.cpp
ChristianFrisson/mxe
3451656eb93f3f31ab24f388409aadef6bcafcaf
[ "MIT" ]
null
null
null
src/sfml-test.cpp
ChristianFrisson/mxe
3451656eb93f3f31ab24f388409aadef6bcafcaf
[ "MIT" ]
4
2015-02-04T00:24:38.000Z
2018-11-24T12:40:31.000Z
/* * This file is part of MXE. * See index.html for further information. */ #include <SFML/Audio.hpp> #include <SFML/Network.hpp> #include <SFML/Graphics.hpp> using namespace sf; int main() { // Create the main window RenderWindow window(VideoMode(800, 600), "SFML window"); Music music; Texture texture; Font font; Text text; TcpSocket socket; CircleShape shape(200); shape.setPosition(200, 100); shape.setFillColor(Color::Red); while (window.isOpen()) { // Process events Event event; while (window.pollEvent(event)) { // Close window : exit if (event.type == Event::Closed) window.close(); } // Clear screen window.clear(); // Draw the sprite window.draw(shape); // Update the window window.display(); } return 0; }
19.425532
60
0.56736
[ "shape" ]
1fc28c9f176eb175cd166d84912b267dc46337d1
4,179
cpp
C++
src/soulblight/BelladammaVolga.cpp
rweyrauch/AoSSimulator
d2bfbbe0fab904cc543f1a01e62e0b82cf67c27b
[ "MIT" ]
5
2019-02-01T01:41:19.000Z
2021-06-17T02:16:13.000Z
src/soulblight/BelladammaVolga.cpp
rweyrauch/AoSSimulator
d2bfbbe0fab904cc543f1a01e62e0b82cf67c27b
[ "MIT" ]
2
2020-01-14T16:57:42.000Z
2021-04-01T00:53:18.000Z
src/soulblight/BelladammaVolga.cpp
rweyrauch/AoSSimulator
d2bfbbe0fab904cc543f1a01e62e0b82cf67c27b
[ "MIT" ]
1
2019-03-02T20:03:51.000Z
2019-03-02T20:03:51.000Z
/* * Warhammer Age of Sigmar battle simulator. * * Copyright (C) 2021 by Rick Weyrauch - rpweyrauch@gmail.com * * This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT) */ #include <soulblight/BelladammaVolga.h> #include <UnitFactory.h> #include <spells/MysticShield.h> #include <Board.h> #include "SoulblightGravelordsPrivate.h" #include "Lore.h" namespace Soulblight { static const int g_basesize = 50; static const int g_wounds = 9; static const int g_pointsPerUnit = 200; bool BelladammaVolga::s_registered = false; Unit *BelladammaVolga::Create(const ParameterList &parameters) { auto lore = (Lore) GetEnumParam("Lore", parameters, g_vampireLore[0]); auto general = GetBoolParam("General", parameters, false); return new BelladammaVolga(lore, general); } int BelladammaVolga::ComputePoints(const ParameterList &parameters) { return g_pointsPerUnit; } void BelladammaVolga::Init() { if (!s_registered) { static FactoryMethod factoryMethod = { Create, SoulblightBase::ValueToString, SoulblightBase::EnumStringToInt, ComputePoints, { EnumParameter("Lore", g_vampireLore[0], g_vampireLore), BoolParameter("General") }, DEATH, {SOULBLIGHT_GRAVELORDS} }; s_registered = UnitFactory::Register("Belladamma Volga", factoryMethod); } } BelladammaVolga::BelladammaVolga(Lore lore, bool isGeneral) : SoulblightBase(CursedBloodline::Vyrkos_Dynasty, "Belladamma Volga", 10, g_wounds, 10, 4, false, g_pointsPerUnit) { m_keywords = {DEATH, VAMPIRE, SOULBLIGHT_GRAVELORDS, VYRKOS_DYNASTY, HERO, WIZARD, BELLADAMMA_VOLGA}; m_weapons = {&m_scimatar, &m_fangsAndClaws}; m_battleFieldRole = Role::Leader; m_totalSpells = 2; m_totalUnbinds = 2; setGeneral(isGeneral); auto model = new Model(g_basesize, wounds()); model->addMeleeWeapon(&m_scimatar); model->addMeleeWeapon(&m_fangsAndClaws); model->setName("Belladamma Volga"); addModel(model); m_knownSpells.push_back(std::unique_ptr<Spell>(CreateLore(lore, this))); m_knownSpells.push_back(std::unique_ptr<Spell>(CreateArcaneBolt(this))); m_knownSpells.push_back(std::make_unique<MysticShield>(this)); } void BelladammaVolga::onEndCombat(PlayerId player) { // The Hunger if (m_currentRecord.m_enemyModelsSlain > 0) heal(Dice::RollD3()); SoulblightBase::onEndCombat(player); } int BelladammaVolga::castingModifier() const { auto mod = SoulblightBase::castingModifier(); // First of the Vyrkos return mod+1; } int BelladammaVolga::unbindingModifier() const { auto mod = SoulblightBase::unbindingModifier(); // First of the Vyrkos return mod+1; } Wounds BelladammaVolga::applyWoundSave(const Wounds &wounds, Unit *attackingUnit) { Wounds remainingWounds = wounds; auto wolves = Board::Instance()->getUnitsWithKeyword(owningPlayer(), DIRE_WOLVES); for (auto unit : wolves) { if (distanceTo(unit) <= 3.0) { while ((remainingWounds.normal > 0) && (unit->remainingModels() > 0)) { // Pass wounds to dire wolves units unit->applyDamage({1, 0, Wounds::Source::Ability, nullptr}, this); remainingWounds.normal--; } while ((remainingWounds.mortal > 0) && (unit->remainingModels() > 0)) { // Pass mortal wounds to dire wolves units unit->applyDamage({0, 1, Wounds::Source::Ability, nullptr}, this); remainingWounds.mortal--; } } if (remainingWounds.zero()) break; } return SoulblightBase::applyWoundSave(remainingWounds, attackingUnit); } } // namespace Soulblight
36.33913
126
0.610433
[ "model" ]
1fc2a5882bb285aa3bc8f2b8226c60cb733e9acc
860
hpp
C++
C++/Multiplayer/Step 5 - Weapons/shared/entities/Create.hpp
ProfPorkins/GameTech
aa45062d9003c593bf19f65708efcb99a13063c3
[ "MIT" ]
13
2016-07-14T16:27:25.000Z
2021-03-31T23:32:46.000Z
C++/Multiplayer/Step 5 - Weapons/shared/entities/Create.hpp
ProfPorkins/GameTech
aa45062d9003c593bf19f65708efcb99a13063c3
[ "MIT" ]
5
2018-03-22T16:11:39.000Z
2021-05-30T16:34:06.000Z
C++/Multiplayer/Step 5 - Weapons/shared/entities/Create.hpp
ProfPorkins/GameTech
aa45062d9003c593bf19f65708efcb99a13063c3
[ "MIT" ]
6
2018-03-22T16:00:02.000Z
2020-04-11T12:46:23.000Z
#pragma once #include "entities/Entity.hpp" #include "misc/math.hpp" #include <chrono> #include <memory> #include <string> // -------------------------------------------------------------- // // Function to create a player entity // // -------------------------------------------------------------- namespace entities::player { std::shared_ptr<Entity> create(std::string texture, math::Vector2f position, float size, float thrustRate, float rotateRate, math::Vector2f momentum, float health); } // -------------------------------------------------------------- // // Function to create an explosion entity // // -------------------------------------------------------------- namespace entities::explosion { std::shared_ptr<Entity> create(std::string texture, math::Vector2f position, float size, std::vector<std::chrono::milliseconds> spriteTime); }
31.851852
168
0.515116
[ "vector" ]
1fc5de23c85165d1960bc3d5fe90008c71b5c4da
1,361
cpp
C++
crack-data-structures-and-algorithms/leetcode/clone_graph_q133.cpp
Watch-Later/Eureka
3065e76d5bf8b37d5de4f9ee75b2714a42dd4c35
[ "MIT" ]
20
2016-05-16T11:09:04.000Z
2021-12-08T09:30:33.000Z
crack-data-structures-and-algorithms/leetcode/clone_graph_q133.cpp
Watch-Later/Eureka
3065e76d5bf8b37d5de4f9ee75b2714a42dd4c35
[ "MIT" ]
1
2018-12-30T09:55:31.000Z
2018-12-30T14:08:30.000Z
crack-data-structures-and-algorithms/leetcode/clone_graph_q133.cpp
Watch-Later/Eureka
3065e76d5bf8b37d5de4f9ee75b2714a42dd4c35
[ "MIT" ]
11
2016-05-02T09:17:12.000Z
2021-12-08T09:30:35.000Z
#include <deque> #include <unordered_map> using namespace std; // Definition for a Node. class Node { public: int val; vector<Node*> neighbors; Node() { val = 0; neighbors = vector<Node*>(); } Node(int _val) { val = _val; neighbors = vector<Node*>(); } Node(int _val, vector<Node*> _neighbors) { val = _val; neighbors = _neighbors; } }; // 核心思路 // 使用一个 hash-table 维护源结点 node 到其克隆结点的映射 // 利用 BFS 每次从队列弹出一个原结点src,然后将src的neib结点逐个克隆到clone的neib去 // 如果有个neib不在映射表里,说明之前没有处理过,需要加入pending队列进行后续遍历处理 class Solution { public: Node* cloneGraph(Node* node) { if (!node) { return nullptr; } unordered_map<Node*, Node*> table; table[node] = new Node(node->val); deque<Node*> pending {node}; while (!pending.empty()) { auto cur = pending.front(); pending.pop_front(); for (auto neib : cur->neighbors) { // neib node hasn't processed yet. // add it into pending list. if (table.count(neib) == 0) { table[neib] = new Node(neib->val); pending.push_back(neib); } table[cur]->neighbors.push_back(table[neib]); } } return table[node]; } };
22.311475
61
0.525349
[ "vector" ]
1fcfdd0090cd094f42fa463aa688792030eccd38
8,337
cpp
C++
src/watchman.cpp
tidev/winreglib
86e303b1f2763939d7427e24d6d30bc6358a3ff8
[ "Apache-2.0" ]
2
2022-03-10T12:41:09.000Z
2022-03-10T12:41:23.000Z
src/watchman.cpp
tidev/winreglib
86e303b1f2763939d7427e24d6d30bc6358a3ff8
[ "Apache-2.0" ]
2
2019-09-08T11:18:52.000Z
2021-08-31T19:52:08.000Z
src/watchman.cpp
tidev/winreglib
86e303b1f2763939d7427e24d6d30bc6358a3ff8
[ "Apache-2.0" ]
2
2019-09-08T11:19:09.000Z
2021-09-10T11:47:50.000Z
#include "watchman.h" #include <list> #include <node_api.h> #include <sstream> using namespace winreglib; static void execute(napi_env env, void* data) { ((Watchman*)data)->run(); } static void complete(napi_env env, napi_status status, void* data) { LOG_DEBUG("Watchman::complete", L"Worker thread exited") } /** * Creates the default signal events, initializes the subkeys in the watcher tree, initializes the * background thread, and wires up the notification callback when a registry change occurs. */ Watchman::Watchman(napi_env env) : env(env) { // create the built-in events for controlling the background thread term = ::CreateEvent(NULL, FALSE, FALSE, NULL); refresh = ::CreateEvent(NULL, FALSE, FALSE, NULL); // initialize the root subkeys root = std::make_shared<WatchNode>(env); for (auto const& it : rootKeys) { root->addSubkey(it.first, it.second); } // initialize the background thread that waits for win32 events LOG_DEBUG_THREAD_ID("Watchman", L"Initializing async work") napi_value name; NAPI_THROW("Watchman", "ERR_NAPI_CREATE_STRING", ::napi_create_string_utf8(env, "winreglib.runloop", NAPI_AUTO_LENGTH, &name)); NAPI_THROW("Watchman", "ERR_NAPI_CREATE_ASYNC_WORK", ::napi_create_async_work(env, NULL, name, execute, complete, this, &asyncWork)); // wire up our dispatch change handler into Node's event loop, then unref it so that we don't // block Node from exiting uv_loop_t* loop; ::napi_get_uv_event_loop(env, &loop); notifyChange.data = this; ::uv_async_init(loop, &notifyChange, [](uv_async_t* handle) { ((Watchman*)handle->data)->dispatch(); }); ::uv_unref((uv_handle_t*)&notifyChange); } /** * Stops the background thread and closes all handles. */ Watchman::~Watchman() { ::SetEvent(term); ::napi_delete_async_work(env, asyncWork); ::CloseHandle(term); ::CloseHandle(refresh); ::uv_close((uv_handle_t*)&notifyChange, NULL); } /** * Constructs the watcher tree and adds the listener callback to the watched node. Starts the * background thread that waits for win32 to signal an event. */ void Watchman::config(const std::wstring& key, napi_value listener, WatchAction action) { if (action == Watch) { LOG_DEBUG_1("Watchman::config", L"Adding \"%ls\"", key.c_str()) } else { LOG_DEBUG_1("Watchman::config", L"Removing \"%ls\"", key.c_str()) } std::shared_ptr<WatchNode> node(root); std::wstring name; std::wstringstream wss(key); DWORD beforeCount = 0; DWORD afterCount = 0; { std::lock_guard<std::mutex> lock(activeLock); afterCount = beforeCount = active.size(); } // parse the key while walking the watcher tree while (std::getline(wss, name, L'\\')) { auto it = node->subkeys.find(name); if (it == node->subkeys.end()) { // not found if (action == Watch) { // we're watching, so add the node node = node->addSubkey(name, node); ++afterCount; std::lock_guard<std::mutex> lock(activeLock); active.push_back(std::weak_ptr<WatchNode>(node)); } else { // node does not exist, nothing to remove LOG_DEBUG_1("Watchman::config", L"Node \"%ls\" does not exist", name.c_str()) return; } } else { node = it->second; } } if (action == Watch) { // add the listener to the node node->addListener(listener); } else { // remove the listener from the node node->removeListener(listener); // prune the tree by blowing away an while (node->parent && node->listeners.size() == 0 && node->subkeys.size() == 0) { LOG_DEBUG_1("Watchman::config", L"Erasing node \"%ls\" from parent", node->name.c_str()) // remove from the active list std::lock_guard<std::mutex> lock(activeLock); for (auto it = active.begin(); it != active.end(); ) { auto activeNode = (*it).lock(); if (activeNode && activeNode != node) { ++it; } else { it = active.erase(it); --afterCount; } } // remove the node from its parent's subkeys map node->parent->subkeys.erase(node->name); node = node->parent; LOG_DEBUG_2("Watchman::config", L"Parent \"%ls\" now has %ld subkeys", node->name.c_str(), (uint32_t)node->subkeys.size()) } } if (beforeCount == 0 && afterCount > 0) { LOG_DEBUG_THREAD_ID("Watchman::config", L"Starting background thread") NAPI_THROW("Watchman::config", "ERR_NAPI_QUEUE_ASYNC_WORK", ::napi_queue_async_work(env, asyncWork)) } else if (beforeCount > 0 && afterCount == 0) { LOG_DEBUG_THREAD_ID("Watchman::config", L"Signalling term event") ::SetEvent(term); } else if (beforeCount != afterCount) { LOG_DEBUG_THREAD_ID("Watchman::config", L"Signalling refresh event") ::SetEvent(refresh); } printTree(); } /** * Emits registry change events. This function is invoked by libuv on the main thread when a change * notification is sent from the background thread. */ void Watchman::dispatch() { LOG_DEBUG_THREAD_ID("Watchman::dispatch", L"Dispatching changes") while (1) { std::shared_ptr<WatchNode> node; DWORD count = 0; // check if there are any changed nodes left... // the first time we loop, we know there's at least one { std::lock_guard<std::mutex> lock(changedNodesLock); if (changedNodes.empty()) { break; } count = changedNodes.size(); node = changedNodes.front(); changedNodes.pop_front(); } LOG_DEBUG_2("Watchman::dispatch", L"Dispatching change event for \"%ls\" (%d pending)", node->name.c_str(), --count) if (node->onChange()) { printTree(); } } } /** * Prints the watcher tree for debugging. */ void Watchman::printTree() { std::wstringstream wss(L""); std::wstring line; root->print(wss); while (std::getline(wss, line, L'\n')) { WLOG_DEBUG("Watchman::printTree", line) } } /** * The background thread that waits for an event (e.g. registry change) to be signaled and notifies * the main thread of changed nodes to emit events for. */ void Watchman::run() { LOG_DEBUG_THREAD_ID("Watchman::run", L"Initializing run loop") HANDLE* handles = NULL; DWORD count = 0; DWORD idx = 0; std::vector<std::weak_ptr<WatchNode>> activeCopy; // make a copy of all active nodes since we need to preserve the order to know which node // changed based on the handle index { std::lock_guard<std::mutex> lock(activeLock); LOG_DEBUG_1("Watchman::run", L"Populating active copy (count=%ld)", (uint32_t)active.size()) activeCopy = active; } while (1) { if (handles != NULL) { delete[] handles; } // WaitForMultipleObjects() wants an array of handles, so we must construct one idx = 0; count = activeCopy.size() + 2; handles = new HANDLE[count]; handles[idx++] = term; handles[idx++] = refresh; for (auto it = activeCopy.begin(); it != activeCopy.end(); ) { if (auto node = (*it).lock()) { handles[idx++] = node->hevent; ++it; } else { it = activeCopy.erase(it); --count; } } LOG_DEBUG_1("Watchman::run", L"Waiting on %ld objects...", count) DWORD result = ::WaitForMultipleObjects(count, handles, FALSE, INFINITE); if (result == WAIT_OBJECT_0) { // terminate LOG_DEBUG("Watchman::run", L"Received terminate signal") break; } if (result == WAIT_FAILED) { LOG_DEBUG_WIN32_ERROR("Watchman::run", L"WaitForMultipleObjects failed: ", ::GetLastError()) } else { idx = result - WAIT_OBJECT_0; if (idx > 0 && idx < count) { if (result == WAIT_OBJECT_0 + 1) { // doing a refresh { std::lock_guard<std::mutex> lock(activeLock); LOG_DEBUG_1("Watchman::run", L"Refreshing %ld handles", (uint32_t)active.size()) activeCopy = active; } } else { // something changed // first two indices are the term and refresh events, so skip those idx -= 2; if (auto node = activeCopy[idx].lock()) { LOG_DEBUG_2("Watchman::run", L"Detected change \"%ls\" [%ld]", node->name.c_str(), idx) { std::lock_guard<std::mutex> lock(changedNodesLock); if (std::find(changedNodes.begin(), changedNodes.end(), node) != changedNodes.end()) { LOG_DEBUG_1("Watchman::run", L"Node \"%ls\" is already in the changed list", node->name.c_str()) } else { LOG_DEBUG_1("Watchman::run", L"Adding node \"%ls\" to the changed list", node->name.c_str()) changedNodes.push_back(node); } } ::uv_async_send(&notifyChange); } } } } } delete[] handles; }
29.88172
134
0.665107
[ "vector" ]
9511fcbf8bee824854859c9893a5efa243b18688
1,229
cpp
C++
src/processor.cpp
Gary9/CppND-System-Monitor
111dfe73c1eef79139cd85854e27bfe1e3811897
[ "MIT" ]
null
null
null
src/processor.cpp
Gary9/CppND-System-Monitor
111dfe73c1eef79139cd85854e27bfe1e3811897
[ "MIT" ]
null
null
null
src/processor.cpp
Gary9/CppND-System-Monitor
111dfe73c1eef79139cd85854e27bfe1e3811897
[ "MIT" ]
null
null
null
#include "processor.h" #include <iostream> #include <vector> // Return the aggregate CPU utilization //With help from https://stackoverflow.com/questions/23367857/accurate-calculation-of-cpu-usage-given-in-percentage-in-linux float Processor::Utilization() { Jiffies(LinuxParser::CpuUtilization()) ; std::vector<float> times = Jiffies(); float PrevIdle = PrevIdel() + PrevIowait(); float Idle = times.at(3) +times.at(4); float PrevNonIdle = PrevUser() + PrevNice() + PrevSystem() + PrevIrq() + PrevSoftirq() + PrevSteal(); float NonIdle = times.at(0) + times.at(1)+times.at(2)+times.at(5)+times.at(6)+times.at(7); float PrevTotal = PrevIdle + PrevNonIdle; float Total = Idle + NonIdle; float totalDiff = Total - PrevTotal; float idleDiff = Idle - PrevIdle; float result = (totalDiff - idleDiff)/totalDiff; PrevUser(times.at(0)); PrevNice(times.at(1)); PrevSystem(times.at(2)); PrevIdel(times.at(3)); PrevIowait(times.at(4)); PrevIrq(times.at(5)); PrevSoftirq(times.at(6)); PrevSteal(times.at(7)); PrevGuest(times.at(8)); PrevGuestnice(times.at(9)); return result; }
32.342105
124
0.632221
[ "vector" ]
95166e1e76344a7aa13bd9b98a115f63dc180dc5
536
cpp
C++
LeetCode/Solutions/LC0859.cpp
Mohammed-Shoaib/HackerRank-Problems
ccfb9fc2f0d8dff454439d75ce519cf83bad7c3b
[ "MIT" ]
54
2019-05-13T12:13:09.000Z
2022-02-27T02:59:00.000Z
LeetCode/Solutions/LC0859.cpp
Mohammed-Shoaib/HackerRank-Problems
ccfb9fc2f0d8dff454439d75ce519cf83bad7c3b
[ "MIT" ]
2
2020-10-02T07:16:43.000Z
2020-10-19T04:36:19.000Z
LeetCode/Solutions/LC0859.cpp
Mohammed-Shoaib/HackerRank-Problems
ccfb9fc2f0d8dff454439d75ce519cf83bad7c3b
[ "MIT" ]
20
2020-05-26T09:48:13.000Z
2022-03-18T15:18:27.000Z
/* Problem Statement: https://leetcode.com/problems/buddy-strings/ Time: O(n) Space: O(26) Author: Mohammed Shoaib, github.com/Mohammed-Shoaib */ class Solution { public: bool buddyStrings(string A, string B) { bool dup = false; int swaps = 0, n = A.length(); vector<int> freq_a(26), freq_b(26); if (n != B.length()) return false; for (int i = 0; i < n; i++) { freq_a[A[i] - 'a']++; dup |= freq_b[B[i] - 'a']++; swaps += (A[i] != B[i]); } return swaps ? (swaps == 2 && freq_a == freq_b) : dup; } };
20.615385
63
0.570896
[ "vector" ]
95186cff6506cc40134706a751b72789c7d66379
5,634
cpp
C++
as/src/v20180419/model/CreateAutoScalingGroupFromInstanceRequest.cpp
suluner/tencentcloud-sdk-cpp
a56c73cc3f488c4d1e10755704107bb15c5e000d
[ "Apache-2.0" ]
43
2019-08-14T08:14:12.000Z
2022-03-30T12:35:09.000Z
as/src/v20180419/model/CreateAutoScalingGroupFromInstanceRequest.cpp
suluner/tencentcloud-sdk-cpp
a56c73cc3f488c4d1e10755704107bb15c5e000d
[ "Apache-2.0" ]
12
2019-07-15T10:44:59.000Z
2021-11-02T12:35:00.000Z
as/src/v20180419/model/CreateAutoScalingGroupFromInstanceRequest.cpp
suluner/tencentcloud-sdk-cpp
a56c73cc3f488c4d1e10755704107bb15c5e000d
[ "Apache-2.0" ]
28
2019-07-12T09:06:22.000Z
2022-03-30T08:04:18.000Z
/* * Copyright (c) 2017-2019 THL A29 Limited, a Tencent company. All Rights Reserved. * * 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. */ #include <tencentcloud/as/v20180419/model/CreateAutoScalingGroupFromInstanceRequest.h> #include <tencentcloud/core/utils/rapidjson/document.h> #include <tencentcloud/core/utils/rapidjson/writer.h> #include <tencentcloud/core/utils/rapidjson/stringbuffer.h> using namespace TencentCloud::As::V20180419::Model; using namespace std; CreateAutoScalingGroupFromInstanceRequest::CreateAutoScalingGroupFromInstanceRequest() : m_autoScalingGroupNameHasBeenSet(false), m_instanceIdHasBeenSet(false), m_minSizeHasBeenSet(false), m_maxSizeHasBeenSet(false), m_desiredCapacityHasBeenSet(false), m_inheritInstanceTagHasBeenSet(false) { } string CreateAutoScalingGroupFromInstanceRequest::ToJsonString() const { rapidjson::Document d; d.SetObject(); rapidjson::Document::AllocatorType& allocator = d.GetAllocator(); if (m_autoScalingGroupNameHasBeenSet) { rapidjson::Value iKey(rapidjson::kStringType); string key = "AutoScalingGroupName"; iKey.SetString(key.c_str(), allocator); d.AddMember(iKey, rapidjson::Value(m_autoScalingGroupName.c_str(), allocator).Move(), allocator); } if (m_instanceIdHasBeenSet) { rapidjson::Value iKey(rapidjson::kStringType); string key = "InstanceId"; iKey.SetString(key.c_str(), allocator); d.AddMember(iKey, rapidjson::Value(m_instanceId.c_str(), allocator).Move(), allocator); } if (m_minSizeHasBeenSet) { rapidjson::Value iKey(rapidjson::kStringType); string key = "MinSize"; iKey.SetString(key.c_str(), allocator); d.AddMember(iKey, m_minSize, allocator); } if (m_maxSizeHasBeenSet) { rapidjson::Value iKey(rapidjson::kStringType); string key = "MaxSize"; iKey.SetString(key.c_str(), allocator); d.AddMember(iKey, m_maxSize, allocator); } if (m_desiredCapacityHasBeenSet) { rapidjson::Value iKey(rapidjson::kStringType); string key = "DesiredCapacity"; iKey.SetString(key.c_str(), allocator); d.AddMember(iKey, m_desiredCapacity, allocator); } if (m_inheritInstanceTagHasBeenSet) { rapidjson::Value iKey(rapidjson::kStringType); string key = "InheritInstanceTag"; iKey.SetString(key.c_str(), allocator); d.AddMember(iKey, m_inheritInstanceTag, allocator); } rapidjson::StringBuffer buffer; rapidjson::Writer<rapidjson::StringBuffer> writer(buffer); d.Accept(writer); return buffer.GetString(); } string CreateAutoScalingGroupFromInstanceRequest::GetAutoScalingGroupName() const { return m_autoScalingGroupName; } void CreateAutoScalingGroupFromInstanceRequest::SetAutoScalingGroupName(const string& _autoScalingGroupName) { m_autoScalingGroupName = _autoScalingGroupName; m_autoScalingGroupNameHasBeenSet = true; } bool CreateAutoScalingGroupFromInstanceRequest::AutoScalingGroupNameHasBeenSet() const { return m_autoScalingGroupNameHasBeenSet; } string CreateAutoScalingGroupFromInstanceRequest::GetInstanceId() const { return m_instanceId; } void CreateAutoScalingGroupFromInstanceRequest::SetInstanceId(const string& _instanceId) { m_instanceId = _instanceId; m_instanceIdHasBeenSet = true; } bool CreateAutoScalingGroupFromInstanceRequest::InstanceIdHasBeenSet() const { return m_instanceIdHasBeenSet; } int64_t CreateAutoScalingGroupFromInstanceRequest::GetMinSize() const { return m_minSize; } void CreateAutoScalingGroupFromInstanceRequest::SetMinSize(const int64_t& _minSize) { m_minSize = _minSize; m_minSizeHasBeenSet = true; } bool CreateAutoScalingGroupFromInstanceRequest::MinSizeHasBeenSet() const { return m_minSizeHasBeenSet; } int64_t CreateAutoScalingGroupFromInstanceRequest::GetMaxSize() const { return m_maxSize; } void CreateAutoScalingGroupFromInstanceRequest::SetMaxSize(const int64_t& _maxSize) { m_maxSize = _maxSize; m_maxSizeHasBeenSet = true; } bool CreateAutoScalingGroupFromInstanceRequest::MaxSizeHasBeenSet() const { return m_maxSizeHasBeenSet; } int64_t CreateAutoScalingGroupFromInstanceRequest::GetDesiredCapacity() const { return m_desiredCapacity; } void CreateAutoScalingGroupFromInstanceRequest::SetDesiredCapacity(const int64_t& _desiredCapacity) { m_desiredCapacity = _desiredCapacity; m_desiredCapacityHasBeenSet = true; } bool CreateAutoScalingGroupFromInstanceRequest::DesiredCapacityHasBeenSet() const { return m_desiredCapacityHasBeenSet; } bool CreateAutoScalingGroupFromInstanceRequest::GetInheritInstanceTag() const { return m_inheritInstanceTag; } void CreateAutoScalingGroupFromInstanceRequest::SetInheritInstanceTag(const bool& _inheritInstanceTag) { m_inheritInstanceTag = _inheritInstanceTag; m_inheritInstanceTagHasBeenSet = true; } bool CreateAutoScalingGroupFromInstanceRequest::InheritInstanceTagHasBeenSet() const { return m_inheritInstanceTagHasBeenSet; }
28.892308
108
0.758786
[ "model" ]
9523b862936eaaee667042c47d9882710a8e4e9c
1,447
cpp
C++
cpp/leetcode/GrumpyBookstore.cpp
danyfang/SourceCode
8168f6058648f2a330a7354daf3a73a4d8a4e730
[ "MIT" ]
null
null
null
cpp/leetcode/GrumpyBookstore.cpp
danyfang/SourceCode
8168f6058648f2a330a7354daf3a73a4d8a4e730
[ "MIT" ]
null
null
null
cpp/leetcode/GrumpyBookstore.cpp
danyfang/SourceCode
8168f6058648f2a330a7354daf3a73a4d8a4e730
[ "MIT" ]
null
null
null
//Leetcode Problem No 1052. Grumpy Bookstore Owner //Solution written by Xuqiang Fang on 26 May, 2019 #include <iostream> #include <vector> #include <string> #include <algorithm> #include <unordered_map> #include <unordered_set> #include <stack> #include <queue> using namespace std; class Solution { public: int maxSatisfied(vector<int>& cus, vector<int>& g, int X) { int ans = 0; const int n = cus.size(); vector<int> extra(n-X+1, 0); for(int i=0; i<n; ++i){ if(g[i] == 0){ ans += cus[i]; } if(i < X && g[i] == 1){ extra[0] += cus[i]; } } auto m = extra[0]; for(int i=X; i<n; ++i){ if(g[i] == 1 ){ if(g[i-X] == 0){ extra[i-X+1] = extra[i-X]+cus[i]; } else{ extra[i-X+1] = cus[i]+extra[i-X]-cus[i-X]; } } else{ if(g[i-X] == 0){ extra[i-X+1] = extra[i-X]; } else{ extra[i-X+1] = extra[i-X]-cus[i-X]; } } m = max(m, extra[i-X+1]); } return ans + m; } }; int main(){ Solution s; vector<int> customers{1,0,1,2,1,1,7,5}, grumpy{0,1,0,1,0,1,0,1}; cout << s.maxSatisfied(customers, grumpy, 3) << endl; return 0; }
24.948276
66
0.422253
[ "vector" ]
95250c61abd3a58d11df9f38b8380313f162c712
4,734
cc
C++
src/modular/bin/sessionmgr/annotations.cc
EnderNightLord-ChromeBook/fuchsia-pine64-pinephone
05e2c059b57b6217089090a0315971d1735ecf57
[ "BSD-3-Clause" ]
14
2020-10-25T05:48:36.000Z
2021-09-20T02:46:20.000Z
src/modular/bin/sessionmgr/annotations.cc
JokeZhang/fuchsia
d6e9dea8dca7a1c8fa89d03e131367e284b30d23
[ "BSD-3-Clause" ]
null
null
null
src/modular/bin/sessionmgr/annotations.cc
JokeZhang/fuchsia
d6e9dea8dca7a1c8fa89d03e131367e284b30d23
[ "BSD-3-Clause" ]
2
2020-10-25T01:13:49.000Z
2020-10-26T02:32:13.000Z
// Copyright 2019 The Fuchsia Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "src/modular/bin/sessionmgr/annotations.h" namespace modular::annotations { using Annotation = fuchsia::modular::Annotation; std::vector<Annotation> Merge(std::vector<Annotation> a, std::vector<Annotation> b) { std::vector<Annotation> result; std::map<std::string, Annotation> b_by_key; std::transform(std::make_move_iterator(b.begin()), std::make_move_iterator(b.end()), std::inserter(b_by_key, b_by_key.end()), [](Annotation&& annotation) { return std::make_pair(annotation.key, std::move(annotation)); }); for (auto it = std::make_move_iterator(a.begin()); it != std::make_move_iterator(a.end()); ++it) { // Omit annotations in `a` that have `null` values. if (!it->value) { continue; } // If `b` contains an annotation with the same key, use its value, unless it's null, // in which case it's omitted. if (b_by_key.count(it->key)) { if (b_by_key[it->key].value) { result.push_back(std::move(b_by_key.at(it->key))); } continue; } result.push_back(std::move(*it)); } for (auto it = std::make_move_iterator(b_by_key.begin()); it != std::make_move_iterator(b_by_key.end()); ++it) { // Omit annotations in `b` that have `null` values. // We have already omitted the ones from `a` that have the same key. if (!it->second.value) { continue; } result.push_back(std::move(it->second)); } return result; } std::string ToInspect(const fuchsia::modular::AnnotationValue& value) { std::string text; switch (value.Which()) { case fuchsia::modular::AnnotationValue::Tag::kText: text = value.text(); break; case fuchsia::modular::AnnotationValue::Tag::kBytes: text = "bytes"; break; case fuchsia::modular::AnnotationValue::Tag::kBuffer: text = "buffer"; break; case fuchsia::modular::AnnotationValue::Tag::kUnknown: text = "unknown"; break; case fuchsia::modular::AnnotationValue::Tag::Invalid: text = "invalid"; break; } return text; } fuchsia::session::Annotation ToSessionAnnotation(const fuchsia::modular::Annotation& annotation) { std::unique_ptr<fuchsia::session::Value> value; if (annotation.value->is_buffer()) { fuchsia::mem::Buffer buffer; annotation.value->buffer().Clone(&buffer); value = std::make_unique<fuchsia::session::Value>( fuchsia::session::Value::WithBuffer(std::move(buffer))); } else { value = std::make_unique<fuchsia::session::Value>( fuchsia::session::Value::WithText(std::string{annotation.value->text()})); } return fuchsia::session::Annotation{.key = std::string{annotation.key}, .value = std::move(value)}; } fuchsia::session::Annotations ToSessionAnnotations( const std::vector<fuchsia::modular::Annotation>& annotations) { std::vector<fuchsia::session::Annotation> custom_annotations; custom_annotations.reserve(annotations.size()); for (const fuchsia::modular::Annotation& annotation : annotations) { custom_annotations.push_back(modular::annotations::ToSessionAnnotation(annotation)); } fuchsia::session::Annotations session_annotations; session_annotations.set_custom_annotations(std::move(custom_annotations)); return session_annotations; } } // namespace modular::annotations namespace session::annotations { fuchsia::modular::Annotation ToModularAnnotation(const fuchsia::session::Annotation& annotation) { std::unique_ptr<fuchsia::modular::AnnotationValue> value; if (annotation.value->is_buffer()) { fuchsia::mem::Buffer buffer; annotation.value->buffer().Clone(&buffer); value = std::make_unique<fuchsia::modular::AnnotationValue>( fuchsia::modular::AnnotationValue::WithBuffer(std::move(buffer))); } else { value = std::make_unique<fuchsia::modular::AnnotationValue>( fuchsia::modular::AnnotationValue::WithText(std::string{annotation.value->text()})); } return fuchsia::modular::Annotation{.key = annotation.key, .value = std::move(value)}; } std::vector<fuchsia::modular::Annotation> ToModularAnnotations( const fuchsia::session::Annotations& annotations) { if (!annotations.has_custom_annotations()) { return {}; } std::vector<fuchsia::modular::Annotation> modular_annotations; for (const auto& annotation : annotations.custom_annotations()) { modular_annotations.push_back(ToModularAnnotation(annotation)); } return modular_annotations; } } // namespace session::annotations
33.814286
100
0.681876
[ "vector", "transform" ]
9526f926712573728e7ae82f840efa25b19c9387
56,812
hxx
C++
xsd-4.0.0/xsd/cxx/tree/date-time.hxx
beroset/OpenADR-VEN-Library
16546464fe1dc714a126474aaadf75483ec9cbc6
[ "Apache-2.0" ]
12
2016-09-21T19:07:13.000Z
2021-12-13T06:17:36.000Z
xsd-4.0.0/xsd/cxx/tree/date-time.hxx
beroset/OpenADR-VEN-Library
16546464fe1dc714a126474aaadf75483ec9cbc6
[ "Apache-2.0" ]
21
2016-06-13T11:33:45.000Z
2017-05-23T09:46:52.000Z
xsd-4.0.0/xsd/cxx/tree/date-time.hxx
beroset/OpenADR-VEN-Library
16546464fe1dc714a126474aaadf75483ec9cbc6
[ "Apache-2.0" ]
12
2018-06-10T10:52:56.000Z
2020-12-08T15:47:13.000Z
// file : xsd/cxx/tree/date-time.hxx // copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file /** * @file * * @brief Contains C++ class definitions for the XML Schema date/time types. * * This is an internal header and is included by the generated code. You * normally should not include it directly. * */ #ifndef XSD_CXX_TREE_DATE_TIME_HXX #define XSD_CXX_TREE_DATE_TIME_HXX #include <string> #include <cstddef> // std::size_t #include <xercesc/dom/DOMAttr.hpp> #include <xercesc/dom/DOMElement.hpp> #include <xsd/cxx/tree/elements.hxx> #include <xsd/cxx/tree/istream-fwd.hxx> namespace xsd { namespace cxx { /** * @brief C++/Tree mapping runtime namespace. * * This is an internal namespace and normally should not be referenced * directly. Instead you should use the aliases for types in this * namespaces that are created in the generated code. * */ namespace tree { /** * @brief Time zone representation * * The %time_zone class represents an optional %time zone and * is used as a base class for date/time types. * * The %time zone can negative in which case both the hours and * minutes components should be negative. * * @nosubgrouping */ class time_zone { public: /** * @name Constructors */ //@{ /** * @brief Default constructor. * * This constructor initializes the instance to the 'not specified' * state. */ time_zone (); /** * @brief Initialize an instance with the hours and minutes * components. * * @param hours The %time zone hours component. * @param minutes The %time zone minutes component. */ time_zone (short hours, short minutes); //@} /** * @brief Determine if %time zone is specified. * * @return True if %time zone is specified, false otherwise. */ bool zone_present () const; /** * @brief Reset the %time zone to the 'not specified' state. * */ void zone_reset (); /** * @brief Get the hours component of the %time zone. * * @return The hours component of the %time zone. */ short zone_hours () const; /** * @brief Set the hours component of the %time zone. * * @param h The new hours component. */ void zone_hours (short h); /** * @brief Get the minutes component of the %time zone. * * @return The minutes component of the %time zone. */ short zone_minutes () const; /** * @brief Set the minutes component of the %time zone. * * @param m The new minutes component. */ void zone_minutes (short m); protected: //@cond template <typename C> void zone_parse (const C*, std::size_t); template <typename S> void zone_extract (istream<S>&); //@endcond private: bool present_; short hours_; short minutes_; }; /** * @brief %time_zone comparison operator. * * @return True if both %time zones are either not specified or * have equal hours and minutes components, false otherwise. */ bool operator== (const time_zone&, const time_zone&); /** * @brief %time_zone comparison operator. * * @return False if both %time zones are either not specified or * have equal hours and minutes components, true otherwise. */ bool operator!= (const time_zone&, const time_zone&); /** * @brief Class corresponding to the XML Schema gDay built-in type. * * The %gday class represents a day of the month with an optional * %time zone. * * @nosubgrouping */ template <typename C, typename B> class gday: public B, public time_zone { public: /** * @name Constructors */ //@{ /** * @brief Initialize an instance with the day component. * * When this constructor is used, the %time zone is left * unspecified. * * @param day The day component. */ explicit gday (unsigned short day); /** * @brief Initialize an instance with the day component and %time * zone. * * @param day The day component. * @param zone_hours The %time zone hours component. * @param zone_minutes The %time zone minutes component. */ gday (unsigned short day, short zone_hours, short zone_minutes); /** * @brief Copy constructor. * * @param x An instance to make a copy of. * @param f Flags to create the copy with. * @param c A pointer to the object that will contain the copy. * * For polymorphic object models use the _clone function instead. */ gday (const gday& x, flags f = 0, container* c = 0); /** * @brief Copy the instance polymorphically. * * @param f Flags to create the copy with. * @param c A pointer to the object that will contain the copy. * @return A pointer to the dynamically allocated copy. * * This function ensures that the dynamic type of the instance * is used for copying and should be used for polymorphic object * models instead of the copy constructor. */ virtual gday* _clone (flags f = 0, container* c = 0) const; /** * @brief Create an instance from a data representation * stream. * * @param s A stream to extract the data from. * @param f Flags to create the new instance with. * @param c A pointer to the object that will contain the new * instance. */ template <typename S> gday (istream<S>& s, flags f = 0, container* c = 0); /** * @brief Create an instance from a DOM element. * * @param e A DOM element to extract the data from. * @param f Flags to create the new instance with. * @param c A pointer to the object that will contain the new * instance. */ gday (const xercesc::DOMElement& e, flags f = 0, container* c = 0); /** * @brief Create an instance from a DOM Attribute. * * @param a A DOM attribute to extract the data from. * @param f Flags to create the new instance with. * @param c A pointer to the object that will contain the new * instance. */ gday (const xercesc::DOMAttr& a, flags f = 0, container* c = 0); /** * @brief Create an instance from a %string fragment. * * @param s A %string fragment to extract the data from. * @param e A pointer to DOM element containing the %string fragment. * @param f Flags to create the new instance with. * @param c A pointer to the object that will contain the new * instance. */ gday (const std::basic_string<C>& s, const xercesc::DOMElement* e, flags f = 0, container* c = 0); //@} public: /** * @brief Get the day component. * * @return The day component. */ unsigned short day () const; /** * @brief Set the day component. * * @param d The new day component. */ void day (unsigned short d); protected: //@cond gday (); void parse (const std::basic_string<C>&); //@endcond private: unsigned short day_; }; /** * @brief %gday comparison operator. * * @return True if the day components and %time zones are equal, false * otherwise. */ template <typename C, typename B> bool operator== (const gday<C, B>&, const gday<C, B>&); /** * @brief %gday comparison operator. * * @return False if the day components and %time zones are equal, true * otherwise. */ template <typename C, typename B> bool operator!= (const gday<C, B>&, const gday<C, B>&); /** * @brief Class corresponding to the XML Schema gMonth built-in type. * * The %gmonth class represents a month of the year with an optional * %time zone. * * @nosubgrouping */ template <typename C, typename B> class gmonth: public B, public time_zone { public: /** * @name Constructors */ //@{ /** * @brief Initialize an instance with the month component. * * When this constructor is used, the %time zone is left * unspecified. * * @param month The month component. */ explicit gmonth (unsigned short month); /** * @brief Initialize an instance with the month component and %time * zone. * * @param month The month component. * @param zone_hours The %time zone hours component. * @param zone_minutes The %time zone minutes component. */ gmonth (unsigned short month, short zone_hours, short zone_minutes); /** * @brief Copy constructor. * * @param x An instance to make a copy of. * @param f Flags to create the copy with. * @param c A pointer to the object that will contain the copy. * * For polymorphic object models use the _clone function instead. */ gmonth (const gmonth& x, flags f = 0, container* c = 0); /** * @brief Copy the instance polymorphically. * * @param f Flags to create the copy with. * @param c A pointer to the object that will contain the copy. * @return A pointer to the dynamically allocated copy. * * This function ensures that the dynamic type of the instance * is used for copying and should be used for polymorphic object * models instead of the copy constructor. */ virtual gmonth* _clone (flags f = 0, container* c = 0) const; /** * @brief Create an instance from a data representation * stream. * * @param s A stream to extract the data from. * @param f Flags to create the new instance with. * @param c A pointer to the object that will contain the new * instance. */ template <typename S> gmonth (istream<S>& s, flags f = 0, container* c = 0); /** * @brief Create an instance from a DOM element. * * @param e A DOM element to extract the data from. * @param f Flags to create the new instance with. * @param c A pointer to the object that will contain the new * instance. */ gmonth (const xercesc::DOMElement& e, flags f = 0, container* c = 0); /** * @brief Create an instance from a DOM Attribute. * * @param a A DOM attribute to extract the data from. * @param f Flags to create the new instance with. * @param c A pointer to the object that will contain the new * instance. */ gmonth (const xercesc::DOMAttr& a, flags f = 0, container* c = 0); /** * @brief Create an instance from a %string fragment. * * @param s A %string fragment to extract the data from. * @param e A pointer to DOM element containing the %string fragment. * @param f Flags to create the new instance with. * @param c A pointer to the object that will contain the new * instance. */ gmonth (const std::basic_string<C>& s, const xercesc::DOMElement* e, flags f = 0, container* c = 0); //@} public: /** * @brief Get the month component. * * @return The month component. */ unsigned short month () const; /** * @brief Set the month component. * * @param m The new month component. */ void month (unsigned short m); protected: //@cond gmonth (); void parse (const std::basic_string<C>&); //@endcond private: unsigned short month_; }; /** * @brief %gmonth comparison operator. * * @return True if the month components and %time zones are equal, false * otherwise. */ template <typename C, typename B> bool operator== (const gmonth<C, B>&, const gmonth<C, B>&); /** * @brief %gmonth comparison operator. * * @return False if the month components and %time zones are equal, true * otherwise. */ template <typename C, typename B> bool operator!= (const gmonth<C, B>&, const gmonth<C, B>&); /** * @brief Class corresponding to the XML Schema gYear built-in type. * * The %gyear class represents a year with an optional %time zone. * * @nosubgrouping */ template <typename C, typename B> class gyear: public B, public time_zone { public: /** * @name Constructors */ //@{ /** * @brief Initialize an instance with the year component. * * When this constructor is used, the %time zone is left * unspecified. * * @param year The year component. */ explicit gyear (int year); /** * @brief Initialize an instance with the year component and %time * zone. * * @param year The year component. * @param zone_hours The %time zone hours component. * @param zone_minutes The %time zone minutes component. */ gyear (int year, short zone_hours, short zone_minutes); /** * @brief Copy constructor. * * @param x An instance to make a copy of. * @param f Flags to create the copy with. * @param c A pointer to the object that will contain the copy. * * For polymorphic object models use the _clone function instead. */ gyear (const gyear& x, flags f = 0, container* c = 0); /** * @brief Copy the instance polymorphically. * * @param f Flags to create the copy with. * @param c A pointer to the object that will contain the copy. * @return A pointer to the dynamically allocated copy. * * This function ensures that the dynamic type of the instance * is used for copying and should be used for polymorphic object * models instead of the copy constructor. */ virtual gyear* _clone (flags f = 0, container* c = 0) const; /** * @brief Create an instance from a data representation * stream. * * @param s A stream to extract the data from. * @param f Flags to create the new instance with. * @param c A pointer to the object that will contain the new * instance. */ template <typename S> gyear (istream<S>& s, flags f = 0, container* c = 0); /** * @brief Create an instance from a DOM element. * * @param e A DOM element to extract the data from. * @param f Flags to create the new instance with. * @param c A pointer to the object that will contain the new * instance. */ gyear (const xercesc::DOMElement& e, flags f = 0, container* c = 0); /** * @brief Create an instance from a DOM Attribute. * * @param a A DOM attribute to extract the data from. * @param f Flags to create the new instance with. * @param c A pointer to the object that will contain the new * instance. */ gyear (const xercesc::DOMAttr& a, flags f = 0, container* c = 0); /** * @brief Create an instance from a %string fragment. * * @param s A %string fragment to extract the data from. * @param e A pointer to DOM element containing the %string fragment. * @param f Flags to create the new instance with. * @param c A pointer to the object that will contain the new * instance. */ gyear (const std::basic_string<C>& s, const xercesc::DOMElement* e, flags f = 0, container* c = 0); //@} public: /** * @brief Get the year component. * * @return The year component. */ int year () const; /** * @brief Set the year component. * * @param y The new year component. */ void year (int y); protected: //@cond gyear (); void parse (const std::basic_string<C>&); //@endcond private: int year_; }; /** * @brief %gyear comparison operator. * * @return True if the year components and %time zones are equal, false * otherwise. */ template <typename C, typename B> bool operator== (const gyear<C, B>&, const gyear<C, B>&); /** * @brief %gyear comparison operator. * * @return False if the year components and %time zones are equal, true * otherwise. */ template <typename C, typename B> bool operator!= (const gyear<C, B>&, const gyear<C, B>&); /** * @brief Class corresponding to the XML Schema gMonthDay built-in type. * * The %gmonth_day class represents day and month of the year with an * optional %time zone. * * @nosubgrouping */ template <typename C, typename B> class gmonth_day: public B, public time_zone { public: /** * @name Constructors */ //@{ /** * @brief Initialize an instance with the month and day components. * * When this constructor is used, the %time zone is left * unspecified. * * @param month The month component. * @param day The day component. */ gmonth_day (unsigned short month, unsigned short day); /** * @brief Initialize an instance with the month and day components * as well as %time zone. * * @param month The month component. * @param day The day component. * @param zone_hours The %time zone hours component. * @param zone_minutes The %time zone minutes component. */ gmonth_day (unsigned short month, unsigned short day, short zone_hours, short zone_minutes); /** * @brief Copy constructor. * * @param x An instance to make a copy of. * @param f Flags to create the copy with. * @param c A pointer to the object that will contain the copy. * * For polymorphic object models use the _clone function instead. */ gmonth_day (const gmonth_day& x, flags f = 0, container* c = 0); /** * @brief Copy the instance polymorphically. * * @param f Flags to create the copy with. * @param c A pointer to the object that will contain the copy. * @return A pointer to the dynamically allocated copy. * * This function ensures that the dynamic type of the instance * is used for copying and should be used for polymorphic object * models instead of the copy constructor. */ virtual gmonth_day* _clone (flags f = 0, container* c = 0) const; /** * @brief Create an instance from a data representation * stream. * * @param s A stream to extract the data from. * @param f Flags to create the new instance with. * @param c A pointer to the object that will contain the new * instance. */ template <typename S> gmonth_day (istream<S>& s, flags f = 0, container* c = 0); /** * @brief Create an instance from a DOM element. * * @param e A DOM element to extract the data from. * @param f Flags to create the new instance with. * @param c A pointer to the object that will contain the new * instance. */ gmonth_day (const xercesc::DOMElement& e, flags f = 0, container* c = 0); /** * @brief Create an instance from a DOM Attribute. * * @param a A DOM attribute to extract the data from. * @param f Flags to create the new instance with. * @param c A pointer to the object that will contain the new * instance. */ gmonth_day (const xercesc::DOMAttr& a, flags f = 0, container* c = 0); /** * @brief Create an instance from a %string fragment. * * @param s A %string fragment to extract the data from. * @param e A pointer to DOM element containing the %string fragment. * @param f Flags to create the new instance with. * @param c A pointer to the object that will contain the new * instance. */ gmonth_day (const std::basic_string<C>& s, const xercesc::DOMElement* e, flags f = 0, container* c = 0); //@} public: /** * @brief Get the month component. * * @return The month component. */ unsigned short month () const; /** * @brief Set the month component. * * @param m The new month component. */ void month (unsigned short m); /** * @brief Get the day component. * * @return The day component. */ unsigned short day () const; /** * @brief Set the day component. * * @param d The new day component. */ void day (unsigned short d); protected: //@cond gmonth_day (); void parse (const std::basic_string<C>&); //@endcond private: unsigned short month_; unsigned short day_; }; /** * @brief %gmonth_day comparison operator. * * @return True if the month and day components as well as %time zones * are equal, false otherwise. */ template <typename C, typename B> bool operator== (const gmonth_day<C, B>&, const gmonth_day<C, B>&); /** * @brief %gmonth_day comparison operator. * * @return False if the month and day components as well as %time zones * are equal, true otherwise. */ template <typename C, typename B> bool operator!= (const gmonth_day<C, B>&, const gmonth_day<C, B>&); /** * @brief Class corresponding to the XML Schema gYearMonth built-in * type. * * The %gyear_month class represents year and month with an optional * %time zone. * * @nosubgrouping */ template <typename C, typename B> class gyear_month: public B, public time_zone { public: /** * @name Constructors */ //@{ /** * @brief Initialize an instance with the year and month components. * * When this constructor is used, the %time zone is left * unspecified. * * @param year The year component. * @param month The month component. */ gyear_month (int year, unsigned short month); /** * @brief Initialize an instance with the year and month components * as well as %time zone. * * @param year The year component. * @param month The month component. * @param zone_hours The %time zone hours component. * @param zone_minutes The %time zone minutes component. */ gyear_month (int year, unsigned short month, short zone_hours, short zone_minutes); /** * @brief Copy constructor. * * @param x An instance to make a copy of. * @param f Flags to create the copy with. * @param c A pointer to the object that will contain the copy. * * For polymorphic object models use the _clone function instead. */ gyear_month (const gyear_month& x, flags f = 0, container* c = 0); /** * @brief Copy the instance polymorphically. * * @param f Flags to create the copy with. * @param c A pointer to the object that will contain the copy. * @return A pointer to the dynamically allocated copy. * * This function ensures that the dynamic type of the instance * is used for copying and should be used for polymorphic object * models instead of the copy constructor. */ virtual gyear_month* _clone (flags f = 0, container* c = 0) const; /** * @brief Create an instance from a data representation * stream. * * @param s A stream to extract the data from. * @param f Flags to create the new instance with. * @param c A pointer to the object that will contain the new * instance. */ template <typename S> gyear_month (istream<S>& s, flags f = 0, container* c = 0); /** * @brief Create an instance from a DOM element. * * @param e A DOM element to extract the data from. * @param f Flags to create the new instance with. * @param c A pointer to the object that will contain the new * instance. */ gyear_month (const xercesc::DOMElement& e, flags f = 0, container* c = 0); /** * @brief Create an instance from a DOM Attribute. * * @param a A DOM attribute to extract the data from. * @param f Flags to create the new instance with. * @param c A pointer to the object that will contain the new * instance. */ gyear_month (const xercesc::DOMAttr& a, flags f = 0, container* c = 0); /** * @brief Create an instance from a %string fragment. * * @param s A %string fragment to extract the data from. * @param e A pointer to DOM element containing the %string fragment. * @param f Flags to create the new instance with. * @param c A pointer to the object that will contain the new * instance. */ gyear_month (const std::basic_string<C>& s, const xercesc::DOMElement* e, flags f = 0, container* c = 0); //@} public: /** * @brief Get the year component. * * @return The year component. */ int year () const; /** * @brief Set the year component. * * @param y The new year component. */ void year (int y); /** * @brief Get the month component. * * @return The month component. */ unsigned short month () const; /** * @brief Set the month component. * * @param m The new month component. */ void month (unsigned short m); protected: //@cond gyear_month (); void parse (const std::basic_string<C>&); //@endcond private: int year_; unsigned short month_; }; /** * @brief %gyear_month comparison operator. * * @return True if the year and month components as well as %time zones * are equal, false otherwise. */ template <typename C, typename B> bool operator== (const gyear_month<C, B>&, const gyear_month<C, B>&); /** * @brief %gyear_month comparison operator. * * @return False if the year and month components as well as %time zones * are equal, true otherwise. */ template <typename C, typename B> bool operator!= (const gyear_month<C, B>&, const gyear_month<C, B>&); /** * @brief Class corresponding to the XML Schema %date built-in type. * * The %date class represents day, month, and year with an optional * %time zone. * * @nosubgrouping */ template <typename C, typename B> class date: public B, public time_zone { public: /** * @name Constructors */ //@{ /** * @brief Initialize an instance with the year, month, and day * components. * * When this constructor is used, the %time zone is left * unspecified. * * @param year The year component. * @param month The month component. * @param day The day component. */ date (int year, unsigned short month, unsigned short day); /** * @brief Initialize an instance with the year, month, and day * components as well as %time zone. * * @param year The year component. * @param month The month component. * @param day The day component. * @param zone_hours The %time zone hours component. * @param zone_minutes The %time zone minutes component. */ date (int year, unsigned short month, unsigned short day, short zone_hours, short zone_minutes); /** * @brief Copy constructor. * * @param x An instance to make a copy of. * @param f Flags to create the copy with. * @param c A pointer to the object that will contain the copy. * * For polymorphic object models use the _clone function instead. */ date (const date& x, flags f = 0, container* c = 0); /** * @brief Copy the instance polymorphically. * * @param f Flags to create the copy with. * @param c A pointer to the object that will contain the copy. * @return A pointer to the dynamically allocated copy. * * This function ensures that the dynamic type of the instance * is used for copying and should be used for polymorphic object * models instead of the copy constructor. */ virtual date* _clone (flags f = 0, container* c = 0) const; /** * @brief Create an instance from a data representation * stream. * * @param s A stream to extract the data from. * @param f Flags to create the new instance with. * @param c A pointer to the object that will contain the new * instance. */ template <typename S> date (istream<S>& s, flags f = 0, container* c = 0); /** * @brief Create an instance from a DOM element. * * @param e A DOM element to extract the data from. * @param f Flags to create the new instance with. * @param c A pointer to the object that will contain the new * instance. */ date (const xercesc::DOMElement& e, flags f = 0, container* c = 0); /** * @brief Create an instance from a DOM Attribute. * * @param a A DOM attribute to extract the data from. * @param f Flags to create the new instance with. * @param c A pointer to the object that will contain the new * instance. */ date (const xercesc::DOMAttr& a, flags f = 0, container* c = 0); /** * @brief Create an instance from a %string fragment. * * @param s A %string fragment to extract the data from. * @param e A pointer to DOM element containing the %string fragment. * @param f Flags to create the new instance with. * @param c A pointer to the object that will contain the new * instance. */ date (const std::basic_string<C>& s, const xercesc::DOMElement* e, flags f = 0, container* c = 0); //@} public: /** * @brief Get the year component. * * @return The year component. */ int year () const; /** * @brief Set the year component. * * @param y The new year component. */ void year (int y); /** * @brief Get the month component. * * @return The month component. */ unsigned short month () const; /** * @brief Set the month component. * * @param m The new month component. */ void month (unsigned short m); /** * @brief Get the day component. * * @return The day component. */ unsigned short day () const; /** * @brief Set the day component. * * @param d The new day component. */ void day (unsigned short d); protected: //@cond date (); void parse (const std::basic_string<C>&); //@endcond private: int year_; unsigned short month_; unsigned short day_; }; /** * @brief %date comparison operator. * * @return True if the year, month, and day components as well as %time * zones are equal, false otherwise. */ template <typename C, typename B> bool operator== (const date<C, B>&, const date<C, B>&); /** * @brief %date comparison operator. * * @return False if the year, month, and day components as well as %time * zones are equal, true otherwise. */ template <typename C, typename B> bool operator!= (const date<C, B>&, const date<C, B>&); /** * @brief Class corresponding to the XML Schema %time built-in type. * * The %time class represents hours, minutes, and seconds with an * optional %time zone. * * @nosubgrouping */ template <typename C, typename B> class time: public B, public time_zone { public: /** * @name Constructors */ //@{ /** * @brief Initialize an instance with the hours, minutes, and * seconds components. * * When this constructor is used, the %time zone is left * unspecified. * * @param hours The hours component. * @param minutes The minutes component. * @param seconds The seconds component. */ time (unsigned short hours, unsigned short minutes, double seconds); /** * @brief Initialize an instance with the hours, minutes, and * seconds components as well as %time zone. * * @param hours The hours component. * @param minutes The minutes component. * @param seconds The seconds component. * @param zone_hours The %time zone hours component. * @param zone_minutes The %time zone minutes component. */ time (unsigned short hours, unsigned short minutes, double seconds, short zone_hours, short zone_minutes); /** * @brief Copy constructor. * * @param x An instance to make a copy of. * @param f Flags to create the copy with. * @param c A pointer to the object that will contain the copy. * * For polymorphic object models use the _clone function instead. */ time (const time& x, flags f = 0, container* c = 0); /** * @brief Copy the instance polymorphically. * * @param f Flags to create the copy with. * @param c A pointer to the object that will contain the copy. * @return A pointer to the dynamically allocated copy. * * This function ensures that the dynamic type of the instance * is used for copying and should be used for polymorphic object * models instead of the copy constructor. */ virtual time* _clone (flags f = 0, container* c = 0) const; /** * @brief Create an instance from a data representation * stream. * * @param s A stream to extract the data from. * @param f Flags to create the new instance with. * @param c A pointer to the object that will contain the new * instance. */ template <typename S> time (istream<S>& s, flags f = 0, container* c = 0); /** * @brief Create an instance from a DOM element. * * @param e A DOM element to extract the data from. * @param f Flags to create the new instance with. * @param c A pointer to the object that will contain the new * instance. */ time (const xercesc::DOMElement& e, flags f = 0, container* c = 0); /** * @brief Create an instance from a DOM Attribute. * * @param a A DOM attribute to extract the data from. * @param f Flags to create the new instance with. * @param c A pointer to the object that will contain the new * instance. */ time (const xercesc::DOMAttr& a, flags f = 0, container* c = 0); /** * @brief Create an instance from a %string fragment. * * @param s A %string fragment to extract the data from. * @param e A pointer to DOM element containing the %string fragment. * @param f Flags to create the new instance with. * @param c A pointer to the object that will contain the new * instance. */ time (const std::basic_string<C>& s, const xercesc::DOMElement* e, flags f = 0, container* c = 0); //@} public: /** * @brief Get the hours component. * * @return The hours component. */ unsigned short hours () const; /** * @brief Set the hours component. * * @param h The new hours component. */ void hours (unsigned short h); /** * @brief Get the minutes component. * * @return The minutes component. */ unsigned short minutes () const; /** * @brief Set the minutes component. * * @param m The new minutes component. */ void minutes (unsigned short m); /** * @brief Get the seconds component. * * @return The seconds component. */ double seconds () const; /** * @brief Set the seconds component. * * @param s The new seconds component. */ void seconds (double s); protected: //@cond time (); void parse (const std::basic_string<C>&); //@endcond private: unsigned short hours_; unsigned short minutes_; double seconds_; }; /** * @brief %time comparison operator. * * @return True if the hours, seconds, and minutes components as well * as %time zones are equal, false otherwise. */ template <typename C, typename B> bool operator== (const time<C, B>&, const time<C, B>&); /** * @brief %time comparison operator. * * @return False if the hours, seconds, and minutes components as well * as %time zones are equal, true otherwise. */ template <typename C, typename B> bool operator!= (const time<C, B>&, const time<C, B>&); /** * @brief Class corresponding to the XML Schema dateTime built-in type. * * The %date_time class represents year, month, day, hours, minutes, * and seconds with an optional %time zone. * * @nosubgrouping */ template <typename C, typename B> class date_time: public B, public time_zone { public: /** * @name Constructors */ //@{ /** * @brief Initialize an instance with the year, month, day, hours, * minutes, and seconds components. * * When this constructor is used, the %time zone is left * unspecified. * * @param year The year component. * @param month The month component. * @param day The day component. * @param hours The hours component. * @param minutes The minutes component. * @param seconds The seconds component. */ date_time (int year, unsigned short month, unsigned short day, unsigned short hours, unsigned short minutes, double seconds); /** * @brief Initialize an instance with the year, month, day, hours, * minutes, and seconds components as well as %time zone. * * @param year The year component. * @param month The month component. * @param day The day component. * @param hours The hours component. * @param minutes The minutes component. * @param seconds The seconds component. * @param zone_hours The %time zone hours component. * @param zone_minutes The %time zone minutes component. */ date_time (int year, unsigned short month, unsigned short day, unsigned short hours, unsigned short minutes, double seconds, short zone_hours, short zone_minutes); /** * @brief Copy constructor. * * @param x An instance to make a copy of. * @param f Flags to create the copy with. * @param c A pointer to the object that will contain the copy. * * For polymorphic object models use the _clone function instead. */ date_time (const date_time& x, flags f = 0, container* c = 0); /** * @brief Copy the instance polymorphically. * * @param f Flags to create the copy with. * @param c A pointer to the object that will contain the copy. * @return A pointer to the dynamically allocated copy. * * This function ensures that the dynamic type of the instance * is used for copying and should be used for polymorphic object * models instead of the copy constructor. */ virtual date_time* _clone (flags f = 0, container* c = 0) const; /** * @brief Create an instance from a data representation * stream. * * @param s A stream to extract the data from. * @param f Flags to create the new instance with. * @param c A pointer to the object that will contain the new * instance. */ template <typename S> date_time (istream<S>& s, flags f = 0, container* c = 0); /** * @brief Create an instance from a DOM element. * * @param e A DOM element to extract the data from. * @param f Flags to create the new instance with. * @param c A pointer to the object that will contain the new * instance. */ date_time (const xercesc::DOMElement& e, flags f = 0, container* c = 0); /** * @brief Create an instance from a DOM Attribute. * * @param a A DOM attribute to extract the data from. * @param f Flags to create the new instance with. * @param c A pointer to the object that will contain the new * instance. */ date_time (const xercesc::DOMAttr& a, flags f = 0, container* c = 0); /** * @brief Create an instance from a %string fragment. * * @param s A %string fragment to extract the data from. * @param e A pointer to DOM element containing the %string fragment. * @param f Flags to create the new instance with. * @param c A pointer to the object that will contain the new * instance. */ date_time (const std::basic_string<C>& s, const xercesc::DOMElement* e, flags f = 0, container* c = 0); //@} public: /** * @brief Get the year component. * * @return The year component. */ int year () const; /** * @brief Set the year component. * * @param y The new year component. */ void year (int y); /** * @brief Get the month component. * * @return The month component. */ unsigned short month () const; /** * @brief Set the month component. * * @param m The new month component. */ void month (unsigned short m); /** * @brief Get the day component. * * @return The day component. */ unsigned short day () const; /** * @brief Set the day component. * * @param d The new day component. */ void day (unsigned short d); /** * @brief Get the hours component. * * @return The hours component. */ unsigned short hours () const; /** * @brief Set the hours component. * * @param h The new hours component. */ void hours (unsigned short h); /** * @brief Get the minutes component. * * @return The minutes component. */ unsigned short minutes () const; /** * @brief Set the minutes component. * * @param m The new minutes component. */ void minutes (unsigned short m); /** * @brief Get the seconds component. * * @return The seconds component. */ double seconds () const; /** * @brief Set the seconds component. * * @param s The new seconds component. */ void seconds (double s); protected: //@cond date_time (); void parse (const std::basic_string<C>&); //@endcond private: int year_; unsigned short month_; unsigned short day_; unsigned short hours_; unsigned short minutes_; double seconds_; }; /** * @brief %date_time comparison operator. * * @return True if the year, month, day, hours, seconds, and minutes * components as well as %time zones are equal, false otherwise. */ template <typename C, typename B> bool operator== (const date_time<C, B>&, const date_time<C, B>&); /** * @brief %date_time comparison operator. * * @return False if the year, month, day, hours, seconds, and minutes * components as well as %time zones are equal, true otherwise. */ template <typename C, typename B> bool operator!= (const date_time<C, B>&, const date_time<C, B>&); /** * @brief Class corresponding to the XML Schema %duration built-in type. * * The %duration class represents a potentially negative %duration in * the form of years, months, days, hours, minutes, and seconds. * * @nosubgrouping */ template <typename C, typename B> class duration: public B { public: /** * @name Constructors */ //@{ /** * @brief Initialize a potentially negative instance with the years, * months, days, hours, minutes, and seconds components. * * @param negative A boolean value indicating whether the %duration * is negative (true) or positive (false). * @param years The years component. * @param months The months component. * @param days The days component. * @param hours The hours component. * @param minutes The minutes component. * @param seconds The seconds component. */ duration (bool negative, unsigned int years, unsigned int months, unsigned int days, unsigned int hours, unsigned int minutes, double seconds); /** * @brief Copy constructor. * * @param x An instance to make a copy of. * @param f Flags to create the copy with. * @param c A pointer to the object that will contain the copy. * * For polymorphic object models use the _clone function instead. */ duration (const duration& x, flags f = 0, container* c = 0); /** * @brief Copy the instance polymorphically. * * @param f Flags to create the copy with. * @param c A pointer to the object that will contain the copy. * @return A pointer to the dynamically allocated copy. * * This function ensures that the dynamic type of the instance * is used for copying and should be used for polymorphic object * models instead of the copy constructor. */ virtual duration* _clone (flags f = 0, container* c = 0) const; /** * @brief Create an instance from a data representation * stream. * * @param s A stream to extract the data from. * @param f Flags to create the new instance with. * @param c A pointer to the object that will contain the new * instance. */ template <typename S> duration (istream<S>& s, flags f = 0, container* c = 0); /** * @brief Create an instance from a DOM element. * * @param e A DOM element to extract the data from. * @param f Flags to create the new instance with. * @param c A pointer to the object that will contain the new * instance. */ duration (const xercesc::DOMElement& e, flags f = 0, container* c = 0); /** * @brief Create an instance from a DOM Attribute. * * @param a A DOM attribute to extract the data from. * @param f Flags to create the new instance with. * @param c A pointer to the object that will contain the new * instance. */ duration (const xercesc::DOMAttr& a, flags f = 0, container* c = 0); /** * @brief Create an instance from a %string fragment. * * @param s A %string fragment to extract the data from. * @param e A pointer to DOM element containing the %string fragment. * @param f Flags to create the new instance with. * @param c A pointer to the object that will contain the new * instance. */ duration (const std::basic_string<C>& s, const xercesc::DOMElement* e, flags f = 0, container* c = 0); //@} public: /** * @brief Determine if %duration is negative. * * @return True if %duration is negative, false otherwise. */ bool negative () const; /** * @brief Change %duration sign. * * @param n A boolean value indicating whether %duration is * negative (true) or positive (false). */ void negative (bool n); /** * @brief Get the years component. * * @return The years component. */ unsigned int years () const; /** * @brief Set the years component. * * @param y The new years component. */ void years (unsigned int y); /** * @brief Get the months component. * * @return The months component. */ unsigned int months () const; /** * @brief Set the months component. * * @param m The new months component. */ void months (unsigned int m); /** * @brief Get the days component. * * @return The days component. */ unsigned int days () const; /** * @brief Set the days component. * * @param d The new days component. */ void days (unsigned int d); /** * @brief Get the hours component. * * @return The hours component. */ unsigned int hours () const; /** * @brief Set the hours component. * * @param h The new hours component. */ void hours (unsigned int h); /** * @brief Get the minutes component. * * @return The minutes component. */ unsigned int minutes () const; /** * @brief Set the minutes component. * * @param m The new minutes component. */ void minutes (unsigned int m); /** * @brief Get the seconds component. * * @return The seconds component. */ double seconds () const; /** * @brief Set the seconds component. * * @param s The new seconds component. */ void seconds (double s); protected: //@cond duration (); void parse (const std::basic_string<C>&); //@endcond private: bool negative_; unsigned int years_; unsigned int months_; unsigned int days_; unsigned int hours_; unsigned int minutes_; double seconds_; }; /** * @brief %duration comparison operator. * * @return True if the sings as well as years, months, days, hours, * seconds, and minutes components are equal, false otherwise. */ template <typename C, typename B> bool operator== (const duration<C, B>&, const duration<C, B>&); /** * @brief %duration comparison operator. * * @return False if the sings as well as years, months, days, hours, * seconds, and minutes components are equal, true otherwise. */ template <typename C, typename B> bool operator!= (const duration<C, B>&, const duration<C, B>&); } } } #include <xsd/cxx/tree/date-time.ixx> #include <xsd/cxx/tree/date-time.txx> #endif // XSD_CXX_TREE_DATE_TIME_HXX
29.119426
78
0.528779
[ "object" ]
952ec4e16750476dcfa19e52acf96bf6f82debe5
1,822
cpp
C++
octree/octree/filenames.cpp
pauldinh/O-CNN
fecefd92b559bdfe94a3983b2b010645167c41a1
[ "MIT" ]
299
2019-05-27T02:18:56.000Z
2022-03-31T15:29:20.000Z
octree/octree/filenames.cpp
pauldinh/O-CNN
fecefd92b559bdfe94a3983b2b010645167c41a1
[ "MIT" ]
100
2019-05-07T03:17:01.000Z
2022-03-30T09:02:04.000Z
octree/octree/filenames.cpp
pauldinh/O-CNN
fecefd92b559bdfe94a3983b2b010645167c41a1
[ "MIT" ]
84
2019-05-17T17:44:06.000Z
2022-02-14T04:32:02.000Z
#include "filenames.h" #include <algorithm> string extract_path(string str) { std::replace(str.begin(), str.end(), '\\', '/'); size_t pos = str.rfind('/'); if (string::npos == pos) { return string("."); } else { return str.substr(0, pos); } } string extract_filename(string str) { std::replace(str.begin(), str.end(), '\\', '/'); size_t pos = str.rfind('/') + 1; size_t len = str.rfind('.'); if (string::npos != len) len -= pos; return str.substr(pos, len); } string extract_suffix(string str) { string suffix; size_t pos = str.rfind('.'); if (pos != string::npos) { suffix = str.substr(pos + 1); std::transform(suffix.begin(), suffix.end(), suffix.begin(), tolower); } return suffix; } #if defined _MSC_VER #include <direct.h> void mkdir(const string& dir) { _mkdir(dir.c_str()); } #elif defined __GNUC__ #include <sys/types.h> #include <sys/stat.h> void mkdir(const string& dir) { mkdir(dir.c_str(), 0744); } #endif #ifdef USE_WINDOWS_IO #include <io.h> void get_all_filenames(vector<string>& all_filenames, const string& filename_in) { all_filenames.clear(); string file_path = extract_path(filename_in) + "/"; string filename = file_path + "*" + filename_in.substr(filename_in.rfind('.')); _finddata_t c_file; intptr_t hFile = _findfirst(filename.c_str(), &c_file); do { if (hFile == -1) break; all_filenames.push_back(file_path + string(c_file.name)); } while (_findnext(hFile, &c_file) == 0); _findclose(hFile); } #else #include <fstream> void get_all_filenames(vector<string>& all_filenames, const string& data_list) { all_filenames.clear(); std::ifstream infile(data_list); if (!infile) return; string line; while (std::getline(infile, line)) { all_filenames.push_back(line); } infile.close(); } #endif
21.186047
82
0.653128
[ "vector", "transform" ]
953071e411e67124d1e104ecd56ddf7cab50a156
16,633
cc
C++
servlib/conv_layers/ConnectionConvergenceLayer.cc
LeoIannacone/dtn
b7ee725bb147e29cc05ac8790b1d24efcd9f841e
[ "Apache-2.0" ]
2
2017-10-29T11:15:47.000Z
2019-09-15T13:43:25.000Z
servlib/conv_layers/ConnectionConvergenceLayer.cc
LeoIannacone/dtn
b7ee725bb147e29cc05ac8790b1d24efcd9f841e
[ "Apache-2.0" ]
null
null
null
servlib/conv_layers/ConnectionConvergenceLayer.cc
LeoIannacone/dtn
b7ee725bb147e29cc05ac8790b1d24efcd9f841e
[ "Apache-2.0" ]
3
2015-03-27T05:56:05.000Z
2020-01-02T22:18:02.000Z
/* * Copyright 2006 Intel Corporation * * 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. */ #ifdef HAVE_CONFIG_H # include <dtn-config.h> #endif #include <oasys/util/OptParser.h> #include "ConnectionConvergenceLayer.h" #include "CLConnection.h" #include "bundling/BundleDaemon.h" namespace dtn { //---------------------------------------------------------------------- ConnectionConvergenceLayer::LinkParams::LinkParams(bool init_defaults) : reactive_frag_enabled_(true), sendbuf_len_(32768), recvbuf_len_(32768), data_timeout_(30000), // msec test_read_delay_(0), test_write_delay_(0), test_recv_delay_(0), test_read_limit_(0), test_write_limit_(0) { (void)init_defaults; } //---------------------------------------------------------------------- void ConnectionConvergenceLayer::LinkParams::serialize(oasys::SerializeAction *a) { log_debug_p("LinkParams", "ConnectionConvergenceLayer::LinkParams::serialize"); a->process("reactive_frag_enabled", &reactive_frag_enabled_); a->process("sendbuf_len", &sendbuf_len_); a->process("recvbuf_len", &recvbuf_len_); a->process("data_timeout", &data_timeout_); a->process("test_read_delay", &test_read_delay_); a->process("test_write_delay", &test_write_delay_); a->process("test_recv_delay", &test_recv_delay_); a->process("test_read_limit", &test_read_limit_); a->process("test_write_limit", &test_write_limit_); } //---------------------------------------------------------------------- ConnectionConvergenceLayer::ConnectionConvergenceLayer(const char* classname, const char* cl_name) : ConvergenceLayer(classname, cl_name) { } //---------------------------------------------------------------------- bool ConnectionConvergenceLayer::parse_link_params(LinkParams* params, int argc, const char** argv, const char** invalidp) { oasys::OptParser p; p.addopt(new oasys::BoolOpt("reactive_frag_enabled", &params->reactive_frag_enabled_)); p.addopt(new oasys::UIntOpt("sendbuf_len", &params->sendbuf_len_)); p.addopt(new oasys::UIntOpt("recvbuf_len", &params->recvbuf_len_)); p.addopt(new oasys::UIntOpt("data_timeout", &params->data_timeout_)); p.addopt(new oasys::UIntOpt("test_read_delay", &params->test_read_delay_)); p.addopt(new oasys::UIntOpt("test_write_delay", &params->test_write_delay_)); p.addopt(new oasys::UIntOpt("test_recv_delay", &params->test_recv_delay_)); p.addopt(new oasys::UIntOpt("test_read_limit", &params->test_read_limit_)); p.addopt(new oasys::UIntOpt("test_write_limit", &params->test_write_limit_)); if (! p.parse(argc, argv, invalidp)) { return false; } if (params->sendbuf_len_ == 0) { *invalidp = "sendbuf_len must not be zero"; return false; } if (params->recvbuf_len_ == 0) { *invalidp = "recvbuf_len must not be zero"; return false; } return true; } //---------------------------------------------------------------------- void ConnectionConvergenceLayer::dump_link(const LinkRef& link, oasys::StringBuffer* buf) { ASSERT(link != NULL); ASSERT(!link->isdeleted()); ASSERT(link->cl_info() != NULL); LinkParams* params = dynamic_cast<LinkParams*>(link->cl_info()); ASSERT(params != NULL); buf->appendf("reactive_frag_enabled: %u\n", params->reactive_frag_enabled_); buf->appendf("sendbuf_len: %u\n", params->sendbuf_len_); buf->appendf("recvbuf_len: %u\n", params->recvbuf_len_); buf->appendf("data_timeout: %u\n", params->data_timeout_); buf->appendf("test_read_delay: %u\n", params->test_read_delay_); buf->appendf("test_write_delay: %u\n", params->test_write_delay_); buf->appendf("test_recv_delay: %u\n",params->test_recv_delay_); } //---------------------------------------------------------------------- bool ConnectionConvergenceLayer::init_link(const LinkRef& link, int argc, const char* argv[]) { ASSERT(link != NULL); ASSERT(!link->isdeleted()); ASSERT(link->cl_info() == NULL); log_debug("adding %s link %s", link->type_str(), link->nexthop()); // Create a new parameters structure, parse the options, and store // them in the link's cl info slot. LinkParams* params = dynamic_cast<LinkParams *>(new_link_params()); ASSERT(params != NULL); // Try to parse the link's next hop, but continue on even if the // parse fails since the hostname may not be resolvable when we // initialize the link. Each subclass is responsible for // re-checking when opening the link. parse_nexthop(link, params); const char* invalid; if (! parse_link_params(params, argc, argv, &invalid)) { log_err("error parsing link options: invalid option '%s'", invalid); delete params; return false; } if (! finish_init_link(link, params)) { log_err("error in finish_init_link"); delete params; return false; } link->set_cl_info(params); return true; } //---------------------------------------------------------------------- void ConnectionConvergenceLayer::delete_link(const LinkRef& link) { ASSERT(link != NULL); ASSERT(!link->isdeleted()); log_debug("ConnectionConvergenceLayer::delete_link: " "deleting link %s", link->name()); if (link->isopen() || link->isopening()) { log_debug("ConnectionConvergenceLayer::delete_link: " "link %s open, deleting link state when contact closed", link->name()); return; } ASSERT(link->contact() == NULL); ASSERT(link->cl_info() != NULL); delete link->cl_info(); link->set_cl_info(NULL); } //---------------------------------------------------------------------- bool ConnectionConvergenceLayer::finish_init_link(const LinkRef& link, LinkParams* params) { (void)link; (void)params; return true; } //---------------------------------------------------------------------- bool ConnectionConvergenceLayer::reconfigure_link(const LinkRef& link, int argc, const char* argv[]) { ASSERT(link != NULL); ASSERT(!link->isdeleted()); ASSERT(link->cl_info() != NULL); LinkParams* params = dynamic_cast<LinkParams*>(link->cl_info()); ASSERT(params != NULL); const char* invalid; if (! parse_link_params(params, argc, argv, &invalid)) { log_err("reconfigure_link: invalid parameter %s", invalid); return false; } if (link->isopen()) { LinkParams* params = dynamic_cast<LinkParams*>(link->cl_info()); ASSERT(params != NULL); CLConnection* conn = dynamic_cast<CLConnection*>(link->contact()->cl_info()); ASSERT(conn != NULL); if ((params->sendbuf_len_ != conn->sendbuf_.size()) && (params->sendbuf_len_ >= conn->sendbuf_.fullbytes())) { log_info("resizing link *%p send buffer from %zu -> %u", link.object(), conn->sendbuf_.size(), params->sendbuf_len_); conn->sendbuf_.set_size(params->sendbuf_len_); } if ((params->recvbuf_len_ != conn->recvbuf_.size()) && (params->recvbuf_len_ >= conn->recvbuf_.fullbytes())) { log_info("resizing link *%p recv buffer from %zu -> %u", link.object(), conn->recvbuf_.size(), params->recvbuf_len_); conn->recvbuf_.set_size(params->recvbuf_len_); } } return true; } //---------------------------------------------------------------------- bool ConnectionConvergenceLayer::open_contact(const ContactRef& contact) { LinkRef link = contact->link(); ASSERT(link != NULL); ASSERT(!link->isdeleted()); ASSERT(link->cl_info() != NULL); log_debug("ConnectionConvergenceLayer::open_contact: " "opening contact on link *%p", link.object()); LinkParams* params = dynamic_cast<LinkParams*>(link->cl_info()); ASSERT(params != NULL); // create a new connection for the contact, set up to use the // link's configured parameters CLConnection* conn = new_connection(link, params); conn->set_contact(contact); contact->set_cl_info(conn); conn->start(); return true; } //---------------------------------------------------------------------- bool ConnectionConvergenceLayer::close_contact(const ContactRef& contact) { log_info("close_contact *%p", contact.object()); const LinkRef& link = contact->link(); ASSERT(link != NULL); CLConnection* conn = dynamic_cast<CLConnection*>(contact->cl_info()); ASSERT(conn != NULL); // if the connection isn't already broken, then we need to tell it // to do so if (! conn->contact_broken_) { conn->cmdqueue_.push_back( CLConnection::CLMsg(CLConnection::CLMSG_BREAK_CONTACT)); } while (!conn->is_stopped()) { log_debug("waiting for connection thread to stop..."); usleep(100000); oasys::Thread::yield(); } // now that the connection thread is stopped, clean up the in // flight and incoming bundles LinkParams* params = dynamic_cast<LinkParams*>(link->cl_info()); ASSERT(params != NULL); while (! conn->inflight_.empty()) { CLConnection::InFlightBundle* inflight = conn->inflight_.front(); u_int32_t sent_bytes = inflight->sent_data_.num_contiguous(); u_int32_t acked_bytes = inflight->ack_data_.num_contiguous(); if ((! params->reactive_frag_enabled_) || (sent_bytes == 0) || (link->is_reliable() && acked_bytes == 0)) { // if we've started the bundle but not gotten anything // out, we need to push the bundle back onto the link // queue so it's there when the link re-opens if (! link->del_from_inflight(inflight->bundle_, inflight->total_length_) || ! link->add_to_queue(inflight->bundle_, inflight->total_length_)) { log_warn("inflight queue mismatch for bundle %d", inflight->bundle_->bundleid()); } } else { // otherwise, if part of the bundle has been transmitted, // then post the event so that the core system can do // reactive fragmentation if (! inflight->transmit_event_posted_) { BundleDaemon::post( new BundleTransmittedEvent(inflight->bundle_.object(), contact, link, sent_bytes, acked_bytes)); } } conn->inflight_.pop_front(); delete inflight; } // check the tail of the incoming queue to see if there's a // partially-received bundle that we need to post a received event // for (if reactive fragmentation is enabled) if (! conn->incoming_.empty()) { CLConnection::IncomingBundle* incoming = conn->incoming_.back(); if (!incoming->rcvd_data_.empty()) { size_t rcvd_len = incoming->rcvd_data_.last() + 1; size_t header_block_length = BundleProtocol::payload_offset(&incoming->bundle_->recv_blocks()); if ((incoming->total_length_ == 0) && params->reactive_frag_enabled_ && (rcvd_len > header_block_length)) { log_debug("partial arrival of bundle: " "got %zu bytes [hdr %zu payload %zu]", rcvd_len, header_block_length, incoming->bundle_->payload().length()); BundleDaemon::post( new BundleReceivedEvent(incoming->bundle_.object(), EVENTSRC_PEER, rcvd_len, contact->link()->remote_eid(), contact->link().object())); } } } // drain the CLConnection incoming queue while (! conn->incoming_.empty()) { CLConnection::IncomingBundle* incoming = conn->incoming_.back(); conn->incoming_.pop_back(); delete incoming; } // clear out the connection message queue CLConnection::CLMsg msg; while (conn->cmdqueue_.try_pop(&msg)) {} delete conn; contact->set_cl_info(NULL); if (link->isdeleted()) { ASSERT(link->cl_info() != NULL); delete link->cl_info(); link->set_cl_info(NULL); } return true; } //---------------------------------------------------------------------- void ConnectionConvergenceLayer::bundle_queued(const LinkRef& link, const BundleRef& bundle) { (void)bundle; log_debug("ConnectionConvergenceLayer::bundle_queued: " "queued *%p on *%p", bundle.object(), link.object()); if (! link->isopen()) { return; } ASSERT(!link->isdeleted()); const ContactRef& contact = link->contact(); ASSERT(contact != NULL); CLConnection* conn = dynamic_cast<CLConnection*>(contact->cl_info()); ASSERT(conn != NULL); // the bundle was previously put on the link queue, so we just // kick the connection thread in case it's idle. // // note that it's possible the bundle was already picked up and // taken off the link queue by the connection thread, so don't // assert here. conn->cmdqueue_.push_back( CLConnection::CLMsg(CLConnection::CLMSG_BUNDLES_QUEUED)); } //---------------------------------------------------------------------- void ConnectionConvergenceLayer::cancel_bundle(const LinkRef& link, const BundleRef& bundle) { ASSERT(! link->isdeleted()); // the bundle should be on the inflight queue for cancel_bundle to // be called if (! bundle->is_queued_on(link->inflight())) { log_warn("cancel_bundle *%p not on link %s inflight queue", bundle.object(), link->name()); return; } if (!link->isopen()) { /* * (Taken from jmmikkel checkin comment on BBN source tree) * * The dtn2 internal convergence layer complains and does * nothing if you try to cancel a bundle after the link has * closed instead of just considering the send cancelled. I * believe that posting a BundleCancelledEvent before * returning is the correct way to make the cancel actually * happen in this situation, as the bundle is removed from the * link queue in that event's handler. */ log_warn("cancel_bundle *%p but link *%p isn't open!!", bundle.object(), link.object()); BundleDaemon::post(new BundleSendCancelledEvent(bundle.object(), link)); return; } const ContactRef& contact = link->contact(); CLConnection* conn = dynamic_cast<CLConnection*>(contact->cl_info()); ASSERT(conn != NULL); ASSERT(contact->link() == link); log_debug("ConnectionConvergenceLayer::cancel_bundle: " "cancelling *%p on *%p", bundle.object(), link.object()); conn->cmdqueue_.push_back( CLConnection::CLMsg(CLConnection::CLMSG_CANCEL_BUNDLE, bundle)); } } // namespace dtn
35.016842
85
0.561474
[ "object" ]
9533caede1f306f6d62404de5853ca72c062fdb9
5,325
cc
C++
decoder/ff_rules.cc
kho/cdec
d88186af251ecae60974b20395ce75807bfdda35
[ "BSD-3-Clause-LBNL", "Apache-2.0" ]
114
2015-01-11T05:41:03.000Z
2021-08-31T03:47:12.000Z
decoder/ff_rules.cc
kho/cdec
d88186af251ecae60974b20395ce75807bfdda35
[ "BSD-3-Clause-LBNL", "Apache-2.0" ]
29
2015-01-09T01:00:09.000Z
2019-09-25T06:04:02.000Z
decoder/ff_rules.cc
kho/cdec
d88186af251ecae60974b20395ce75807bfdda35
[ "BSD-3-Clause-LBNL", "Apache-2.0" ]
50
2015-02-13T13:48:39.000Z
2019-08-07T09:45:11.000Z
#include "ff_rules.h" #include <sstream> #include <cassert> #include <cmath> #include "filelib.h" #include "stringlib.h" #include "sentence_metadata.h" #include "lattice.h" #include "fdict.h" #include "verbose.h" #include "tdict.h" #include "hg.h" #include "trule.h" using namespace std; namespace { string Escape(const string& x) { string y = x; for (int i = 0; i < y.size(); ++i) { if (y[i] == '=') y[i]='_'; if (y[i] == ';') y[i]='_'; } return y; } } RuleIdentityFeatures::RuleIdentityFeatures(const std::string& param) { } void RuleIdentityFeatures::PrepareForInput(const SentenceMetadata& smeta) { // std::map<const TRule*, SparseVector<double> > rule2_fid_.clear(); } void RuleIdentityFeatures::TraversalFeaturesImpl(const SentenceMetadata& smeta, const Hypergraph::Edge& edge, const vector<const void*>& ant_contexts, SparseVector<double>* features, SparseVector<double>* estimated_features, void* context) const { map<const TRule*, int>::iterator it = rule2_fid_.find(edge.rule_.get()); if (it == rule2_fid_.end()) { const TRule& rule = *edge.rule_; ostringstream os; os << "R:"; if (rule.lhs_ < 0) os << TD::Convert(-rule.lhs_) << ':'; for (unsigned i = 0; i < rule.f_.size(); ++i) { if (i > 0) os << '_'; WordID w = rule.f_[i]; if (w < 0) { os << 'N'; w = -w; } assert(w > 0); os << TD::Convert(w); } os << ':'; for (unsigned i = 0; i < rule.e_.size(); ++i) { if (i > 0) os << '_'; WordID w = rule.e_[i]; if (w <= 0) { os << 'N' << (1-w); } else { os << TD::Convert(w); } } it = rule2_fid_.insert(make_pair(&rule, FD::Convert(Escape(os.str())))).first; } features->add_value(it->second, 1); } RuleSourceBigramFeatures::RuleSourceBigramFeatures(const std::string& param) { } void RuleSourceBigramFeatures::PrepareForInput(const SentenceMetadata& smeta) { // std::map<const TRule*, SparseVector<double> > rule2_feats_.clear(); } void RuleSourceBigramFeatures::TraversalFeaturesImpl(const SentenceMetadata& smeta, const Hypergraph::Edge& edge, const vector<const void*>& ant_contexts, SparseVector<double>* features, SparseVector<double>* estimated_features, void* context) const { map<const TRule*, SparseVector<double> >::iterator it = rule2_feats_.find(edge.rule_.get()); if (it == rule2_feats_.end()) { const TRule& rule = *edge.rule_; it = rule2_feats_.insert(make_pair(&rule, SparseVector<double>())).first; SparseVector<double>& f = it->second; string prev = "<r>"; for (int i = 0; i < rule.f_.size(); ++i) { WordID w = rule.f_[i]; if (w < 0) w = -w; assert(w > 0); const string& cur = TD::Convert(w); ostringstream os; os << "RBS:" << prev << '_' << cur; const int fid = FD::Convert(Escape(os.str())); if (fid <= 0) return; f.add_value(fid, 1.0); prev = cur; } ostringstream os; os << "RBS:" << prev << '_' << "</r>"; f.set_value(FD::Convert(Escape(os.str())), 1.0); } (*features) += it->second; } RuleTargetBigramFeatures::RuleTargetBigramFeatures(const std::string& param) : inds(1000) { for (unsigned i = 0; i < inds.size(); ++i) { ostringstream os; os << (i + 1); inds[i] = os.str(); } } void RuleTargetBigramFeatures::PrepareForInput(const SentenceMetadata& smeta) { rule2_feats_.clear(); } void RuleTargetBigramFeatures::TraversalFeaturesImpl(const SentenceMetadata& smeta, const Hypergraph::Edge& edge, const vector<const void*>& ant_contexts, SparseVector<double>* features, SparseVector<double>* estimated_features, void* context) const { map<const TRule*, SparseVector<double> >::iterator it = rule2_feats_.find(edge.rule_.get()); if (it == rule2_feats_.end()) { const TRule& rule = *edge.rule_; it = rule2_feats_.insert(make_pair(&rule, SparseVector<double>())).first; SparseVector<double>& f = it->second; string prev = "<r>"; vector<WordID> nt_types(rule.Arity()); unsigned ntc = 0; for (int i = 0; i < rule.f_.size(); ++i) if (rule.f_[i] < 0) nt_types[ntc++] = -rule.f_[i]; for (int i = 0; i < rule.e_.size(); ++i) { WordID w = rule.e_[i]; string cur; if (w > 0) { cur = TD::Convert(w); } else { cur = TD::Convert(nt_types[-w]) + inds[-w]; } ostringstream os; os << "RBT:" << prev << '_' << cur; const int fid = FD::Convert(Escape(os.str())); if (fid <= 0) return; f.add_value(fid, 1.0); prev = cur; } ostringstream os; os << "RBT:" << prev << '_' << "</r>"; f.set_value(FD::Convert(Escape(os.str())), 1.0); } (*features) += it->second; }
33.074534
94
0.534085
[ "vector" ]
953495c8494b792fc72648c57405b1a066452124
2,888
hpp
C++
libs/ledger/include/ledger/identifier.hpp
devjsc/ledger
5681480faf6e2aeee577f149c17745d6ab4d4ab3
[ "Apache-2.0" ]
1
2019-09-11T09:46:04.000Z
2019-09-11T09:46:04.000Z
libs/ledger/include/ledger/identifier.hpp
devjsc/ledger
5681480faf6e2aeee577f149c17745d6ab4d4ab3
[ "Apache-2.0" ]
null
null
null
libs/ledger/include/ledger/identifier.hpp
devjsc/ledger
5681480faf6e2aeee577f149c17745d6ab4d4ab3
[ "Apache-2.0" ]
1
2019-09-19T12:38:46.000Z
2019-09-19T12:38:46.000Z
#pragma once //------------------------------------------------------------------------------ // // Copyright 2018-2019 Fetch.AI Limited // // 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. // //------------------------------------------------------------------------------ #include "core/byte_array/byte_array.hpp" #include <vector> namespace fetch { namespace ledger { /** * A string identifier which is related to the piece of chain code or a smart contract. In general, * this is represented by a series of tokens separated with the '.' character * * For example: * * `foo.bar` & `foo.baz` are in the same logical `foo` group */ class Identifier { public: enum class Type { INVALID, NORMAL, SMART_OR_SYNERGETIC_CONTRACT }; using ConstByteArray = byte_array::ConstByteArray; using Tokens = std::vector<ConstByteArray>; // Construction / Destruction Identifier() = default; explicit Identifier(ConstByteArray identifier); Identifier(Identifier const &) = default; Identifier(Identifier &&) = default; ~Identifier() = default; // Accessors Type type() const; ConstByteArray name() const; ConstByteArray name_space() const; ConstByteArray const &full_name() const; ConstByteArray qualifier() const; bool empty() const; Identifier GetParent() const; // Parsing bool Parse(ConstByteArray name); // Comparison bool IsParentTo(Identifier const &other) const; bool IsChildTo(Identifier const &other) const; bool IsDirectParentTo(Identifier const &other) const; bool IsDirectChildTo(Identifier const &other) const; // Operators Identifier & operator=(Identifier const &) = default; Identifier & operator=(Identifier &&) = default; ConstByteArray const &operator[](std::size_t index) const; bool operator==(Identifier const &other) const; bool operator!=(Identifier const &other) const; private: Identifier(Tokens const &tokens, std::size_t count); bool Tokenise(ConstByteArray &&full_name); void UpdateType(); Type type_{Type::INVALID}; ConstByteArray full_{}; ///< The fully qualified name Tokens tokens_{}; ///< The individual elements of the name }; } // namespace ledger } // namespace fetch
30.723404
99
0.638504
[ "vector" ]
953a913cad24e11ce42f2f3a60cdf46e982e200e
23,037
cpp
C++
tests/test-generic-solver.cpp
cdonovick/smt-switch
27857defa356b5178935e5e75b5958145eafef1c
[ "BSD-3-Clause" ]
null
null
null
tests/test-generic-solver.cpp
cdonovick/smt-switch
27857defa356b5178935e5e75b5958145eafef1c
[ "BSD-3-Clause" ]
3
2020-11-04T22:30:05.000Z
2021-02-24T23:33:04.000Z
tests/test-generic-solver.cpp
lstuntz/smt-switch
15f796bc1692a44a984dfed78425ce084b25d4dc
[ "BSD-3-Clause" ]
null
null
null
/********************* */ /*! \file test-generic-solver.cpp ** \verbatim ** Top contributors (to current version): ** Yoni Zohar ** This file is part of the smt-switch project. ** Copyright (c) 2020 by the authors listed in the file AUTHORS ** in the top-level source directory) and their institutional affiliations. ** All rights reserved. See the file LICENSE in the top-level source ** directory for licensing information.\endverbatim ** ** \brief ** ** **/ // generic solvers are not supported on macos #ifndef __APPLE__ #include <array> #include <cstdio> #include <fstream> #include <iostream> #include <memory> #include <sstream> #include <stdexcept> #include <string> #include <vector> #include "assert.h" // note: this file depends on the CMake build infrastructure // specifically defined macros // it cannot be compiled outside of the build #include "cvc4_factory.h" #include "generic_solver.h" #include "smt.h" #include "test-utils.h" using namespace smt; using namespace std; void test_bad_cmd(SmtSolver gs) { cout << "trying a bad command:" << endl; try { gs->set_opt("iiiaaaaiiiiaaaa", "aaa"); } catch (IncorrectUsageException e) { cout << "caught the exception" << endl; } } void test_uf_1(SmtSolver gs) { Sort s = gs->make_sort("S", 0); cout << "created a sort! " << s << endl; cout << "trying to create it again" << endl; try { Sort s1 = gs->make_sort("S", 1); } catch (IncorrectUsageException e) { cout << "caught the exception" << endl; } } void test_bool_1(SmtSolver gs) { Sort bool_sort = gs->make_sort(BOOL); Term term_1 = gs->make_symbol("term_1", bool_sort); Result r; cout << "checking satisfiability with no assertions" << endl; gs->push(1); r = gs->check_sat(); assert(r.is_sat()); gs->pop(1); cout << "checking satisfiability with assertion " << std::endl; gs->push(1); gs->assert_formula(term_1); r = gs->check_sat(); assert(r.is_sat()); gs->pop(1); } void test_bool_2(SmtSolver gs) { cout << "trying to create a constant boolean term" << endl; Term true_term_1 = gs->make_term(true); Term false_term_1 = gs->make_term(false); cout << "got term: " << true_term_1 << endl; cout << "got term: " << false_term_1 << endl; cout << "trying to create a constant boolean term again" << endl; Term true_term_2 = gs->make_term(true); Term false_term_2 = gs->make_term(false); cout << "got term: " << true_term_2 << endl; cout << "got term: " << false_term_2 << endl; assert(true_term_1.get() == true_term_2.get()); assert(false_term_1.get() == false_term_2.get()); Term true_term = true_term_1; Term false_term = false_term_1; Result r; cout << "checking satisfiability with no assertions" << endl; gs->push(1); r = gs->check_sat(); assert(r.is_sat()); gs->pop(1); cout << "checking satisfiability with assertion that is true" << endl; gs->push(1); gs->assert_formula(true_term); r = gs->check_sat(); assert(r.is_sat()); gs->pop(1); cout << "checking satisfiability with assertion that is false" << endl; gs->push(1); gs->assert_formula(false_term); r = gs->check_sat(); assert(r.is_unsat()); gs->pop(1); cout << "checking satisfiability with assertions that are false and true" << endl; gs->push(1); gs->assert_formula(false_term); gs->assert_formula(true_term); r = gs->check_sat(); assert(r.is_unsat()); gs->pop(1); } void test_int_1(SmtSolver gs) { Sort int_sort = gs->make_sort(INT); cout << "created sort of sort kind " << to_string(INT) << ". The sort is: " << int_sort << endl; Sort int_sort2 = gs->make_sort(INT); assert(int_sort == int_sort2); cout << "trying to create a sort in a wrong way" << endl; try { Sort err_sort = gs->make_sort(ARRAY); } catch (IncorrectUsageException e) { cout << "caught the exception" << endl; } } void test_bv_1(SmtSolver gs) { Sort bv_sort = gs->make_sort(BV, 4); cout << "created bit-vector sort: " << bv_sort << endl; cout << "checking for equalities" << endl; Sort bv_sort1 = gs->make_sort(BV, 4); assert(bv_sort == bv_sort1); Sort bv_sort2 = gs->make_sort(BV, 5); assert(bv_sort != bv_sort2); cout << "trying to create a sort in a wrong way" << endl; try { Sort err_sort = gs->make_sort(INT, bv_sort); } catch (IncorrectUsageException e) { cout << "caught the exception" << endl; } } void test_bv_2(SmtSolver gs) { cout << "trying to create a sort in a wrong way" << endl; try { Sort err_sort = gs->make_sort(INT, 4); } catch (IncorrectUsageException e) { cout << "caught the exception" << endl; } } void test_uf_2(SmtSolver gs) { Sort s = gs->make_sort("S", 0); Term svar1 = gs->make_symbol("x_s1", s); try { Term svar2 = gs->make_symbol("x_s1", s); } catch (IncorrectUsageException e) { cout << "caught exception" << endl; } } void test_int_2(SmtSolver gs) { Sort int_sort = gs->make_sort(INT); Term int_zero = gs->make_term(0, int_sort); Term int_one = gs->make_term(1, int_sort); cout << "making some constants" << endl; Term int_one_equal_zero = gs->make_term(Equal, TermVec({ int_one, int_zero })); cout << "checking some simple assertions" << endl; gs->push(1); gs->assert_formula(int_one_equal_zero); Result r; r = gs->check_sat(); assert(r.is_unsat()); gs->pop(1); gs->push(1); Term int_one_equal_one = gs->make_term(Equal, TermVec({ int_one, int_one })); gs->assert_formula(int_one_equal_one); r = gs->check_sat(); assert(r.is_sat()); gs->pop(1); } void test_bad_term_1(SmtSolver gs) { cout << "trying to create a badly-sorted term and getting and exception" << endl; try { Sort int_sort = gs->make_sort(INT); Term int_zero = gs->make_term(0, int_sort); Term int_one = gs->make_term(1, int_sort); Sort bv_sort = gs->make_sort(BV, 4); Term bv_zero = gs->make_term(0, bv_sort); Term bv_one = gs->make_term(1, bv_sort); Term bv_one_equal_int_one = gs->make_term(Equal, TermVec({ bv_one, int_one })); } catch (IncorrectUsageException e) { cout << "caught expected exception " << endl; } } void test_bad_term_2(SmtSolver gs) { try { Sort int_sort = gs->make_sort(INT); Term int_zero = gs->make_term(0, int_sort); Term int_one = gs->make_term(1, int_sort); Sort bv_sort = gs->make_sort(BV, 4); Term bv_zero = gs->make_term(0, bv_sort); Term bv_one = gs->make_term(1, bv_sort); Term bv_one_plus_int_one = gs->make_term(Equal, TermVec({ bv_one, int_one })); } catch (IncorrectUsageException e) { cout << "caught expected exception " << endl; } } void test_bv_3(SmtSolver gs) { Sort bv_sort = gs->make_sort(BV, 4); Term bv_zero = gs->make_term(0, bv_sort); Term bv_one = gs->make_term(1, bv_sort); Term bv_minus_one_int = gs->make_term(-1, bv_sort); Term bv_minus_one_dec = gs->make_term("-1", bv_sort); Term bv_minus_one_bin = gs->make_term("1111", bv_sort, 2); Term bv_minus_one_hex = gs->make_term("F", bv_sort, 16); cout << "verify that the representations are different as expected, based on " "the expected textual representation." << endl; assert(bv_minus_one_int == bv_minus_one_dec); assert(bv_minus_one_int != bv_minus_one_bin); assert(bv_minus_one_int != bv_minus_one_hex); assert(bv_minus_one_bin != bv_minus_one_hex); cout << "verified " << endl; cout << "verify that they are semantically the same" << endl; gs->push(1); Term eq1 = gs->make_term(Equal, bv_minus_one_dec, bv_minus_one_bin); Term eq2 = gs->make_term(Equal, bv_minus_one_int, bv_minus_one_bin); Term eq3 = gs->make_term(Equal, bv_minus_one_int, bv_minus_one_dec); Term eq4 = gs->make_term(Equal, bv_minus_one_int, bv_minus_one_hex); gs->assert_formula(eq1); gs->assert_formula(eq2); gs->assert_formula(eq3); gs->assert_formula(eq4); Result r; r = gs->check_sat(); assert(r.is_sat()); cout << "verified" << endl; gs->pop(1); Term bv_one_equal_zero = gs->make_term(Equal, TermVec({ bv_one, bv_zero })); gs->push(1); gs->assert_formula(bv_one_equal_zero); r = gs->check_sat(); assert(r.is_unsat()); gs->pop(1); gs->push(1); Term bv_one_equal_one = gs->make_term(Equal, bv_one, bv_one); gs->assert_formula(bv_one_equal_one); r = gs->check_sat(); assert(r.is_sat()); gs->pop(1); } void test_bv_4(SmtSolver gs) { Sort bv_sort = gs->make_sort(BV, 4); Term bv_zero = gs->make_term(0, bv_sort); Term bv_one = gs->make_term(1, bv_sort); Term bv_one_equal_zero = gs->make_term(Equal, TermVec({ bv_one, bv_zero })); gs->push(1); gs->assert_formula(bv_one_equal_zero); Result r; r = gs->check_sat(); assert(r.is_unsat()); gs->pop(1); gs->push(1); Term bv_one_equal_one = gs->make_term(Equal, bv_one, bv_one); gs->assert_formula(bv_one_equal_one); r = gs->check_sat(); assert(r.is_sat()); gs->pop(1); } void test_abv_1(SmtSolver gs) { Sort bv_sort1 = gs->make_sort(BV, 4); Sort bv_sort2 = gs->make_sort(BV, 5); cout << "trying to create a sort from two sorts" << endl; Sort bv_to_bv = gs->make_sort(ARRAY, bv_sort1, bv_sort2); cout << "got sort: " << bv_to_bv << endl; Term arr_var = gs->make_symbol("a", bv_to_bv); cout << "trying to create a sort from three sorts" << endl; Sort bv_x_bv_to_array = gs->make_sort(FUNCTION, bv_sort1, bv_sort2, bv_to_bv); cout << "got sort: " << bv_x_bv_to_array << endl; } void test_bool(SmtSolver gs) { cout << "trying to create a constant boolean term" << endl; Term true_term_1 = gs->make_term(true); Term false_term_1 = gs->make_term(false); cout << "got term: " << true_term_1 << endl; cout << "got term: " << false_term_1 << endl; cout << "trying to create a constant boolean term again" << endl; Term true_term_2 = gs->make_term(true); Term false_term_2 = gs->make_term(false); cout << "got term: " << true_term_2 << endl; cout << "got term: " << false_term_2 << endl; assert(true_term_1.get() == true_term_2.get()); assert(false_term_1.get() == false_term_2.get()); Term true_term = true_term_1; Term false_term = false_term_1; Result r; cout << "checking satisfiability with no assertions" << endl; gs->push(1); r = gs->check_sat(); assert(r.is_sat()); gs->pop(1); cout << "checking satisfiability with assertion that is true" << endl; gs->push(1); gs->assert_formula(true_term); r = gs->check_sat(); assert(r.is_sat()); gs->pop(1); cout << "checking satisfiability with assertion that is false" << endl; gs->push(1); gs->assert_formula(false_term); r = gs->check_sat(); assert(r.is_unsat()); gs->pop(1); cout << "checking satisfiability with assertions that are false and true" << endl; gs->push(1); gs->assert_formula(false_term); gs->assert_formula(true_term); r = gs->check_sat(); assert(r.is_unsat()); gs->pop(1); } void test_abv_2(SmtSolver gs) { std::cout << "test_abv_2" << std::endl; gs->push(1); Sort bv_sort1 = gs->make_sort(BV, 4); Sort bv_sort2 = gs->make_sort(BV, 5); Sort bv_to_bv = gs->make_sort(ARRAY, bv_sort1, bv_sort2); Sort bv_x_bv_to_array = gs->make_sort(FUNCTION, bv_sort1, bv_sort2, bv_to_bv); Term complex1 = gs->make_symbol("complex1", bv_x_bv_to_array); Sort bv_sort = gs->make_sort(BV, 4); Term bv_zero = gs->make_term(0, bv_sort); Term bv_one = gs->make_term(1, bv_sort); Term arr1 = gs->make_term( Apply, TermVec{ complex1, bv_zero, gs->make_term( Concat, bv_one, gs->make_term("0", gs->make_sort(BV, 1))) }); Term sel1 = gs->make_term(Select, arr1, bv_one); Term dis1 = gs->make_term(Distinct, sel1, gs->make_term("1", gs->make_sort(BV, 5))); gs->push(1); Term bv1 = gs->make_symbol("bv", bv_sort); Term for1 = gs->make_term(Equal, bv1, bv_zero); gs->assert_formula(for1); gs->assert_formula(dis1); Result result = gs->check_sat(); assert(result.is_sat()); Term val = gs->get_value(bv1); gs->pop(1); } void test_quantifiers(SmtSolver gs) { gs->push(1); Sort int_sort = gs->make_sort(INT); Term par1 = gs->make_param("par1", int_sort); Term par2 = gs->make_param("par2", int_sort); Term sum = gs->make_term(Plus, par1, par2); Term matrix1 = gs->make_term(Gt, par1, sum); Term exists1 = gs->make_term(Exists, par2, matrix1); Term forall1 = gs->make_term(Forall, par1, exists1); gs->assert_formula(forall1); Result result = gs->check_sat(); assert(result.is_sat()); Term matrix2 = gs->make_term(Gt, par1, par2); Term forall2 = gs->make_term(Forall, par1, matrix2); Term exists2 = gs->make_term(Exists, par2, forall2); gs->assert_formula(exists2); result = gs->check_sat(); assert(result.is_unsat()); gs->pop(1); } void test_constant_arrays(SmtSolver gs) { // Testing constant arrays gs->push(1); Sort bvsort = gs->make_sort(BV, 4); Sort arrsort = gs->make_sort(ARRAY, bvsort, bvsort); Term zero = gs->make_term(0, bvsort); Term constarr0 = gs->make_term(zero, arrsort); Term arr = gs->make_symbol("arr", arrsort); Term arreq = gs->make_term(Equal, arr, constarr0); gs->assert_formula(arreq); Result result = gs->check_sat(); assert(result.is_sat()); gs->pop(1); } void test_int_models(SmtSolver gs) { // Testing models gs->push(1); Sort int_sort = gs->make_sort(INT); Term int_zero = gs->make_term(0, int_sort); Term i1 = gs->make_symbol("i", int_sort); Term for1 = gs->make_term(Equal, i1, int_zero); gs->assert_formula(for1); Result result = gs->check_sat(); assert(result.is_sat()); Term val1 = gs->get_value(i1); Term val2 = gs->get_value(for1); gs->pop(1); } void test_bv_models(SmtSolver gs) { // Testing models gs->push(1); Sort bv_sort = gs->make_sort(BV, 4); Term bv_zero = gs->make_term(0, bv_sort); Term i1 = gs->make_symbol("i", bv_sort); Term for1 = gs->make_term(Equal, i1, bv_zero); gs->assert_formula(for1); Result result = gs->check_sat(); assert(result.is_sat()); Term val = gs->get_value(i1); gs->pop(1); } void test_check_sat_assuming_1(SmtSolver gs) { // Testing check-sat-assuming gs->push(1); Sort bool_sort = gs->make_sort(BOOL); Term b1 = gs->make_symbol("bool1", bool_sort); Term not_b1 = gs->make_term(Not, b1); Term b2 = gs->make_symbol("bool2", bool_sort); Term b3 = gs->make_symbol("bool3", bool_sort); gs->assert_formula(b1); Result r; r = gs->check_sat_assuming(TermVec{ not_b1, b2, b3 }); assert(r.is_unsat()); gs->pop(1); } void test_check_sat_assuming_2(SmtSolver gs) { // Testing check-sat-assuming gs->push(1); Sort bv_sort = gs->make_sort(BV, 4); Term bv1 = gs->make_symbol("bv1", bv_sort); Term bv2 = gs->make_symbol("bv2", bv_sort); Term b1 = gs->make_term(Equal, bv1, gs->make_term(BVNot, bv2)); Term not_b1 = gs->make_term(Not, b1); Term b2 = gs->make_term(BVUgt, bv1, bv2); Term b3 = gs->make_term(BVUgt, bv2, gs->make_term(3, bv_sort)); gs->assert_formula(b1); Result r; r = gs->check_sat_assuming(TermVec{ b2, b3 }); assert(r.is_sat()); gs->pop(1); } void test_unsat_assumptions(SmtSolver gs) { // Testing unsat-assumptions gs->push(1); Sort bool_sort = gs->make_sort(BOOL); Term b1 = gs->make_symbol("bool11", bool_sort); Term not_b1 = gs->make_term(Not, b1); Term b2 = gs->make_symbol("bool22", bool_sort); Term b3 = gs->make_symbol("bool33", bool_sort); gs->assert_formula(b1); Result r = gs->check_sat_assuming(TermVec{ not_b1, b2, b3 }); assert(r.is_unsat()); UnorderedTermSet core; gs->get_unsat_assumptions(core); std::cout << "core: " << std::endl; for (Term t : core) { std::cout << t << std::endl; } gs->pop(1); } void init_solver(SmtSolver gs) { gs->set_opt("produce-models", "true"); gs->set_opt("produce-unsat-assumptions", "true"); gs->set_logic("ALL"); } void new_btor(SmtSolver & gs, int buffer_size) { gs.reset(); string path = (STRFY(BTOR_HOME)); path += "/build/bin/boolector"; vector<string> args = { "--incremental" }; gs = std::make_shared<GenericSolver>(path, args, buffer_size, buffer_size); init_solver(gs); } void new_msat(SmtSolver & gs, int buffer_size) { gs.reset(); string path = (STRFY(MSAT_HOME)); path += "/bin/mathsat"; vector<string> args = { "" }; gs = std::make_shared<GenericSolver>(path, args, buffer_size, buffer_size); init_solver(gs); } void new_yices2(SmtSolver & gs, int buffer_size) { gs.reset(); string path = (STRFY(YICES2_HOME)); path += "/build/bin/yices_smt2"; vector<string> args = { "--incremental" }; gs = std::make_shared<GenericSolver>(path, args, buffer_size, buffer_size); init_solver(gs); } void new_cvc4(SmtSolver & gs, int buffer_size) { gs.reset(); string path = (STRFY(CVC4_HOME)); path += "/build/bin/cvc4"; vector<string> args = { "--lang=smt2", "--incremental", "--dag-thresh=0" }; gs = std::make_shared<GenericSolver>(path, args, buffer_size, buffer_size); init_solver(gs); } void test_msat(int buffer_size) { cout << "testing mathsat" << endl; SmtSolver gs; new_msat(gs, buffer_size); test_bad_term_1(gs); new_msat(gs, buffer_size); test_bad_term_2(gs); new_msat(gs, buffer_size); test_bad_cmd(gs); new_msat(gs, buffer_size); test_uf_1(gs); new_msat(gs, buffer_size); test_bool_1(gs); new_msat(gs, buffer_size); test_bool_2(gs); new_msat(gs, buffer_size); test_uf_2(gs); new_msat(gs, buffer_size); test_int_1(gs); new_msat(gs, buffer_size); test_int_2(gs); new_msat(gs, buffer_size); test_bv_1(gs); new_msat(gs, buffer_size); test_bv_2(gs); new_msat(gs, buffer_size); test_bv_3(gs); new_msat(gs, buffer_size); test_bv_4(gs); new_msat(gs, buffer_size); test_abv_1(gs); new_msat(gs, buffer_size); test_abv_2(gs); new_msat(gs, buffer_size); test_bool(gs); new_msat(gs, buffer_size); test_constant_arrays(gs); new_msat(gs, buffer_size); test_int_models(gs); new_msat(gs, buffer_size); test_bv_models(gs); new_msat(gs, buffer_size); test_check_sat_assuming_1(gs); new_msat(gs, buffer_size); test_check_sat_assuming_2(gs); new_msat(gs, buffer_size); test_unsat_assumptions(gs); } void test_yices2(int buffer_size) { cout << "testing yices" << endl; SmtSolver gs; new_yices2(gs, buffer_size); test_bad_cmd(gs); new_yices2(gs, buffer_size); test_bad_term_1(gs); new_yices2(gs, buffer_size); test_bad_term_2(gs); new_yices2(gs, buffer_size); test_uf_1(gs); new_yices2(gs, buffer_size); test_bool_1(gs); new_yices2(gs, buffer_size); test_bool_2(gs); new_yices2(gs, buffer_size); test_uf_2(gs); new_yices2(gs, buffer_size); test_int_1(gs); new_yices2(gs, buffer_size); test_int_2(gs); new_yices2(gs, buffer_size); test_bv_1(gs); new_yices2(gs, buffer_size); test_bv_2(gs); new_yices2(gs, buffer_size); test_bv_3(gs); new_yices2(gs, buffer_size); test_bv_4(gs); new_yices2(gs, buffer_size); test_abv_1(gs); new_yices2(gs, buffer_size); test_abv_2(gs); new_yices2(gs, buffer_size); test_bool(gs); new_yices2(gs, buffer_size); test_int_models(gs); new_yices2(gs, buffer_size); test_bv_models(gs); new_yices2(gs, buffer_size); test_check_sat_assuming_1(gs); new_yices2(gs, buffer_size); test_check_sat_assuming_2(gs); new_yices2(gs, buffer_size); test_unsat_assumptions(gs); } void test_cvc4(int buffer_size) { SmtSolver gs; new_cvc4(gs, buffer_size); test_bad_term_1(gs); new_cvc4(gs, buffer_size); test_bad_term_2(gs); new_cvc4(gs, buffer_size); test_uf_1(gs); new_cvc4(gs, buffer_size); test_uf_2(gs); new_cvc4(gs, buffer_size); test_int_1(gs); new_cvc4(gs, buffer_size); test_int_2(gs); new_cvc4(gs, buffer_size); test_bad_cmd(gs); new_cvc4(gs, buffer_size); test_bool_1(gs); new_cvc4(gs, buffer_size); test_bool_2(gs); new_cvc4(gs, buffer_size); test_bv_1(gs); new_cvc4(gs, buffer_size); test_bv_2(gs); new_cvc4(gs, buffer_size); test_bv_3(gs); new_cvc4(gs, buffer_size); test_bv_4(gs); new_cvc4(gs, buffer_size); test_abv_1(gs); new_cvc4(gs, buffer_size); test_abv_2(gs); new_cvc4(gs, buffer_size); test_bool(gs); new_cvc4(gs, buffer_size); test_quantifiers(gs); new_cvc4(gs, buffer_size); test_constant_arrays(gs); new_cvc4(gs, buffer_size); test_int_models(gs); new_cvc4(gs, buffer_size); test_bv_models(gs); new_cvc4(gs, buffer_size); test_check_sat_assuming_1(gs); new_cvc4(gs, buffer_size); test_check_sat_assuming_2(gs); new_cvc4(gs, buffer_size); test_unsat_assumptions(gs); } void test_btor(int buffer_size) { cout << "testing btor" << endl; SmtSolver gs; new_btor(gs, buffer_size); test_bad_term_1(gs); new_btor(gs, buffer_size); test_bad_term_2(gs); new_btor(gs, buffer_size); test_bad_cmd(gs); new_btor(gs, buffer_size); test_bool_1(gs); new_btor(gs, buffer_size); test_bool_2(gs); new_btor(gs, buffer_size); test_bv_1(gs); new_btor(gs, buffer_size); test_bv_2(gs); new_btor(gs, buffer_size); test_bv_3(gs); new_btor(gs, buffer_size); test_bv_4(gs); new_btor(gs, buffer_size); test_abv_1(gs); new_btor(gs, buffer_size); test_bv_models(gs); new_btor(gs, buffer_size); test_bool(gs); new_btor(gs, buffer_size); test_check_sat_assuming_1(gs); new_btor(gs, buffer_size); test_check_sat_assuming_2(gs); new_btor(gs, buffer_size); test_unsat_assumptions(gs); } void test_binary(string path, vector<string> args) { std::cout << "testing binary: " << path << std::endl; std::cout << "constructing solver" << std::endl; SmtSolver gs = std::make_shared<GenericSolver>(path, args, 5, 5); std::cout << "setting an option" << std::endl; gs->set_opt("produce-models", "true"); } int main() { // testing a non-existing binary string path; vector<string> args; try { path = "/non/existing/path"; test_binary(path, args); } catch (IncorrectUsageException e) { std::cout << "caught an exception" << std::endl; } // general tests for all supported functions // we test a representative set of buffer sizes, // including smallest and biggest supported, // and a mixture of powers of two and non-powers // of two. vector<int> buffer_sizes = { 2, 10, 64, 100, 256 }; for (int buffer_size : buffer_sizes) { std::cout << "buffer size: " << buffer_size << std::endl; // testing with cvc4 binary #if BUILD_CVC4 std::cout << "testing cvc4" << std::endl; test_cvc4(buffer_size); #endif // testing with msat binary #if BUILD_MSAT std::cout << "testing msat" << std::endl; test_msat(buffer_size); #endif // testing with yices2binary #if BUILD_YICES2 std::cout << "testing yices2" << std::endl; test_yices2(buffer_size); #endif // testing with btorbinary #if BUILD_BTOR std::cout << "testing btor" << std::endl; test_btor(buffer_size); #endif } } #endif // __APPLE__
24.352008
80
0.665538
[ "vector" ]
953c0f380ea48bb5e6bf7ccd14e13f16b0fc82d3
4,615
cpp
C++
ASTWrapper/KLStmt.cpp
leegoonz/FabricServices
8f5bd5eb753b4aba64aab8a251cc677763b26b28
[ "BSD-3-Clause" ]
1
2017-12-04T16:56:13.000Z
2017-12-04T16:56:13.000Z
ASTWrapper/KLStmt.cpp
leegoonz/FabricServices
8f5bd5eb753b4aba64aab8a251cc677763b26b28
[ "BSD-3-Clause" ]
null
null
null
ASTWrapper/KLStmt.cpp
leegoonz/FabricServices
8f5bd5eb753b4aba64aab8a251cc677763b26b28
[ "BSD-3-Clause" ]
1
2021-08-21T21:52:02.000Z
2021-08-21T21:52:02.000Z
// Copyright 2010-2015 Fabric Software Inc. All rights reserved. #include "KLStmt.h" #include "KLCompoundStmt.h" #include "KLConditionalStmt.h" #include "KLCStyleLoopStmt.h" #include "KLSwitchStmt.h" #include "KLCaseStmt.h" #include "KLVarDeclStmt.h" #include "KLExprStmt.h" #include "KLLocation.h" #include <limits.h> #include <vector> #include <string> using namespace FabricServices::ASTWrapper; KLStmt::KLStmt(const KLFile* klFile, JSONData data, KLStmt * parent) : KLCommented(klFile, data) { m_type = getDictValue("type")->getStringData(); m_parent = parent; if(m_parent) m_depth = m_parent->getDepth() + 1; else m_depth = 0; } KLStmt::~KLStmt() { for(uint32_t i=0;i<m_statements.size();i++) { delete(m_statements[i]); } } KLDeclType KLStmt::getDeclType() const { return KLDeclType_Stmt; } bool KLStmt::isOfDeclType(KLDeclType type) const { if(type == KLDeclType_Stmt) return true; return KLCommented::isOfDeclType(type); } std::string KLStmt::getTypeName() const { return m_type; } uint32_t KLStmt::getChildCount() const { return m_statements.size(); } const KLStmt * KLStmt::getChild(uint32_t index) const { return m_statements[index]; } std::vector<const KLStmt*> KLStmt::getAllChildrenOfType(KLDeclType type, bool downwards, bool upwards) const { std::vector<const KLStmt*> result; for(size_t i=0;i<m_statements.size();i++) { if(m_statements[i]->isOfDeclType(type)) { result.push_back(m_statements[i]); } } if(upwards && m_parent) { std::vector<const KLStmt*> childResult = m_parent->getAllChildrenOfType(type, false, true); result.insert(result.end(), childResult.begin(), childResult.end()); } if(downwards) { for(size_t i=0;i<m_statements.size();i++) { std::vector<const KLStmt*> childResult = m_statements[i]->getAllChildrenOfType(type, true, false); result.insert(result.end(), childResult.begin(), childResult.end()); } } return result; } const KLStmt * KLStmt::getStatementAtCursor(uint32_t line, uint32_t column) const { uint32_t minDistance = UINT_MAX; const KLStmt * result = NULL; if(getCursorDistance(line, column) < minDistance) { result = this; minDistance = getCursorDistance(line, column); } for(size_t i=0;i<m_statements.size();i++) { const KLStmt * statement = m_statements[i]->getStatementAtCursor(line, column); if(statement) { uint32_t distance = statement->getCursorDistance(line, column); if(distance < minDistance) { result = statement; minDistance = distance; } } } return result; } const KLStmt * KLStmt::getParent() const { return m_parent; } const KLStmt * KLStmt::getTop() const { if(!m_parent) return this; return m_parent->getTop(); } uint32_t KLStmt::getDepth() const { return m_depth; } const KLStmt * KLStmt::constructChild(JSONData data) { std::string type = data->getDictValue("type")->getStringData(); KLStmt * result = NULL; if(type == "CompoundStatement") { result = new KLCompoundStmt(getKLFile(), data, this); } else if(type == "ASTCondStmt") { result = new KLConditionalStmt(getKLFile(), data, this); } else if(type == "CStyleLoop") { result = new KLCStyleLoopStmt(getKLFile(), data, this); } else if(type == "SwitchStatement") { result = new KLSwitchStmt(getKLFile(), data, this); } else if(type == "Case") { result = new KLCaseStmt(getKLFile(), data, this); } else if(type == "VarDeclStatement") { result = new KLVarDeclStmt(getKLFile(), data, this); } else if(type == "ExprStatement") { result = new KLExprStmt(getKLFile(), data, this); } else { // printf("unresolved type '%s'\n", type.c_str()); // printf("json '%s'\n", data->getJSONEncoding().getStringData()); result = new KLStmt(getKLFile(), data, this); } m_statements.push_back(result); return result; } uint32_t KLStmt::getCursorDistance(uint32_t line, uint32_t column) const { if(getLocation()->getLine() > line || getLocation()->getEndLine() < line) return UINT_MAX; if(getLocation()->getLine() == line && getLocation()->getColumn() > column) return UINT_MAX; if(getLocation()->getEndLine() == line && getLocation()->getEndColumn() < column) return UINT_MAX; uint32_t startDistance = 1000 * (line - getLocation()->getLine()) + column - getLocation()->getColumn(); uint32_t endDistance = 1000 * (getLocation()->getEndLine() - line) + getLocation()->getEndColumn() - column; return startDistance > endDistance ? endDistance : startDistance; }
23.426396
110
0.673239
[ "vector" ]
953c115a9cafd9bbc9a483e0df6c169d863b0067
10,920
cpp
C++
src/Util.cpp
shieldai/AdaptiveShielding
d281b5541139a3e9e6de003392790bb2298075c6
[ "MIT" ]
null
null
null
src/Util.cpp
shieldai/AdaptiveShielding
d281b5541139a3e9e6de003392790bb2298075c6
[ "MIT" ]
null
null
null
src/Util.cpp
shieldai/AdaptiveShielding
d281b5541139a3e9e6de003392790bb2298075c6
[ "MIT" ]
null
null
null
#include <algorithm> #include <cmath> #include <cassert> #include <sys/stat.h> #include <fstream> #include <fcntl.h> #include <iostream> #include <wait.h> #include <boost/program_options.hpp> #include <boost/algorithm/string/trim.hpp> #include "Util.h" struct configInfo gConfig; std::vector<struct blockEventInfo> readBlockFile(std::string &blockFile) { std::vector<struct blockEventInfo> blockEvents; if(blockFile.empty()) return blockEvents; std::ifstream reader; reader.open(blockFile); std::string line; while(std::getline(reader, line)) { auto sp = split(line, ","); size_t startTime; std::string blockLaneID; std::string rerouteLaneID; if(sp.size() > 2) { blockLaneID = sp[0]; boost::algorithm::trim(blockLaneID); rerouteLaneID = sp[2]; boost::algorithm::trim(rerouteLaneID); try { std::string num = sp[1]; boost::algorithm::trim(num); startTime = std::stoul(num); } catch(std::exception &e) { std::cerr << "Can not read block file " << blockFile << " line " << line << ", stoi failed!" << std::endl; exit(-1); } } else { std::cerr << "Can not read block file " << blockFile << " line \"" << line << "\", format error!" << std::endl; exit(-1); } std::cout << "Found block event of lane " << blockLaneID << " at time step " << startTime << std::endl; struct blockEventInfo blockEvent; blockEvent.blockLaneID = blockLaneID; blockEvent.timeStep = startTime; blockEvent.rerouteLaneID = rerouteLaneID; blockEvents.push_back(blockEvent); } return blockEvents; } std::set<std::string> readIgnoreFiles(std::vector<std::string> &ignoreFiles) { std::set<std::string> ignoreIDs; for(const auto &filename : ignoreFiles) { std::ifstream reader; reader.open(filename); std::string line; while(std::getline(reader, line)) { // support commend with # if(line[0]=='#') continue; auto sp = split(line, "#"); if(sp.size() > 1) { line = sp[0]; } boost::algorithm::trim(line); ignoreIDs.insert(line); } } return ignoreIDs; } void parse_args(int argc, char *argv[], struct configInfo &config) { std::string blockFile; std::vector<std::string> ignoreFiles; std::vector<std::string> shieldIDFile; try { boost::program_options::options_description desc("Allowed options"); desc.add_options() ("sumo,c", boost::program_options::value(&config.sumoConfigFile)->required(), "SUMO config file.") ("port,p", boost::program_options::value(&config.port), "Port number for TraCI.") ("shield,s", boost::program_options::value(&config.shieldConfigFiles)->multitoken(), "Shield config files.") ("out,o", boost::program_options::value(&config.logFile), "Outfile name for shielding log.") ("whitelist-tls,w", boost::program_options::value(&shieldIDFile), "File with junction or tls IDs which will be shielded.") ("blacklist-tls,b", boost::program_options::value(&ignoreFiles)->multitoken(), "File with junction or tls IDs which will be not shielded.") ("incident-events,i", boost::program_options::value(&blockFile), "File with traffic indecent event config.") ("update-interval,u", boost::program_options::value(&config.updateInterval), "Update interval of shields.") ("lambda,l", boost::program_options::value(&config.lambda), "Learning rate (Shield Parameter lambda).") ("param-d,d", boost::program_options::value(&config.d), "Shield Parameter d.") ("max-lane-size,k", boost::program_options::value(&config.maxLaneSize), "Limit of recognized waiting vehicles on lanes (Shield Parameter K).") ("simulation-time,t", boost::program_options::value(&config.simulationTime), "Time step until stop the simulation.") ("warm-up-time,x", boost::program_options::value(&config.warmUpTime), "Time step until the shield starts to intervene.") ("gui,g", "Use sumo-gui.") ("free,f", "Run without Shields.") ("bus", "Prioritize public transport.") ("no-lane-merging", "Avoid the merging of parallel lanes.") ("static-update", "Do shield updates in static interval no Minimum change for update required.") ("no-lane-trees", "Disable accurate lane state for non OSM Maps.") ("side-by-side", "Run a shielded and unshielded simulation simulations.") ("hook-sumo", "Connect to external started SUMO.") ("overwrite-controller", "Overwrite the traffic light controller (RL Agent) with the shield strategy " "and reset to previous action if the overwritten controller takes not the control back.") ("help", "Help message."); boost::program_options::variables_map vm; boost::program_options::store(boost::program_options::parse_command_line(argc, argv, desc), vm); if(vm.count("help") || argc==1) { std::cout << desc << "\n"; exit(1); } boost::program_options::notify(vm); config.unshielded = vm.count("free") ? true : false; config.sideBySide = vm.count("side-by-side") ? true : false; config.noMerging = vm.count("no-lane-merging") ? true : false; config.staticUpdate = vm.count("static-update") ? true : false; config.gui = vm.count("gui") ? true : false; config.prioritizeBus = vm.count("bus") ? true : false; config.noTrees = vm.count("no-lane-trees") ? true : false; config.client = vm.count("hook-sumo") ? true : false; config.overwrite = vm.count("overwrite-controller") ? true : false; } catch(std::exception &e) { std::cout << e.what() << "\n"; exit(1); } if(fileExist(config.sumoConfigFile) && !config.client) { std::cerr << "Sumo Config File " << config.sumoConfigFile << " does not exist\n"; exit(1); } if(!blockFile.empty() && fileExist(blockFile)) { std::cerr << "block File " << blockFile << " does not exist\n"; exit(1); } for(const auto &file : config.shieldConfigFiles) { if(fileExist(file)) { std::cerr << "Shield Config File " << file << " does not exist\n"; exit(1); } } for(const auto &file : ignoreFiles) { if(fileExist(file)) { std::cerr << "Ignore File " << file << " does not exist\n"; exit(1); } } for(const auto &file : shieldIDFile) { if(fileExist(file)) { std::cerr << "Shield File " << file << " does not exist\n"; exit(1); } } if(!blockFile.empty()) { config.blockEvents = readBlockFile(blockFile); } if(!ignoreFiles.empty()) { config.ignoreIDs = readIgnoreFiles(ignoreFiles); } if(!shieldIDFile.empty()) { config.shieldedIDs = readIgnoreFiles(shieldIDFile); } } void pythonPlot(const std::vector<char *> &logFiles) { pid_t pid, w; pid = fork(); int waitStatus; if(pid==-1) { std::cerr << "Could not fork to start python\n"; } if(pid==0) { std::vector<char *> args; args.push_back(const_cast<char *>("/usr/bin/python3")); args.push_back(const_cast<char *>("plot.py")); for(auto &logFile : logFiles) args.push_back(logFile); args.push_back(NULL); int fd = open("python.log", O_RDWR | O_CREAT | O_APPEND, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH); dup2(fd, STDOUT_FILENO); dup2(fd, STDERR_FILENO); execv(args[0], args.data()); perror("PYTHON NOT STARTED!\n"); } else { do { w = waitpid(pid, &waitStatus, WUNTRACED | WCONTINUED); if(w==-1) { std::cerr << "Could not wait for process\n"; } if(WIFEXITED(waitStatus) && waitStatus==0) { std::cout << "python succeed\n"; } else if(waitStatus!=0) { std::cerr << "python did not succeed\n"; exit(0); } else if(WIFSIGNALED(waitStatus)) { printf("killed by signal %d\n", WTERMSIG(waitStatus)); } else if(WIFSTOPPED(waitStatus)) { printf("stopped by signal %d\n", WSTOPSIG(waitStatus)); } else if(WIFCONTINUED(waitStatus)) { printf("continued\n"); } } while(!WIFEXITED(waitStatus) && !WIFSIGNALED(waitStatus)); } } bool isNear(float value, float reference) { return std::abs(value - reference) < EPSILON; } bool isPMF(std::vector<float> probabilities) { float sum = 0; std::for_each(probabilities.begin(), probabilities.end(), [&](float p) { sum += p; }); return isNear(sum, 1); } std::string getSubstrBetweenDelims(const std::string &str, const std::string &start_delim, const std::string &stop_delim) { unsigned first_delim_pos = str.find(start_delim); if(first_delim_pos > str.length()) { return std::string(""); } unsigned end_pos_of_first_delim = first_delim_pos + start_delim.length(); unsigned last_delim_pos = first_delim_pos + str.substr(first_delim_pos, str.length() - 1).find(stop_delim); return str.substr(end_pos_of_first_delim, last_delim_pos - end_pos_of_first_delim); } std::string getValueForToken(std::string const &str, std::string const &token) { return getSubstrBetweenDelims(str, token + "=", "\t&"); } std::vector<float> calculatePMF(std::vector<int> &tracking) { float length = 0; std::for_each(tracking.begin(), tracking.end(), [&](auto n) { length += n; }); std::vector<float> probabilities; for(auto track : tracking) { probabilities.push_back(track/float(length)); } // assert(isPMF(probabilities)); return probabilities; } bool fileExist(const std::string &path) { struct stat buffer{}; if(stat(path.c_str(), &buffer)!=0) { return true; } return false; } std::vector<std::string> split(const std::string &line, const std::string &delim) { std::size_t current, previous = 0; std::vector<std::string> ret; current = line.find(delim); while(current!=std::string::npos) { ret.push_back(line.substr(previous, current - previous)); previous = current + 1; current = line.find(delim, previous); } ret.push_back(line.substr(previous, current - previous)); return ret; } void replace(std::string &str, const std::string &from, const std::string &to) { size_t start_pos = str.find(from); if(start_pos!=std::string::npos) { str.replace(start_pos, from.length(), to); } } void formatName(std::string &name) { if(name[0]=='-') name[0] = '_'; if(name[1]=='-') name[1] = '_'; replace(name, "#", "RRR"); name = "lane" + name; } void reformatName(std::string &name) { name = name.substr(4); replace(name, "RRR", "#"); if(name[1]=='_') name[1] = '-'; if(name[0]=='_') name[0] = '-'; } std::string getTimeString() { time_t t; char buffer[80]; time(&t); strftime(buffer, 80, "%Y-%m-%dT%H:%M:%S", localtime(&t)); return std::string(buffer); }
31.652174
116
0.623718
[ "vector" ]
95436e91c0caaab0b2a03928a2f3bc78c7222a7e
1,218
hh
C++
src/math/MatrixEntries.hh
kwisniew/devsim
3a7c1e9c4d28a8a6f9e7a43e5d5475ea2cdfe138
[ "Apache-2.0" ]
null
null
null
src/math/MatrixEntries.hh
kwisniew/devsim
3a7c1e9c4d28a8a6f9e7a43e5d5475ea2cdfe138
[ "Apache-2.0" ]
null
null
null
src/math/MatrixEntries.hh
kwisniew/devsim
3a7c1e9c4d28a8a6f9e7a43e5d5475ea2cdfe138
[ "Apache-2.0" ]
null
null
null
/*** DEVSIM Copyright 2013 Devsim LLC 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. ***/ #ifndef DS_MATRIXENTRIES_HH #define DS_MATRIXENTRIES_HH #include<vector> #include<functional> #include<complex> namespace dsMath { template <typename T> class RowColVal; typedef RowColVal<double> RealRowColVal; typedef std::vector<RealRowColVal > RealRowColValueVec; typedef RowColVal<std::complex<double> > ComplexRowColVal; typedef std::vector<ComplexRowColVal > ComplexRowColValueVec; typedef std::pair<int, double> RHSEntry; typedef std::vector<RHSEntry> RHSEntryVec; template <typename T> class RowColVal { public: RowColVal(int r, int c, T v) : row(r), col(c), val(v) {} int row; int col; T val; }; } #endif
25.914894
72
0.756979
[ "vector" ]
9546317958c16d14b387cf181e9f40b7be60f7e4
3,124
cpp
C++
code/hologine_platform/hologine/core/threading/thread.cpp
aaronbolyard/hologine
6fd07d28c6acfd9cfc49b3efa55b23c95240374e
[ "MIT" ]
3
2015-02-23T21:32:18.000Z
2017-08-14T10:34:52.000Z
code/hologine_platform/hologine/core/threading/thread.cpp
aaronbolyard/hologine
6fd07d28c6acfd9cfc49b3efa55b23c95240374e
[ "MIT" ]
null
null
null
code/hologine_platform/hologine/core/threading/thread.cpp
aaronbolyard/hologine
6fd07d28c6acfd9cfc49b3efa55b23c95240374e
[ "MIT" ]
null
null
null
#include "core/exception.hpp" #include "core/threading/thread.hpp" const holo::thread_return_status holo::thread_return_status_ok = 0; holo::thread::thread() { init_argument(nullptr, nullptr); } holo::thread::thread(holo::thread_callback callback, void* userdata) { // The callback must be valid (otherwise just use the default constructor!). if (callback == nullptr) { push_exception(exception::invalid_argument); init_argument(nullptr, nullptr); } else { init_argument(callback, userdata); create_thread(&argument); } } holo::thread::~thread() { if (!get_argument_flag(flag_thread_exited)) { join(); } } void holo::thread::start() { // This method can only be called if the thread is valid, not running, and // has been created (i.e., a successful invocation of the constructor). if (!is_valid() || get_argument_flag(flag_thread_started) || !get_argument_flag(flag_thread_created)) { push_exception(exception::invalid_operation); } else { run_thread(); } } void holo::thread::start(holo::thread_callback callback, void* userdata) { // This method can only be called if the holo::thread_base object is valid and // no thread has been created. if (!is_valid() || get_argument_flag(flag_thread_created)) { push_exception(exception::invalid_operation); } else if (callback == nullptr) { push_exception(exception::invalid_argument); } else { argument.callback = callback; argument.userdata = userdata; create_thread(&argument); } } holo::thread_return_status holo::thread::join() { // This method can only be called if the holo::thread_base object is valid and // the underlying thread has been created. if (!is_valid() || !get_argument_flag(flag_thread_started)) { push_exception(exception::invalid_operation); } else { if (join_thread()) { return argument.return_status; } } // The caller should query if this call was successful via // holo::thread_base::is_valid(). return thread_return_status_ok; } void holo::thread::set_exceptions_flag(bool enable) { if (!is_valid() && !get_argument_flag(flag_thread_started)) { push_exception(exception::invalid_operation); } else { set_argument_flag(flag_enable_exceptions, enable); } } void holo::thread::set_allocator(holo::allocator* allocator) { if (!is_valid() && !get_argument_flag(flag_thread_started)) { push_exception(exception::invalid_operation); } else { argument.allocator = allocator; } } bool holo::thread::is_valid() const { return !get_argument_flag(flag_thread_invalid); } void holo::thread::set_argument_flag(int flag, bool enable) { if (enable) { argument.flags |= flag; } else { argument.flags &= ~flag; } } bool holo::thread::get_argument_flag(int flag) const { return (argument.flags & flag) == flag; } void holo::thread::invalidate() { set_argument_flag(flag_thread_invalid, true); } void holo::thread::init_argument(holo::thread_callback callback, void* userdata) { argument.return_status = thread_return_status_ok; argument.callback = callback; argument.userdata = userdata; argument.flags = 0; argument.allocator = nullptr; }
21.108108
102
0.729834
[ "object" ]
9546ba4aeda6b5e2ef00c52135eda80589d7f7c0
502,220
cc
C++
EnergyPlus/SetPointManager.cc
yurigabrich/EnergyPlusShadow
396ca83aa82b842e6b177ba35c91b3f481dfbbf9
[ "BSD-3-Clause" ]
null
null
null
EnergyPlus/SetPointManager.cc
yurigabrich/EnergyPlusShadow
396ca83aa82b842e6b177ba35c91b3f481dfbbf9
[ "BSD-3-Clause" ]
1
2020-07-08T13:32:09.000Z
2020-07-08T13:32:09.000Z
EnergyPlus/SetPointManager.cc
yurigabrich/EnergyPlusShadow
396ca83aa82b842e6b177ba35c91b3f481dfbbf9
[ "BSD-3-Clause" ]
null
null
null
// EnergyPlus, Copyright (c) 1996-2018, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other // contributors. All rights reserved. // // NOTICE: This Software was developed under funding from the U.S. Department of Energy and the // U.S. Government consequently retains certain rights. As such, the U.S. Government has been // granted for itself and others acting on its behalf a paid-up, nonexclusive, irrevocable, // worldwide license in the Software to reproduce, distribute copies to the public, prepare // derivative works, and perform publicly and display publicly, and to permit others to do so. // // Redistribution and use in source and binary forms, with or without modification, are permitted // provided that the following conditions are met: // // (1) Redistributions of source code must retain the above copyright notice, this list of // conditions and the following disclaimer. // // (2) Redistributions in binary form must reproduce the above copyright notice, this list of // conditions and the following disclaimer in the documentation and/or other materials // provided with the distribution. // // (3) Neither the name of the University of California, Lawrence Berkeley National Laboratory, // the University of Illinois, U.S. Dept. of Energy nor the names of its contributors may be // used to endorse or promote products derived from this software without specific prior // written permission. // // (4) Use of EnergyPlus(TM) Name. If Licensee (i) distributes the software in stand-alone form // without changes from the version obtained under this License, or (ii) Licensee makes a // reference solely to the software portion of its product, Licensee must refer to the // software as "EnergyPlus version X" software, where "X" is the version number Licensee // obtained under this License and may not use a different name for the software. Except as // specifically required in this Section (4), Licensee shall not use in a company name, a // product name, in advertising, publicity, or other promotional activities any name, trade // name, trademark, logo, or other designation of "EnergyPlus", "E+", "e+" or confusingly // similar designation, without the U.S. Department of Energy's prior written consent. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR // IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY // AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // POSSIBILITY OF SUCH DAMAGE. // C++ Headers #include <cmath> // ObjexxFCL Headers #include <ObjexxFCL/Array.functions.hh> #include <ObjexxFCL/Fmath.hh> // EnergyPlus Headers #include <CurveManager.hh> #include <DataAirLoop.hh> #include <DataAirSystems.hh> #include <DataConvergParams.hh> #include <DataEnvironment.hh> #include <DataHVACGlobals.hh> #include <DataHeatBalance.hh> #include <DataLoopNode.hh> #include <DataPlant.hh> #include <DataPrecisionGlobals.hh> #include <DataZoneControls.hh> #include <DataZoneEnergyDemands.hh> #include <DataZoneEquipment.hh> #include <EMSManager.hh> #include <FluidProperties.hh> #include <General.hh> #include <InputProcessing/InputProcessor.hh> #include <NodeInputManager.hh> #include <OutAirNodeManager.hh> #include <OutputProcessor.hh> #include <PlantUtilities.hh> #include <Psychrometrics.hh> #include <ScheduleManager.hh> #include <SetPointManager.hh> #include <UtilityRoutines.hh> namespace EnergyPlus { namespace SetPointManager { // Module containing the SetPoint Manager routines // MODULE INFORMATION: // AUTHOR Fred Buhl // DATE WRITTEN July 1998 // MODIFIED Shirey/Raustad (FSEC), Jan 2004 // Nov 2004 - Jan 2005 M. J. Witte, GARD Analytics, Inc. // Add new setpoint managers: // SET POINT MANAGER:SINGLE ZONE HEATING and // SET POINT MANAGER:SINGLE ZONE COOLING // SET POINT MANAGER:OUTSIDE AIR PRETREAT // Work supported by ASHRAE research project 1254-RP // Phil Haves Oct 2004 // B. Griffith Aug. 2006. // R. Raustad - FSEC: added AllSetPtMgr used for node conflict checks // July 2010 B.A. Nigusse, FSEC/UCF // Added new setpoint managers: // SetpointManager:MultiZone:Heating:Average // SetpointManager:MultiZone:Cooling:Average // SetpointManager:MultiZone:MinimumHumidity:Average // SetpointManager:MultiZone:MaximumHumidity:Average // 22Aug2010 Craig Wray - added Fan:ComponentModel // Aug 2010 B.A. Nigusse, FSEC/UCF // Added new setpoint managers: // SetpointManager:MultiZone:Humidity:Minimum // SetpointManager:MultiZone:Humidity:Maximum // July 2011 Chandan Sharma, FSEC/UCF // Added new setpoint managers: // SetpointManager:FollowOutdoorAirTemperature // SetpointManager:FollowSystemNodeTemperature // SetpointManager:FollowGroundTemperature // March 2012, Atefe Makhmalbaf and Heejin Cho, PNNL // Added new setpoint manager: // SetpointManager:CondenserEnteringReset // RE-ENGINEERED na // PURPOSE OF THIS MODULE: // To encapsulate the data and algorithms required to // determine all the controller setpoints in the problem. // METHODOLOGY EMPLOYED: // Previous time step node data will be used, in a set of fixed, precoded algorithms, // to determine the current time step's controller setpoints. // REFERENCES: // OTHER NOTES: // USE STATEMENTS: // Use statements for data only modules // Using/Aliasing using namespace DataPrecisionGlobals; using namespace DataLoopNode; using namespace DataAirLoop; using DataEnvironment::OutBaroPress; using DataEnvironment::OutDryBulbTemp; using DataEnvironment::OutHumRat; using DataEnvironment::OutWetBulbTemp; using DataGlobals::BeginDayFlag; using DataGlobals::BeginEnvrnFlag; using DataGlobals::MetersHaveBeenInitialized; using DataGlobals::NumOfZones; using DataGlobals::RunOptCondEntTemp; using namespace ScheduleManager; using DataHVACGlobals::NumPrimaryAirSys; using namespace CurveManager; // USE STATEMENTS using Psychrometrics::PsyCpAirFnWTdb; using Psychrometrics::PsyHFnTdbW; // Data // MODULE PARAMETER DEFINITIONS: int const MaxTemp(1); int const MinTemp(2); int const TempFirst(1); int const FlowFirst(2); int const iRefTempType_WetBulb(1); int const iRefTempType_DryBulb(2); int const iRefGroundTempObjType_BuildingSurface(1); int const iRefGroundTempObjType_Shallow(2); int const iRefGroundTempObjType_Deep(3); int const iRefGroundTempObjType_FCfactorMethod(4); // following are used to reduce string comparisons related to CtrlVarType int const iCtrlVarType_Temp(1); // control type 'Temperature' int const iCtrlVarType_MaxTemp(2); // control type 'MaximumTemperature' int const iCtrlVarType_MinTemp(3); // control type 'MinimumTemperature' int const iCtrlVarType_HumRat(4); // control Type 'HumidityRatio' int const iCtrlVarType_MaxHumRat(5); // control Type 'MaximumHumidityRatio' int const iCtrlVarType_MinHumRat(6); // control Type 'MinimumHumidityRatio' int const iCtrlVarType_MassFlow(7); // control type 'MassFlowRate' int const iCtrlVarType_MaxMassFlow(8); // control Type 'MaximumMassFlowRate' int const iCtrlVarType_MinMassFlow(9); // control Type 'MinimumMassFlowRate' int const NumValidCtrlTypes(9); Array1D_string const cValidCtrlTypes(NumValidCtrlTypes, {"Temperature", "MaximumTemperature", "MinimumTemperature", "HumidityRatio", "MaximumHumidityRatio", "MinimumHumidityRatio", "MassFlowRate", "MaximumMassFlowRate", "MinimumMassFlowRate"}); // following are used to reduce string comparisons related to CtrlVarType int const iSPMType_Scheduled(1); int const iSPMType_ScheduledDual(2); int const iSPMType_OutsideAir(3); int const iSPMType_SZReheat(4); int const iSPMType_SZHeating(5); int const iSPMType_SZCooling(6); int const iSPMType_SZMinHum(7); int const iSPMType_SZMaxHum(8); int const iSPMType_MixedAir(9); int const iSPMType_OutsideAirPretreat(10); int const iSPMType_Warmest(11); int const iSPMType_Coldest(12); int const iSPMType_WarmestTempFlow(13); int const iSPMType_RAB(14); int const iSPMType_MZCoolingAverage(15); int const iSPMType_MZHeatingAverage(16); int const iSPMType_MZMinHumAverage(17); int const iSPMType_MZMaxHumAverage(18); int const iSPMType_MZMinHum(19); int const iSPMType_MZMaxHum(20); int const iSPMType_FollowOATemp(21); int const iSPMType_FollowSysNodeTemp(22); int const iSPMType_GroundTemp(23); int const iSPMType_CondEntReset(24); int const iSPMType_IdealCondEntReset(25); int const iSPMType_SZOneStageCooling(26); int const iSPMType_SZOneStageHeating(27); int const iSPMType_ReturnWaterResetChW(28); int const iSPMType_ReturnWaterResetHW(29); int const iSPMType_TESScheduled(30); int const NumValidSPMTypes(30); Array1D_string const cValidSPMTypes(NumValidSPMTypes, {"SetpointManager:Scheduled", "SetpointManager:Scheduled:DualSetpoint", "SetpointManager:OutdoorAirReset", "SetpointManager:SingleZone:Reheat", "SetpointManager:SingleZone:Heating", "SetpointManager:SingleZone:Cooling", "SetpointManager:SingleZone:Humidity:Minimum", "SetpointManager:SingleZone:Humidity:Maximum", "SetpointManager:MixedAir", "SetpointManager:OutdoorAirPretreat", "SetpointManager:Warmest", "SetpointManager:Coldest", "SetpointManager:WarmestTemperatureFlow", "SetpointManager:ReturnAirBypassFlow", "SetpointManager:MultiZone:Cooling:Average", "SetpointManager:MultiZone:Heating:Average", "SetpointManager:MultiZone:MinimumHumidity:Average", "SetpointManager:MultiZone:MaximumHumidity:Average", "SetpointManager:MultiZone:Humidity:Minimum", "SetpointManager:MultiZone:Humidity:Maximum", "SetpointManager:FollowOutdoorAirTemperature", "SetpointManager:FollowSystemNodeTemperature", "SetpointManager:FollowGroundTemperature", "SetpointManager:CondenserEnteringReset", "SetpointManager:CondenserEnteringReset:Ideal", "SetpointManager:SingleZone:OneStageCooling", "SetpointManager:SingleZone:OneStageHeating", "SetpointManager:ReturnTemperature:ChilledWater", "SetpointManager:ReturnTemperature:HotWater", "SetpointManager:ScheduledTES"}); // Type declarations in SetPointManager module // This one is used for conflicting node checks and is DEALLOCATED at the end of VerifySetPointManagers // Aug 2014 (RKS) The AllSetPtMgr structure is no longer deallocated because of additions of new ScheduledTES managers after all others are read // MODULE VARIABLE DECLARATIONS: int NumAllSetPtMgrs(0); // Number of all Setpoint Managers found in input int NumSchSetPtMgrs(0); // Number of Scheduled Setpoint Managers found in input int NumDualSchSetPtMgrs(0); // Number of Scheduled Dual Setpoint Managers found in input int NumOutAirSetPtMgrs(0); // Number of Outside Air Setpoint Managers found in input int NumSZRhSetPtMgrs(0); // number of single zone reheat setpoint managers int NumSZHtSetPtMgrs(0); // number of single zone heating setpoint managers int NumSZClSetPtMgrs(0); // number of single zone cooling setpoint managers int NumSZMinHumSetPtMgrs(0); // number of Single Zone Minimum Humidity Setpoint Managers int NumSZMaxHumSetPtMgrs(0); // number of Single Zone Maximum Humidity Setpoint Managers int NumMixedAirSetPtMgrs(0); // number of mixed air setpoint managers int NumOAPretreatSetPtMgrs(0); // number of outside air pretreat setpoint managers int NumWarmestSetPtMgrs(0); // number of Warmest setpoint managers int NumColdestSetPtMgrs(0); // number of Coldest setpoint managers int NumWarmestSetPtMgrsTempFlow(0); // number of Warmest Temp Flow setpoint managers int NumRABFlowSetPtMgrs(0); // number of return air bypass temperature-based flow setpoint manager int NumMZClgAverageSetPtMgrs(0); // number of Multizone:Cooling:Average setpoint managers int NumMZHtgAverageSetPtMgrs(0); // number of Multizone:Heating:Average setpoint managers int NumMZAverageMinHumSetPtMgrs(0); // number of MultiZone:MinimumHumidity:Average setpoint managers int NumMZAverageMaxHumSetPtMgrs(0); // number of MultiZone:MaximumHumidity:Average setpoint managers int NumMZMinHumSetPtMgrs(0); // number of MultiZone:Humidity:Minimum setpoint managers int NumMZMaxHumSetPtMgrs(0); // number of MultiZone:Humidity:Maximum setpoint managers int NumFollowOATempSetPtMgrs(0); // number of SetpointManager:FollowOutdoorAirTemperature setpoint managers int NumFollowSysNodeTempSetPtMgrs(0); // number of SetpointManager:FollowSystemNodeTemperature setpoint managers int NumGroundTempSetPtMgrs(0); // number of SetpointManager:FollowGroundTemperature setpoint managers int NumCondEntSetPtMgrs(0); // number of Condenser Entering Reset setpoint managers int NumIdealCondEntSetPtMgrs(0); // number of Ideal Condenser Entering Temperature setpoint managers int NumSZOneStageCoolingSetPtMgrs(0); // number of single zone one stage cooling setpoint managers int NumSZOneStageHeatingSetPtMgrs(0); // number of singel zone one stage heating setpoint managers int NumReturnWaterResetChWSetPtMgrs(0); // number of return water reset setpoint managers int NumReturnWaterResetHWSetPtMgrs(0); // number of hot-water return water reset setpoint managers int NumSchTESSetPtMgrs(0); // number of TES scheduled setpoint managers (created internally, not by user input) bool ManagerOn(false); bool GetInputFlag(true); // First time, input is "gotten" namespace { bool InitSetPointManagersOneTimeFlag(true); bool InitSetPointManagersOneTimeFlag2(true); Real64 DCESPMDsn_EntCondTemp(0.0); Real64 DCESPMDsn_MinCondSetpt(0.0); Real64 DCESPMCur_MinLiftTD(0.0); Real64 DCESPMDesign_Load_Sum(0.0); Real64 DCESPMActual_Load_Sum(0.0); Real64 DCESPMWeighted_Actual_Load_Sum(0.0); Real64 DCESPMWeighted_Design_Load_Sum(0.0); Real64 DCESPMWeighted_Ratio(0.0); Real64 DCESPMMin_DesignWB(0.0); Real64 DCESPMMin_ActualWb(0.0); Real64 DCESPMOpt_CondEntTemp(0.0); Real64 DCESPMDesignClgCapacity_Watts(0.0); Real64 DCESPMCurrentLoad_Watts(0.0); Real64 DCESPMCondInletTemp(0.0); Real64 DCESPMEvapOutletTemp(0.0); } // namespace // temperature-based flow control manager // Average Cooling Set Pt Mgr // Average Heating Set Pt Mgr // Average Minimum humidity ratio Set Pt Mgr // Average Maximum humidity ratio Set Pt Mgr // Temperature Setpoint Manager data // Node Temp Setpoint Manager data // Manager data // SUBROUTINE SPECIFICATIONS FOR MODULE SetPointManager // Object Data Array1D<DataSetPointManager> AllSetPtMgr; // Array for all Setpoint Manager data(warnings) Array1D<DefineScheduledSetPointManager> SchSetPtMgr; // Array for Scheduled Setpoint Manager data Array1D<DefineSchedDualSetPointManager> DualSchSetPtMgr; // Dual Scheduled Setpoint Manager data Array1D<DefineOutsideAirSetPointManager> OutAirSetPtMgr; // Array for Outside Air Setpoint Manager data Array1D<DefineSZReheatSetPointManager> SingZoneRhSetPtMgr; // Array for SZRH Set Pt Mgr Array1D<DefineSZHeatingSetPointManager> SingZoneHtSetPtMgr; // Array for SZ Heating Set Pt Mgr Array1D<DefineSZCoolingSetPointManager> SingZoneClSetPtMgr; // Array for SZ Cooling Set Pt Mgr Array1D<DefineSZMinHumSetPointManager> SZMinHumSetPtMgr; // Array for SZ Min Hum Set Pt Mgr Array1D<DefineSZMaxHumSetPointManager> SZMaxHumSetPtMgr; // Array for SZ Max Hum Set Pt Mgr Array1D<DefineMixedAirSetPointManager> MixedAirSetPtMgr; // Array for Mixed Air Set Pt Mgr Array1D<DefineOAPretreatSetPointManager> OAPretreatSetPtMgr; // Array for OA Pretreat Set Pt Mgr Array1D<DefineWarmestSetPointManager> WarmestSetPtMgr; // Array for Warmest Set Pt Mgr Array1D<DefineColdestSetPointManager> ColdestSetPtMgr; // Array for Coldest Set Pt Mgr Array1D<DefWarmestSetPtManagerTempFlow> WarmestSetPtMgrTempFlow; // Array for Warmest Set Pt Mgr Array1D<DefRABFlowSetPointManager> RABFlowSetPtMgr; // Array for return air bypass Array1D<DefMultiZoneAverageCoolingSetPointManager> MZAverageCoolingSetPtMgr; // Array for MultiZone Array1D<DefMultiZoneAverageHeatingSetPointManager> MZAverageHeatingSetPtMgr; // Array for MultiZone Array1D<DefMultiZoneAverageMinHumSetPointManager> MZAverageMinHumSetPtMgr; // Array for MultiZone Array1D<DefMultiZoneAverageMaxHumSetPointManager> MZAverageMaxHumSetPtMgr; // Array for MultiZone Array1D<DefMultiZoneMinHumSetPointManager> MZMinHumSetPtMgr; // Multizone min humidity rat Set Pt Mgr Array1D<DefMultiZoneMaxHumSetPointManager> MZMaxHumSetPtMgr; // Multizone max humidity rat Set Pt Mgr Array1D<DefineFollowOATempSetPointManager> FollowOATempSetPtMgr; // Array for Follow Outdoor Air Array1D<DefineFollowSysNodeTempSetPointManager> FollowSysNodeTempSetPtMgr; // Array for Follow System Array1D<DefineGroundTempSetPointManager> GroundTempSetPtMgr; // Array for Ground Temp Setpoint Array1D<DefineCondEntSetPointManager> CondEntSetPtMgr; // Condenser Entering Water Set Pt Mgr Array1D<DefineIdealCondEntSetPointManager> IdealCondEntSetPtMgr; // Ideal Condenser Entering Set Pt Mgr Array1D<DefineSZOneStageCoolinggSetPointManager> SZOneStageCoolingSetPtMgr; // single zone 1 stage cool Array1D<DefineSZOneStageHeatingSetPointManager> SZOneStageHeatingSetPtMgr; // single zone 1 stage heat Array1D<DefineReturnWaterChWSetPointManager> ReturnWaterResetChWSetPtMgr; // return water reset Array1D<DefineReturnWaterHWSetPointManager> ReturnWaterResetHWSetPtMgr; // hot-water return water reset Array1D<DefineScheduledTESSetPointManager> SchTESSetPtMgr; // Array for TES Scheduled Setpoint Manager data // Functions void clear_state() { NumAllSetPtMgrs = 0; // Number of all Setpoint Managers found in input NumSchSetPtMgrs = 0; // Number of Scheduled Setpoint Managers found in input NumDualSchSetPtMgrs = 0; // Number of Scheduled Dual Setpoint Managers found in input NumOutAirSetPtMgrs = 0; // Number of Outside Air Setpoint Managers found in input NumSZRhSetPtMgrs = 0; // number of single zone reheat setpoint managers NumSZHtSetPtMgrs = 0; // number of single zone heating setpoint managers NumSZClSetPtMgrs = 0; // number of single zone cooling setpoint managers NumSZMinHumSetPtMgrs = 0; // number of Single Zone Minimum Humidity Setpoint Managers NumSZMaxHumSetPtMgrs = 0; // number of Single Zone Maximum Humidity Setpoint Managers NumMixedAirSetPtMgrs = 0; // number of mixed air setpoint managers NumOAPretreatSetPtMgrs = 0; // number of outside air pretreat setpoint managers NumWarmestSetPtMgrs = 0; // number of Warmest setpoint managers NumColdestSetPtMgrs = 0; // number of Coldest setpoint managers NumWarmestSetPtMgrsTempFlow = 0; // number of Warmest Temp Flow setpoint managers NumRABFlowSetPtMgrs = 0; // number of return air bypass temperature-based flow setpoint manager NumMZClgAverageSetPtMgrs = 0; // number of Multizone:Cooling:Average setpoint managers NumMZHtgAverageSetPtMgrs = 0; // number of Multizone:Heating:Average setpoint managers NumMZAverageMinHumSetPtMgrs = 0; // number of MultiZone:MinimumHumidity:Average setpoint managers NumMZAverageMaxHumSetPtMgrs = 0; // number of MultiZone:MaximumHumidity:Average setpoint managers NumMZMinHumSetPtMgrs = 0; // number of MultiZone:Humidity:Minimum setpoint managers NumMZMaxHumSetPtMgrs = 0; // number of MultiZone:Humidity:Maximum setpoint managers NumFollowOATempSetPtMgrs = 0; // number of SetpointManager:FollowOutdoorAirTemperature setpoint managers NumFollowSysNodeTempSetPtMgrs = 0; // number of SetpointManager:FollowSystemNodeTemperature setpoint managers NumGroundTempSetPtMgrs = 0; // number of SetpointManager:FollowGroundTemperature setpoint managers NumCondEntSetPtMgrs = 0; // number of Condenser Entering Reset setpoint managers NumIdealCondEntSetPtMgrs = 0; // number of Ideal Condenser Entering Temperature setpoint managers NumSZOneStageCoolingSetPtMgrs = 0; // number of single zone one stage cooling setpoint managers NumSZOneStageHeatingSetPtMgrs = 0; // number of singel zone one stage heating setpoint managers NumReturnWaterResetChWSetPtMgrs = 0; // number of return water reset setpoint managers NumReturnWaterResetHWSetPtMgrs = 0; // number of hot-water return water reset setpoint managers DCESPMDsn_EntCondTemp = 0.0; DCESPMDsn_MinCondSetpt = 0.0; DCESPMCur_MinLiftTD = 0.0; DCESPMDesign_Load_Sum = 0.0; DCESPMActual_Load_Sum = 0.0; DCESPMWeighted_Actual_Load_Sum = 0.0; DCESPMWeighted_Design_Load_Sum = 0.0; DCESPMWeighted_Ratio = 0.0; DCESPMMin_DesignWB = 0.0; DCESPMMin_ActualWb = 0.0; DCESPMOpt_CondEntTemp = 0.0; DCESPMDesignClgCapacity_Watts = 0.0; DCESPMCurrentLoad_Watts = 0.0; DCESPMCondInletTemp = 0.0; DCESPMEvapOutletTemp = 0.0; ManagerOn = false; GetInputFlag = true; // First time, input is "gotten" // Object Data InitSetPointManagersOneTimeFlag = true; InitSetPointManagersOneTimeFlag2 = true; AllSetPtMgr.deallocate(); // Array for all Setpoint Manager data(warnings) SchSetPtMgr.deallocate(); // Array for Scheduled Setpoint Manager data DualSchSetPtMgr.deallocate(); // Dual Scheduled Setpoint Manager data OutAirSetPtMgr.deallocate(); // Array for Outside Air Setpoint Manager data SingZoneRhSetPtMgr.deallocate(); // Array for SZRH Set Pt Mgr SingZoneHtSetPtMgr.deallocate(); // Array for SZ Heating Set Pt Mgr SingZoneClSetPtMgr.deallocate(); // Array for SZ Cooling Set Pt Mgr SZMinHumSetPtMgr.deallocate(); // Array for SZ Min Hum Set Pt Mgr SZMaxHumSetPtMgr.deallocate(); // Array for SZ Max Hum Set Pt Mgr MixedAirSetPtMgr.deallocate(); // Array for Mixed Air Set Pt Mgr OAPretreatSetPtMgr.deallocate(); // Array for OA Pretreat Set Pt Mgr WarmestSetPtMgr.deallocate(); // Array for Warmest Set Pt Mgr ColdestSetPtMgr.deallocate(); // Array for Coldest Set Pt Mgr WarmestSetPtMgrTempFlow.deallocate(); // Array for Warmest Set Pt Mgr RABFlowSetPtMgr.deallocate(); // Array for return air bypass MZAverageCoolingSetPtMgr.deallocate(); // Array for MultiZone MZAverageHeatingSetPtMgr.deallocate(); // Array for MultiZone MZAverageMinHumSetPtMgr.deallocate(); // Array for MultiZone MZAverageMaxHumSetPtMgr.deallocate(); // Array for MultiZone MZMinHumSetPtMgr.deallocate(); // Multizone min humidity rat Set Pt Mgr MZMaxHumSetPtMgr.deallocate(); // Multizone max humidity rat Set Pt Mgr FollowOATempSetPtMgr.deallocate(); // Array for Follow Outdoor Air FollowSysNodeTempSetPtMgr.deallocate(); // Array for Follow System GroundTempSetPtMgr.deallocate(); // Array for Ground Temp Setpoint CondEntSetPtMgr.deallocate(); // Condenser Entering Water Set Pt Mgr IdealCondEntSetPtMgr.deallocate(); // Ideal Condenser Entering Set Pt Mgr SZOneStageCoolingSetPtMgr.deallocate(); // single zone 1 stage cool SZOneStageHeatingSetPtMgr.deallocate(); // single zone 1 stage heat ReturnWaterResetChWSetPtMgr.deallocate(); // return water reset ReturnWaterResetHWSetPtMgr.deallocate(); // hot-water return water reset } void ManageSetPoints() { // SUBROUTINE INFORMATION: // AUTHOR Russ Taylor, Rick Strand // DATE WRITTEN May 1998 // MODIFIED Fred Buhl May 2000 // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // METHODOLOGY EMPLOYED: // Each flag is checked and the appropriate manager is then called. // REFERENCES: // na // USE STATEMENTS: // Locals // SUBROUTINE PARAMETER DEFINITIONS: // na // INTERFACE BLOCK SPECIFICATIONS // na // DERIVED TYPE DEFINITIONS // na // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int SetPtMgrNum; // loop index // First time ManageSetPoints is called, get the input for all the setpoint managers if (GetInputFlag) { GetSetPointManagerInputs(); GetInputFlag = false; } InitSetPointManagers(); if (ManagerOn) { SimSetPointManagers(); UpdateSetPointManagers(); // The Mixed Air Setpoint Managers (since they depend on other setpoints, they must be calculated // and updated next to last). for (SetPtMgrNum = 1; SetPtMgrNum <= NumMixedAirSetPtMgrs; ++SetPtMgrNum) { MixedAirSetPtMgr(SetPtMgrNum).calculate(); } UpdateMixedAirSetPoints(); // The Outside Air Pretreat Setpoint Managers (since they depend on other setpoints, they must be calculated // and updated last). for (SetPtMgrNum = 1; SetPtMgrNum <= NumOAPretreatSetPtMgrs; ++SetPtMgrNum) { OAPretreatSetPtMgr(SetPtMgrNum).calculate(); } UpdateOAPretreatSetPoints(); } } void GetSetPointManagerInputs() { // wrapper for GetInput to allow unit testing when fatal inputs are detected static bool ErrorsFound(false); static std::string const RoutineName("GetSetPointManagerInputs: "); // include trailing blank space GetSetPointManagerInputData(ErrorsFound); if (ErrorsFound) { ShowFatalError(RoutineName + "Errors found in input. Program terminates."); } } void GetSetPointManagerInputData(bool &ErrorsFound) { // SUBROUTINE INFORMATION: // AUTHOR Fred Buhl // DATE WRITTEN July 1998 // MODIFIED Shirey/Raustad (FSEC), Jan 2004 // Nov 2004 - Jan 2005 M. J. Witte, GARD Analytics, Inc. // Add new setpoint managers: // SET POINT MANAGER:SINGLE ZONE HEATING and // SET POINT MANAGER:SINGLE ZONE COOLING // SET POINT MANAGER:OUTSIDE AIR PRETREAT // Work supported by ASHRAE research project 1254-RP // Haves October 2004 // Witte (GARD), Sep 2006 // July 2010 B.A. Nigusse, FSEC/UCF // Added new setpoint managers: // SetpointManager:MultiZone:Heating:Average // SetpointManager:MultiZone:Cooling:Average // SetpointManager:MultiZone:MinimumHumidity:Average // SetpointManager:MultiZone:MaximumHumidity:Average // Aug 2010 B.A. Nigusse, FSEC/UCF // Added new setpoint managers: // SetpointManager:MultiZone:Humidity:Minimum // SetpointManager:MultiZone:Humidity:Maximum // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE // Input the SetPointManager data and store it in the SetPtMgrIn array. // Examine the Controllers in the input data and determine which ones // will have their setpoints set by a particular Setpoint Manager. // METHODOLOGY EMPLOYED: // Use the Get routines from the InputProcessor module. // Using/Aliasing using DataEnvironment::FCGroundTemps; using DataEnvironment::GroundTemp; using DataEnvironment::GroundTemp_Deep; using DataEnvironment::GroundTemp_DeepObjInput; using DataEnvironment::GroundTemp_Surface; using DataEnvironment::GroundTemp_SurfaceObjInput; using DataEnvironment::GroundTempFC; using DataEnvironment::GroundTempObjInput; using DataHeatBalance::Zone; using DataZoneControls::StageZoneLogic; using DataZoneEquipment::GetSystemNodeNumberForZone; using General::FindNumberInList; using General::RoundSigDigits; using NodeInputManager::GetNodeNums; using NodeInputManager::GetOnlySingleNode; using ScheduleManager::CheckScheduleValueMinMax; using ScheduleManager::GetScheduleIndex; // Locals // SUBROUTINE PARAMETER DEFINITIONS: static std::string const RoutineName("GetSetPointManagerInputs: "); // include trailing blank space // SUBROUTINE LOCAL VARIABLE DECLARATIONS: Array1D_string cAlphaFieldNames; Array1D_string cNumericFieldNames; Array1D_bool lNumericFieldBlanks; Array1D_bool lAlphaFieldBlanks; Array1D_string cAlphaArgs; Array1D<Real64> rNumericArgs; std::string cCurrentModuleObject; static int MaxNumAlphas(0); // argument for call to GetObjectDefMaxArgs static int MaxNumNumbers(0); // argument for call to GetObjectDefMaxArgs int NumNums; // Number of real numbers returned by GetObjectItem int NumAlphas; // Number of alphanumerics returned by GetObjectItem int NumParams; int SetPtMgrNum; // Setpoint Manager index int AllSetPtMgrNum; // Setpoint Manager index to ALL setpoint managers in single TYPE int IOStat; // Status flag from GetObjectItem int NumNodesCtrld; // number of controlled nodes in input node list int CtrldNodeNum; // index of the items in the controlled node node list int NumZones; // number of zone nodes in input node list int ZoneNum; // loop index for zone nodes int NumNodes; Array1D_int NodeNums; static bool NodeListError(false); bool ErrInList; int Found; static bool NoSurfaceGroundTempObjWarning(true); // This will cause a warning to be issued if no "surface" ground // temperature object was input. static bool NoShallowGroundTempObjWarning(true); // This will cause a warning to be issued if no "shallow" ground // temperature object was input. static bool NoDeepGroundTempObjWarning(true); // This will cause a warning to be issued if no "deep" ground // temperature object was input. static bool NoFCGroundTempObjWarning(true); // This will cause a warning to be issued if no ground // temperature object was input for FC Factor method NumNodesCtrld = 0; CtrldNodeNum = 0; NumZones = 0; ZoneNum = 0; cCurrentModuleObject = "SetpointManager:Scheduled"; NumSchSetPtMgrs = inputProcessor->getNumObjectsFound(cCurrentModuleObject); // 'SetpointManager:Scheduled' inputProcessor->getObjectDefMaxArgs(cCurrentModuleObject, NumParams, NumAlphas, NumNums); MaxNumNumbers = NumNums; MaxNumAlphas = NumAlphas; cCurrentModuleObject = "SetpointManager:Scheduled:DualSetpoint"; NumDualSchSetPtMgrs = inputProcessor->getNumObjectsFound(cCurrentModuleObject); // 'SetpointManager:Scheduled:DualSetpoint' inputProcessor->getObjectDefMaxArgs(cCurrentModuleObject, NumParams, NumAlphas, NumNums); MaxNumNumbers = max(MaxNumNumbers, NumNums); MaxNumAlphas = max(MaxNumAlphas, NumAlphas); cCurrentModuleObject = "SetpointManager:OutdoorAirReset"; NumOutAirSetPtMgrs = inputProcessor->getNumObjectsFound(cCurrentModuleObject); // 'SetpointManager:OutdoorAirReset' inputProcessor->getObjectDefMaxArgs(cCurrentModuleObject, NumParams, NumAlphas, NumNums); MaxNumNumbers = max(MaxNumNumbers, NumNums); MaxNumAlphas = max(MaxNumAlphas, NumAlphas); cCurrentModuleObject = "SetpointManager:SingleZone:Reheat"; NumSZRhSetPtMgrs = inputProcessor->getNumObjectsFound(cCurrentModuleObject); // 'SetpointManager:SingleZone:Reheat' inputProcessor->getObjectDefMaxArgs(cCurrentModuleObject, NumParams, NumAlphas, NumNums); MaxNumNumbers = max(MaxNumNumbers, NumNums); MaxNumAlphas = max(MaxNumAlphas, NumAlphas); cCurrentModuleObject = "SetpointManager:SingleZone:Heating"; NumSZHtSetPtMgrs = inputProcessor->getNumObjectsFound(cCurrentModuleObject); // 'SetpointManager:SingleZone:Heating' inputProcessor->getObjectDefMaxArgs(cCurrentModuleObject, NumParams, NumAlphas, NumNums); MaxNumNumbers = max(MaxNumNumbers, NumNums); MaxNumAlphas = max(MaxNumAlphas, NumAlphas); cCurrentModuleObject = "SetpointManager:SingleZone:Cooling"; NumSZClSetPtMgrs = inputProcessor->getNumObjectsFound(cCurrentModuleObject); // 'SetpointManager:SingleZone:Cooling' inputProcessor->getObjectDefMaxArgs(cCurrentModuleObject, NumParams, NumAlphas, NumNums); MaxNumNumbers = max(MaxNumNumbers, NumNums); MaxNumAlphas = max(MaxNumAlphas, NumAlphas); cCurrentModuleObject = "SetpointManager:SingleZone:Humidity:Minimum"; NumSZMinHumSetPtMgrs = inputProcessor->getNumObjectsFound(cCurrentModuleObject); // 'SetpointManager:SingleZone:Humidity:Minimum' inputProcessor->getObjectDefMaxArgs(cCurrentModuleObject, NumParams, NumAlphas, NumNums); MaxNumNumbers = max(MaxNumNumbers, NumNums); MaxNumAlphas = max(MaxNumAlphas, NumAlphas); cCurrentModuleObject = "SetpointManager:SingleZone:Humidity:Maximum"; NumSZMaxHumSetPtMgrs = inputProcessor->getNumObjectsFound(cCurrentModuleObject); // 'SetpointManager:SingleZone:Humidity:Maximum' inputProcessor->getObjectDefMaxArgs(cCurrentModuleObject, NumParams, NumAlphas, NumNums); MaxNumNumbers = max(MaxNumNumbers, NumNums); MaxNumAlphas = max(MaxNumAlphas, NumAlphas); cCurrentModuleObject = "SetpointManager:MixedAir"; NumMixedAirSetPtMgrs = inputProcessor->getNumObjectsFound(cCurrentModuleObject); // 'SetpointManager:MixedAir' inputProcessor->getObjectDefMaxArgs(cCurrentModuleObject, NumParams, NumAlphas, NumNums); MaxNumNumbers = max(MaxNumNumbers, NumNums); MaxNumAlphas = max(MaxNumAlphas, NumAlphas); cCurrentModuleObject = "SetpointManager:OutdoorAirPretreat"; NumOAPretreatSetPtMgrs = inputProcessor->getNumObjectsFound(cCurrentModuleObject); // 'SetpointManager:OutdoorAirPretreat' inputProcessor->getObjectDefMaxArgs(cCurrentModuleObject, NumParams, NumAlphas, NumNums); MaxNumNumbers = max(MaxNumNumbers, NumNums); MaxNumAlphas = max(MaxNumAlphas, NumAlphas); cCurrentModuleObject = "SetpointManager:Warmest"; NumWarmestSetPtMgrs = inputProcessor->getNumObjectsFound(cCurrentModuleObject); // 'SetpointManager:Warmest' inputProcessor->getObjectDefMaxArgs(cCurrentModuleObject, NumParams, NumAlphas, NumNums); MaxNumNumbers = max(MaxNumNumbers, NumNums); MaxNumAlphas = max(MaxNumAlphas, NumAlphas); cCurrentModuleObject = "SetpointManager:Coldest"; NumColdestSetPtMgrs = inputProcessor->getNumObjectsFound(cCurrentModuleObject); // 'SetpointManager:Coldest' inputProcessor->getObjectDefMaxArgs(cCurrentModuleObject, NumParams, NumAlphas, NumNums); MaxNumNumbers = max(MaxNumNumbers, NumNums); MaxNumAlphas = max(MaxNumAlphas, NumAlphas); cCurrentModuleObject = "SetpointManager:WarmestTemperatureFlow"; NumWarmestSetPtMgrsTempFlow = inputProcessor->getNumObjectsFound(cCurrentModuleObject); // 'SetpointManager:WarmestTemperatureFlow' inputProcessor->getObjectDefMaxArgs(cCurrentModuleObject, NumParams, NumAlphas, NumNums); MaxNumNumbers = max(MaxNumNumbers, NumNums); MaxNumAlphas = max(MaxNumAlphas, NumAlphas); cCurrentModuleObject = "SetpointManager:ReturnAirBypassFlow"; NumRABFlowSetPtMgrs = inputProcessor->getNumObjectsFound(cCurrentModuleObject); // 'SetpointManager:ReturnAirBypassFlow' inputProcessor->getObjectDefMaxArgs(cCurrentModuleObject, NumParams, NumAlphas, NumNums); MaxNumNumbers = max(MaxNumNumbers, NumNums); MaxNumAlphas = max(MaxNumAlphas, NumAlphas); cCurrentModuleObject = "SetpointManager:MultiZone:Cooling:Average"; NumMZClgAverageSetPtMgrs = inputProcessor->getNumObjectsFound(cCurrentModuleObject); // 'SetpointManager:MultiZone:Cooling:Average' inputProcessor->getObjectDefMaxArgs(cCurrentModuleObject, NumParams, NumAlphas, NumNums); MaxNumNumbers = max(MaxNumNumbers, NumNums); MaxNumAlphas = max(MaxNumAlphas, NumAlphas); cCurrentModuleObject = "SetpointManager:MultiZone:Heating:Average"; NumMZHtgAverageSetPtMgrs = inputProcessor->getNumObjectsFound(cCurrentModuleObject); // 'SetpointManager:MultiZone:Heating:Average' inputProcessor->getObjectDefMaxArgs(cCurrentModuleObject, NumParams, NumAlphas, NumNums); MaxNumNumbers = max(MaxNumNumbers, NumNums); MaxNumAlphas = max(MaxNumAlphas, NumAlphas); cCurrentModuleObject = "SetpointManager:MultiZone:MinimumHumidity:Average"; NumMZAverageMinHumSetPtMgrs = inputProcessor->getNumObjectsFound(cCurrentModuleObject); // 'SetpointManager:MultiZone:MinimumHumidity:Average' inputProcessor->getObjectDefMaxArgs(cCurrentModuleObject, NumParams, NumAlphas, NumNums); MaxNumNumbers = max(MaxNumNumbers, NumNums); MaxNumAlphas = max(MaxNumAlphas, NumAlphas); cCurrentModuleObject = "SetpointManager:MultiZone:MaximumHumidity:Average"; NumMZAverageMaxHumSetPtMgrs = inputProcessor->getNumObjectsFound(cCurrentModuleObject); // 'SetpointManager:MultiZone:MaximumHumidity:Average' inputProcessor->getObjectDefMaxArgs(cCurrentModuleObject, NumParams, NumAlphas, NumNums); MaxNumNumbers = max(MaxNumNumbers, NumNums); MaxNumAlphas = max(MaxNumAlphas, NumAlphas); cCurrentModuleObject = "SetpointManager:MultiZone:Humidity:Minimum"; NumMZMinHumSetPtMgrs = inputProcessor->getNumObjectsFound(cCurrentModuleObject); // 'SetpointManager:MultiZone:Humidity:Minimum' inputProcessor->getObjectDefMaxArgs(cCurrentModuleObject, NumParams, NumAlphas, NumNums); MaxNumNumbers = max(MaxNumNumbers, NumNums); MaxNumAlphas = max(MaxNumAlphas, NumAlphas); cCurrentModuleObject = "SetpointManager:MultiZone:Humidity:Maximum"; NumMZMaxHumSetPtMgrs = inputProcessor->getNumObjectsFound(cCurrentModuleObject); // 'SetpointManager:MultiZone:Humidity:Maximum' inputProcessor->getObjectDefMaxArgs(cCurrentModuleObject, NumParams, NumAlphas, NumNums); MaxNumNumbers = max(MaxNumNumbers, NumNums); MaxNumAlphas = max(MaxNumAlphas, NumAlphas); cCurrentModuleObject = "SetpointManager:FollowOutdoorAirTemperature"; NumFollowOATempSetPtMgrs = inputProcessor->getNumObjectsFound(cCurrentModuleObject); // 'SetpointManager:FollowOutdoorAirTemperature' inputProcessor->getObjectDefMaxArgs(cCurrentModuleObject, NumParams, NumAlphas, NumNums); MaxNumNumbers = max(MaxNumNumbers, NumNums); MaxNumAlphas = max(MaxNumAlphas, NumAlphas); cCurrentModuleObject = "SetpointManager:FollowSystemNodeTemperature"; NumFollowSysNodeTempSetPtMgrs = inputProcessor->getNumObjectsFound(cCurrentModuleObject); // 'SetpointManager:FollowSystemNodeTemperature' inputProcessor->getObjectDefMaxArgs(cCurrentModuleObject, NumParams, NumAlphas, NumNums); MaxNumNumbers = max(MaxNumNumbers, NumNums); MaxNumAlphas = max(MaxNumAlphas, NumAlphas); cCurrentModuleObject = "SetpointManager:FollowGroundTemperature"; NumGroundTempSetPtMgrs = inputProcessor->getNumObjectsFound(cCurrentModuleObject); // 'SetpointManager:FollowGroundTemperature' inputProcessor->getObjectDefMaxArgs(cCurrentModuleObject, NumParams, NumAlphas, NumNums); MaxNumNumbers = max(MaxNumNumbers, NumNums); MaxNumAlphas = max(MaxNumAlphas, NumAlphas); cCurrentModuleObject = "SetpointManager:CondenserEnteringReset"; NumCondEntSetPtMgrs = inputProcessor->getNumObjectsFound(cCurrentModuleObject); // 'SetpointManager:CondenserEnteringReset' inputProcessor->getObjectDefMaxArgs(cCurrentModuleObject, NumParams, NumAlphas, NumNums); MaxNumNumbers = max(MaxNumNumbers, NumNums); MaxNumAlphas = max(MaxNumAlphas, NumAlphas); cCurrentModuleObject = "SetpointManager:CondenserEnteringReset:Ideal"; NumIdealCondEntSetPtMgrs = inputProcessor->getNumObjectsFound(cCurrentModuleObject); // 'SetpointManager:CondenserEnteringReset:Ideal' inputProcessor->getObjectDefMaxArgs(cCurrentModuleObject, NumParams, NumAlphas, NumNums); MaxNumNumbers = max(MaxNumNumbers, NumNums); MaxNumAlphas = max(MaxNumAlphas, NumAlphas); cCurrentModuleObject = "SetpointManager:SingleZone:OneStageCooling"; NumSZOneStageCoolingSetPtMgrs = inputProcessor->getNumObjectsFound(cCurrentModuleObject); inputProcessor->getObjectDefMaxArgs(cCurrentModuleObject, NumParams, NumAlphas, NumNums); MaxNumNumbers = max(MaxNumNumbers, NumNums); MaxNumAlphas = max(MaxNumAlphas, NumAlphas); cCurrentModuleObject = "SetpointManager:SingleZone:OneStageHeating"; NumSZOneStageHeatingSetPtMgrs = inputProcessor->getNumObjectsFound(cCurrentModuleObject); inputProcessor->getObjectDefMaxArgs(cCurrentModuleObject, NumParams, NumAlphas, NumNums); MaxNumNumbers = max(MaxNumNumbers, NumNums); MaxNumAlphas = max(MaxNumAlphas, NumAlphas); cCurrentModuleObject = "SetpointManager:ReturnTemperature:ChilledWater"; NumReturnWaterResetChWSetPtMgrs = inputProcessor->getNumObjectsFound(cCurrentModuleObject); inputProcessor->getObjectDefMaxArgs(cCurrentModuleObject, NumParams, NumAlphas, NumNums); MaxNumNumbers = max(MaxNumNumbers, NumNums); MaxNumAlphas = max(MaxNumAlphas, NumAlphas); cCurrentModuleObject = "SetpointManager:ReturnTemperature:HotWater"; NumReturnWaterResetHWSetPtMgrs = inputProcessor->getNumObjectsFound(cCurrentModuleObject); inputProcessor->getObjectDefMaxArgs(cCurrentModuleObject, NumParams, NumAlphas, NumNums); MaxNumNumbers = max(MaxNumNumbers, NumNums); MaxNumAlphas = max(MaxNumAlphas, NumAlphas); NumAllSetPtMgrs = NumSchSetPtMgrs + NumDualSchSetPtMgrs + NumOutAirSetPtMgrs + NumSZRhSetPtMgrs + NumSZHtSetPtMgrs + NumSZClSetPtMgrs + NumSZMinHumSetPtMgrs + NumSZMaxHumSetPtMgrs + NumMixedAirSetPtMgrs + NumOAPretreatSetPtMgrs + NumWarmestSetPtMgrs + NumColdestSetPtMgrs + NumWarmestSetPtMgrsTempFlow + NumRABFlowSetPtMgrs + NumMZClgAverageSetPtMgrs + NumMZHtgAverageSetPtMgrs + NumMZAverageMinHumSetPtMgrs + NumMZAverageMaxHumSetPtMgrs + NumMZMinHumSetPtMgrs + NumMZMaxHumSetPtMgrs + NumFollowOATempSetPtMgrs + NumFollowSysNodeTempSetPtMgrs + NumGroundTempSetPtMgrs + NumCondEntSetPtMgrs + NumIdealCondEntSetPtMgrs + NumSZOneStageCoolingSetPtMgrs + NumSZOneStageHeatingSetPtMgrs + NumReturnWaterResetChWSetPtMgrs + NumReturnWaterResetHWSetPtMgrs; cAlphaFieldNames.allocate(MaxNumAlphas); cAlphaArgs.allocate(MaxNumAlphas); lAlphaFieldBlanks.dimension(MaxNumAlphas, false); cNumericFieldNames.allocate(MaxNumNumbers); rNumericArgs.dimension(MaxNumNumbers, 0.0); lNumericFieldBlanks.dimension(MaxNumNumbers, false); inputProcessor->getObjectDefMaxArgs("NodeList", NumParams, NumAlphas, NumNums); NodeNums.dimension(NumParams, 0); if (NumAllSetPtMgrs > 0) AllSetPtMgr.allocate(NumAllSetPtMgrs); // Allocate the entire Setpoint Manager input data array // Input the Scheduled Setpoint Managers if (NumSchSetPtMgrs > 0) SchSetPtMgr.allocate(NumSchSetPtMgrs); // Allocate the Setpoint Manager input data array // Input the data for each Setpoint Manager cCurrentModuleObject = "SetpointManager:Scheduled"; for (SetPtMgrNum = 1; SetPtMgrNum <= NumSchSetPtMgrs; ++SetPtMgrNum) { inputProcessor->getObjectItem(cCurrentModuleObject, SetPtMgrNum, cAlphaArgs, NumAlphas, rNumericArgs, NumNums, IOStat, lNumericFieldBlanks, lAlphaFieldBlanks, cAlphaFieldNames, cNumericFieldNames); UtilityRoutines::IsNameEmpty(cAlphaArgs(1), cCurrentModuleObject, ErrorsFound); SchSetPtMgr(SetPtMgrNum).Name = cAlphaArgs(1); SchSetPtMgr(SetPtMgrNum).CtrlVarType = cAlphaArgs(2); // setup program flow control integers if (UtilityRoutines::SameString(SchSetPtMgr(SetPtMgrNum).CtrlVarType, "Temperature")) { SchSetPtMgr(SetPtMgrNum).CtrlTypeMode = iCtrlVarType_Temp; } else if (UtilityRoutines::SameString(SchSetPtMgr(SetPtMgrNum).CtrlVarType, "MaximumTemperature")) { SchSetPtMgr(SetPtMgrNum).CtrlTypeMode = iCtrlVarType_MaxTemp; } else if (UtilityRoutines::SameString(SchSetPtMgr(SetPtMgrNum).CtrlVarType, "MinimumTemperature")) { SchSetPtMgr(SetPtMgrNum).CtrlTypeMode = iCtrlVarType_MinTemp; } else if (UtilityRoutines::SameString(SchSetPtMgr(SetPtMgrNum).CtrlVarType, "HumidityRatio")) { SchSetPtMgr(SetPtMgrNum).CtrlTypeMode = iCtrlVarType_HumRat; } else if (UtilityRoutines::SameString(SchSetPtMgr(SetPtMgrNum).CtrlVarType, "MaximumHumidityRatio")) { SchSetPtMgr(SetPtMgrNum).CtrlTypeMode = iCtrlVarType_MaxHumRat; } else if (UtilityRoutines::SameString(SchSetPtMgr(SetPtMgrNum).CtrlVarType, "MinimumHumidityRatio")) { SchSetPtMgr(SetPtMgrNum).CtrlTypeMode = iCtrlVarType_MinHumRat; } else if (UtilityRoutines::SameString(SchSetPtMgr(SetPtMgrNum).CtrlVarType, "MassFlowRate")) { SchSetPtMgr(SetPtMgrNum).CtrlTypeMode = iCtrlVarType_MassFlow; } else if (UtilityRoutines::SameString(SchSetPtMgr(SetPtMgrNum).CtrlVarType, "MaximumMassFlowRate")) { SchSetPtMgr(SetPtMgrNum).CtrlTypeMode = iCtrlVarType_MaxMassFlow; } else if (UtilityRoutines::SameString(SchSetPtMgr(SetPtMgrNum).CtrlVarType, "MinimumMassFlowRate")) { SchSetPtMgr(SetPtMgrNum).CtrlTypeMode = iCtrlVarType_MinMassFlow; } else { ShowSevereError(RoutineName + cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\", invalid field."); ShowContinueError("..invalid " + cAlphaFieldNames(2) + "=\"" + cAlphaArgs(2) + "\"."); ShowContinueError("..Valid values are \"Temperature\",\"MaximumTemperature\",\"MinimumTemperature\","); ShowContinueError(" \"HumidityRatio\",\"MaximumHumidityRatio\",\"MinimumHumidityRatio\",\"MassFlowRate\","); ShowContinueError(" \"MaximumMassFlowRate\" or \"MinimumMassFlowRate\""); ErrorsFound = true; } SchSetPtMgr(SetPtMgrNum).Sched = cAlphaArgs(3); SchSetPtMgr(SetPtMgrNum).SchedPtr = GetScheduleIndex(cAlphaArgs(3)); if (SchSetPtMgr(SetPtMgrNum).SchedPtr == 0) { if (lAlphaFieldBlanks(3)) { ShowSevereError(RoutineName + cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\", blank required field."); ShowContinueError("..required field " + cAlphaFieldNames(3)); } else { ShowSevereError(RoutineName + cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\", invalid field."); ShowContinueError("..invalid " + cAlphaFieldNames(3) + "=\"" + cAlphaArgs(3) + "\"."); } ErrorsFound = true; } SchSetPtMgr(SetPtMgrNum).CtrlNodeListName = cAlphaArgs(4); NodeListError = false; GetNodeNums(SchSetPtMgr(SetPtMgrNum).CtrlNodeListName, NumNodes, NodeNums, NodeListError, NodeType_Unknown, cCurrentModuleObject, cAlphaArgs(1), NodeConnectionType_SetPoint, 1, ObjectIsNotParent, _, cAlphaFieldNames(4)); if (!NodeListError) { NumNodesCtrld = NumNodes; SchSetPtMgr(SetPtMgrNum).CtrlNodes.allocate(NumNodesCtrld); SchSetPtMgr(SetPtMgrNum).NumCtrlNodes = NumNodesCtrld; SchSetPtMgr(SetPtMgrNum).SetPt = 0.0; for (CtrldNodeNum = 1; CtrldNodeNum <= NumNodesCtrld; ++CtrldNodeNum) { SchSetPtMgr(SetPtMgrNum).CtrlNodes(CtrldNodeNum) = NodeNums(CtrldNodeNum); } } else { // CALL ShowSevereError(RoutineName//TRIM(cCurrentModuleObject)//'="'//TRIM(cAlphaArgs(1))// & // '", invalid field.') // Call ShowContinueError('..invalid '//TRIM(cAlphaFieldNames(4))//'="'//TRIM(cAlphaArgs(4))//'".') ErrorsFound = true; } AllSetPtMgrNum = SetPtMgrNum; if (!NodeListError) { AllSetPtMgr(AllSetPtMgrNum).CtrlNodes.allocate(NumNodesCtrld); AllSetPtMgr(AllSetPtMgrNum).CtrlNodes = SchSetPtMgr(SetPtMgrNum).CtrlNodes; } AllSetPtMgr(AllSetPtMgrNum).Name = SchSetPtMgr(SetPtMgrNum).Name; AllSetPtMgr(AllSetPtMgrNum).SPMType = iSPMType_Scheduled; AllSetPtMgr(AllSetPtMgrNum).CtrlTypeMode = SchSetPtMgr(SetPtMgrNum).CtrlTypeMode; AllSetPtMgr(AllSetPtMgrNum).NumCtrlNodes = SchSetPtMgr(SetPtMgrNum).NumCtrlNodes; } // Input the Scheduled Setpoint Managers DUAL SETPOINT if (NumDualSchSetPtMgrs > 0) DualSchSetPtMgr.allocate(NumDualSchSetPtMgrs); // Allocate the Setpoint Manager input data array // Input the data for each Setpoint Manager cCurrentModuleObject = "SetpointManager:Scheduled:DualSetpoint"; for (SetPtMgrNum = 1; SetPtMgrNum <= NumDualSchSetPtMgrs; ++SetPtMgrNum) { inputProcessor->getObjectItem(cCurrentModuleObject, SetPtMgrNum, cAlphaArgs, NumAlphas, rNumericArgs, NumNums, IOStat, lNumericFieldBlanks, lAlphaFieldBlanks, cAlphaFieldNames, cNumericFieldNames); UtilityRoutines::IsNameEmpty(cAlphaArgs(1), cCurrentModuleObject, ErrorsFound); DualSchSetPtMgr(SetPtMgrNum).Name = cAlphaArgs(1); DualSchSetPtMgr(SetPtMgrNum).CtrlVarType = cAlphaArgs(2); if (UtilityRoutines::SameString(DualSchSetPtMgr(SetPtMgrNum).CtrlVarType, "Temperature")) { DualSchSetPtMgr(SetPtMgrNum).CtrlTypeMode = iCtrlVarType_Temp; } else { // should not come here if idd type choice and key list is working ShowSevereError(RoutineName + cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\", invalid field."); ShowContinueError("..invalid " + cAlphaFieldNames(2) + "=\"" + cAlphaArgs(2) + "\"."); ShowContinueError("..Valid value is \"Temperature\"."); ErrorsFound = true; } DualSchSetPtMgr(SetPtMgrNum).SchedHi = cAlphaArgs(3); DualSchSetPtMgr(SetPtMgrNum).SchedPtrHi = GetScheduleIndex(cAlphaArgs(3)); if (DualSchSetPtMgr(SetPtMgrNum).SchedPtrHi == 0) { if (lAlphaFieldBlanks(3)) { ShowSevereError(RoutineName + cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\", blank required field."); ShowContinueError("..required field " + cAlphaFieldNames(3)); } else { ShowSevereError(RoutineName + cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\", invalid field."); ShowContinueError("..invalid " + cAlphaFieldNames(3) + "=\"" + cAlphaArgs(3) + "\"."); } ErrorsFound = true; } DualSchSetPtMgr(SetPtMgrNum).SchedLo = cAlphaArgs(4); DualSchSetPtMgr(SetPtMgrNum).SchedPtrLo = GetScheduleIndex(cAlphaArgs(4)); if (DualSchSetPtMgr(SetPtMgrNum).SchedPtrLo == 0) { if (lAlphaFieldBlanks(4)) { ShowSevereError(RoutineName + cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\", blank required field."); ShowContinueError("..required field " + cAlphaFieldNames(4)); } else { ShowSevereError(RoutineName + cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\", invalid field."); ShowContinueError("..invalid " + cAlphaFieldNames(4) + "=\"" + cAlphaArgs(4) + "\"."); } ErrorsFound = true; } DualSchSetPtMgr(SetPtMgrNum).CtrlNodeListName = cAlphaArgs(5); NodeListError = false; GetNodeNums(DualSchSetPtMgr(SetPtMgrNum).CtrlNodeListName, NumNodes, NodeNums, NodeListError, NodeType_Unknown, cCurrentModuleObject, cAlphaArgs(1), NodeConnectionType_SetPoint, 1, ObjectIsNotParent, _, cAlphaFieldNames(5)); if (!NodeListError) { NumNodesCtrld = NumNodes; DualSchSetPtMgr(SetPtMgrNum).CtrlNodes.allocate(NumNodesCtrld); DualSchSetPtMgr(SetPtMgrNum).NumCtrlNodes = NumNodesCtrld; DualSchSetPtMgr(SetPtMgrNum).SetPtHi = 0.0; DualSchSetPtMgr(SetPtMgrNum).SetPtLo = 0.0; for (CtrldNodeNum = 1; CtrldNodeNum <= NumNodesCtrld; ++CtrldNodeNum) { DualSchSetPtMgr(SetPtMgrNum).CtrlNodes(CtrldNodeNum) = NodeNums(CtrldNodeNum); } } else { // check getnodenums/nodelist // CALL ShowSevereError(RoutineName//TRIM(cCurrentModuleObject)//'="'//TRIM(cAlphaArgs(1))// & // '", invalid field.') // Call ShowContinueError('..invalid '//TRIM(cAlphaFieldNames(5))//'="'//TRIM(cAlphaArgs(5))//'".') ErrorsFound = true; } AllSetPtMgrNum = SetPtMgrNum + NumSchSetPtMgrs; if (!NodeListError) { AllSetPtMgr(AllSetPtMgrNum).CtrlNodes.allocate(NumNodesCtrld); AllSetPtMgr(AllSetPtMgrNum).CtrlNodes = DualSchSetPtMgr(SetPtMgrNum).CtrlNodes; } AllSetPtMgr(AllSetPtMgrNum).Name = DualSchSetPtMgr(SetPtMgrNum).Name; AllSetPtMgr(AllSetPtMgrNum).SPMType = iSPMType_ScheduledDual; AllSetPtMgr(AllSetPtMgrNum).CtrlTypeMode = DualSchSetPtMgr(SetPtMgrNum).CtrlTypeMode; AllSetPtMgr(AllSetPtMgrNum).NumCtrlNodes = DualSchSetPtMgr(SetPtMgrNum).NumCtrlNodes; } // Input the Outside Air Setpoint Managers if (NumOutAirSetPtMgrs > 0) OutAirSetPtMgr.allocate(NumOutAirSetPtMgrs); // Allocate the Setpoint Manager input data array // Input the data for each Setpoint Manager cCurrentModuleObject = "SetpointManager:OutdoorAirReset"; for (SetPtMgrNum = 1; SetPtMgrNum <= NumOutAirSetPtMgrs; ++SetPtMgrNum) { inputProcessor->getObjectItem(cCurrentModuleObject, SetPtMgrNum, cAlphaArgs, NumAlphas, rNumericArgs, NumNums, IOStat, lNumericFieldBlanks, lAlphaFieldBlanks, cAlphaFieldNames, cNumericFieldNames); UtilityRoutines::IsNameEmpty(cAlphaArgs(1), cCurrentModuleObject, ErrorsFound); OutAirSetPtMgr(SetPtMgrNum).Name = cAlphaArgs(1); OutAirSetPtMgr(SetPtMgrNum).CtrlVarType = cAlphaArgs(2); if (UtilityRoutines::SameString(OutAirSetPtMgr(SetPtMgrNum).CtrlVarType, "Temperature")) { OutAirSetPtMgr(SetPtMgrNum).CtrlTypeMode = iCtrlVarType_Temp; } else if (UtilityRoutines::SameString(OutAirSetPtMgr(SetPtMgrNum).CtrlVarType, "MaximumTemperature")) { OutAirSetPtMgr(SetPtMgrNum).CtrlTypeMode = iCtrlVarType_MaxTemp; } else if (UtilityRoutines::SameString(OutAirSetPtMgr(SetPtMgrNum).CtrlVarType, "MinimumTemperature")) { OutAirSetPtMgr(SetPtMgrNum).CtrlTypeMode = iCtrlVarType_MinTemp; } else { // should not come here if idd type choice and key list is working ShowSevereError(RoutineName + cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\", invalid field."); ShowContinueError("..invalid " + cAlphaFieldNames(2) + "=\"" + cAlphaArgs(2) + "\"."); ShowContinueError("..Valid value is \"Temperature\"."); ErrorsFound = true; } OutAirSetPtMgr(SetPtMgrNum).OutLowSetPt1 = rNumericArgs(1); OutAirSetPtMgr(SetPtMgrNum).OutLow1 = rNumericArgs(2); OutAirSetPtMgr(SetPtMgrNum).OutHighSetPt1 = rNumericArgs(3); OutAirSetPtMgr(SetPtMgrNum).OutHigh1 = rNumericArgs(4); OutAirSetPtMgr(SetPtMgrNum).CtrlNodeListName = cAlphaArgs(3); if (OutAirSetPtMgr(SetPtMgrNum).OutHigh1 < OutAirSetPtMgr(SetPtMgrNum).OutLow1) { ShowWarningError(RoutineName + cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\", invalid setpoints."); ShowContinueError("..." + cNumericFieldNames(4) + "=[" + RoundSigDigits(OutAirSetPtMgr(SetPtMgrNum).OutHigh1, 1) + "] is less than " + cNumericFieldNames(2) + "=[" + RoundSigDigits(OutAirSetPtMgr(SetPtMgrNum).OutLow1, 1) + "]."); } // Get optional input: schedule and 2nd reset rule if (NumAlphas == 4 && NumNums == 8) { OutAirSetPtMgr(SetPtMgrNum).Sched = cAlphaArgs(4); OutAirSetPtMgr(SetPtMgrNum).SchedPtr = GetScheduleIndex(cAlphaArgs(4)); // Schedule is optional here, so no check on SchedPtr OutAirSetPtMgr(SetPtMgrNum).OutLowSetPt2 = rNumericArgs(5); OutAirSetPtMgr(SetPtMgrNum).OutLow2 = rNumericArgs(6); OutAirSetPtMgr(SetPtMgrNum).OutHighSetPt2 = rNumericArgs(7); OutAirSetPtMgr(SetPtMgrNum).OutHigh2 = rNumericArgs(8); if (OutAirSetPtMgr(SetPtMgrNum).OutHigh2 < OutAirSetPtMgr(SetPtMgrNum).OutLow2) { ShowWarningError(RoutineName + cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\", invalid setpoints."); ShowContinueError("..." + cNumericFieldNames(8) + "=[" + RoundSigDigits(OutAirSetPtMgr(SetPtMgrNum).OutHigh2, 1) + "] is less than " + cNumericFieldNames(6) + "=[" + RoundSigDigits(OutAirSetPtMgr(SetPtMgrNum).OutLow2, 1) + "]."); } } else { OutAirSetPtMgr(SetPtMgrNum).Sched = ""; OutAirSetPtMgr(SetPtMgrNum).SchedPtr = 0; OutAirSetPtMgr(SetPtMgrNum).OutLowSetPt2 = 0.0; OutAirSetPtMgr(SetPtMgrNum).OutLow2 = 0.0; OutAirSetPtMgr(SetPtMgrNum).OutHighSetPt2 = 0.0; OutAirSetPtMgr(SetPtMgrNum).OutHigh2 = 0.0; } NodeListError = false; GetNodeNums(OutAirSetPtMgr(SetPtMgrNum).CtrlNodeListName, NumNodes, NodeNums, NodeListError, NodeType_Unknown, cCurrentModuleObject, cAlphaArgs(1), NodeConnectionType_SetPoint, 1, ObjectIsNotParent, _, cAlphaFieldNames(3)); if (!NodeListError) { NumNodesCtrld = NumNodes; OutAirSetPtMgr(SetPtMgrNum).CtrlNodes.allocate(NumNodesCtrld); OutAirSetPtMgr(SetPtMgrNum).NumCtrlNodes = NumNodesCtrld; OutAirSetPtMgr(SetPtMgrNum).SetPt = 0.0; for (CtrldNodeNum = 1; CtrldNodeNum <= NumNodesCtrld; ++CtrldNodeNum) { OutAirSetPtMgr(SetPtMgrNum).CtrlNodes(CtrldNodeNum) = NodeNums(CtrldNodeNum); } } else { // CALL ShowSevereError(RoutineName//TRIM(cCurrentModuleObject)//'="'//TRIM(cAlphaArgs(1))// & // '", invalid field.') // Call ShowContinueError('..invalid '//TRIM(cAlphaFieldNames(3))//'="'//TRIM(cAlphaArgs(3))//'".') ErrorsFound = true; } AllSetPtMgrNum = SetPtMgrNum + NumSchSetPtMgrs + NumDualSchSetPtMgrs; if (!NodeListError) { AllSetPtMgr(AllSetPtMgrNum).CtrlNodes.allocate(NumNodesCtrld); AllSetPtMgr(AllSetPtMgrNum).CtrlNodes = OutAirSetPtMgr(SetPtMgrNum).CtrlNodes; } AllSetPtMgr(AllSetPtMgrNum).Name = OutAirSetPtMgr(SetPtMgrNum).Name; AllSetPtMgr(AllSetPtMgrNum).SPMType = iSPMType_OutsideAir; AllSetPtMgr(AllSetPtMgrNum).CtrlTypeMode = OutAirSetPtMgr(SetPtMgrNum).CtrlTypeMode; AllSetPtMgr(AllSetPtMgrNum).NumCtrlNodes = OutAirSetPtMgr(SetPtMgrNum).NumCtrlNodes; } // Input the Single Zone Reheat Setpoint Managers if (NumSZRhSetPtMgrs > 0) SingZoneRhSetPtMgr.allocate(NumSZRhSetPtMgrs); // Allocate the Setpoint Manager input data array // Input the data for each Setpoint Manager cCurrentModuleObject = "SetpointManager:SingleZone:Reheat"; for (SetPtMgrNum = 1; SetPtMgrNum <= NumSZRhSetPtMgrs; ++SetPtMgrNum) { inputProcessor->getObjectItem(cCurrentModuleObject, SetPtMgrNum, cAlphaArgs, NumAlphas, rNumericArgs, NumNums, IOStat, lNumericFieldBlanks, lAlphaFieldBlanks, cAlphaFieldNames, cNumericFieldNames); UtilityRoutines::IsNameEmpty(cAlphaArgs(1), cCurrentModuleObject, ErrorsFound); SingZoneRhSetPtMgr(SetPtMgrNum).Name = cAlphaArgs(1); SingZoneRhSetPtMgr(SetPtMgrNum).CtrlVarType = cAlphaArgs(2); if (UtilityRoutines::SameString(SingZoneRhSetPtMgr(SetPtMgrNum).CtrlVarType, "Temperature")) { SingZoneRhSetPtMgr(SetPtMgrNum).CtrlTypeMode = iCtrlVarType_Temp; } else { // should not come here if idd type choice and key list is working ShowSevereError(RoutineName + cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\", invalid field."); ShowContinueError("..invalid " + cAlphaFieldNames(2) + "=\"" + cAlphaArgs(2) + "\"."); ShowContinueError("..Valid value is \"Temperature\"."); ErrorsFound = true; } SingZoneRhSetPtMgr(SetPtMgrNum).ControlZoneName = cAlphaArgs(3); SingZoneRhSetPtMgr(SetPtMgrNum).MinSetTemp = rNumericArgs(1); SingZoneRhSetPtMgr(SetPtMgrNum).MaxSetTemp = rNumericArgs(2); if (SingZoneRhSetPtMgr(SetPtMgrNum).MaxSetTemp < SingZoneRhSetPtMgr(SetPtMgrNum).MinSetTemp) { ShowWarningError(RoutineName + cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\","); ShowContinueError("..." + cNumericFieldNames(2) + "=[" + RoundSigDigits(SingZoneRhSetPtMgr(SetPtMgrNum).MaxSetTemp, 1) + "] is less than " + cNumericFieldNames(1) + "=[" + RoundSigDigits(SingZoneRhSetPtMgr(SetPtMgrNum).MinSetTemp, 1) + "]."); } SingZoneRhSetPtMgr(SetPtMgrNum).ZoneNodeNum = GetOnlySingleNode( cAlphaArgs(4), ErrorsFound, cCurrentModuleObject, cAlphaArgs(1), NodeType_Air, NodeConnectionType_Sensor, 1, ObjectIsNotParent); SingZoneRhSetPtMgr(SetPtMgrNum).ZoneInletNodeNum = GetOnlySingleNode( cAlphaArgs(5), ErrorsFound, cCurrentModuleObject, cAlphaArgs(1), NodeType_Air, NodeConnectionType_Sensor, 1, ObjectIsNotParent); NodeListError = false; GetNodeNums(cAlphaArgs(6), NumNodes, NodeNums, NodeListError, NodeType_Unknown, cCurrentModuleObject, cAlphaArgs(1), NodeConnectionType_SetPoint, 1, ObjectIsNotParent, _, cAlphaFieldNames(6)); // setpoint nodes if (!NodeListError) { NumNodesCtrld = NumNodes; SingZoneRhSetPtMgr(SetPtMgrNum).CtrlNodes.allocate(NumNodesCtrld); SingZoneRhSetPtMgr(SetPtMgrNum).NumCtrlNodes = NumNodesCtrld; SingZoneRhSetPtMgr(SetPtMgrNum).SetPt = 0.0; for (CtrldNodeNum = 1; CtrldNodeNum <= NumNodesCtrld; ++CtrldNodeNum) { SingZoneRhSetPtMgr(SetPtMgrNum).CtrlNodes(CtrldNodeNum) = NodeNums(CtrldNodeNum); } } else { // CALL ShowSevereError(RoutineName//TRIM(cCurrentModuleObject)//'="'//TRIM(cAlphaArgs(1))// & // '", invalid field.') // Call ShowContinueError('..invalid '//TRIM(cAlphaFieldNames(6))//'="'//TRIM(cAlphaArgs(6))//'".') ErrorsFound = true; } // get the actual zone number of the control zone SingZoneRhSetPtMgr(SetPtMgrNum).ControlZoneNum = UtilityRoutines::FindItemInList(cAlphaArgs(3), Zone); if (SingZoneRhSetPtMgr(SetPtMgrNum).ControlZoneNum == 0) { ShowSevereError(RoutineName + cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\", invalid field."); ShowContinueError("..invalid " + cAlphaFieldNames(3) + "=\"" + cAlphaArgs(3) + "\"."); ErrorsFound = true; } SingZoneRhSetPtMgr(SetPtMgrNum).SetPt = 0.0; AllSetPtMgrNum = SetPtMgrNum + NumSchSetPtMgrs + NumDualSchSetPtMgrs + NumOutAirSetPtMgrs; if (!NodeListError) { AllSetPtMgr(AllSetPtMgrNum).CtrlNodes.allocate(NumNodesCtrld); AllSetPtMgr(AllSetPtMgrNum).CtrlNodes = SingZoneRhSetPtMgr(SetPtMgrNum).CtrlNodes; } AllSetPtMgr(AllSetPtMgrNum).Name = SingZoneRhSetPtMgr(SetPtMgrNum).Name; AllSetPtMgr(AllSetPtMgrNum).SPMType = iSPMType_SZReheat; AllSetPtMgr(AllSetPtMgrNum).CtrlTypeMode = SingZoneRhSetPtMgr(SetPtMgrNum).CtrlTypeMode; AllSetPtMgr(AllSetPtMgrNum).NumCtrlNodes = SingZoneRhSetPtMgr(SetPtMgrNum).NumCtrlNodes; } // Input the Single Zone Heating Setpoint Managers if (NumSZHtSetPtMgrs > 0) SingZoneHtSetPtMgr.allocate(NumSZHtSetPtMgrs); // Allocate the Setpoint Manager input data array // Input the data for each Setpoint Manager cCurrentModuleObject = "SetpointManager:SingleZone:Heating"; for (SetPtMgrNum = 1; SetPtMgrNum <= NumSZHtSetPtMgrs; ++SetPtMgrNum) { inputProcessor->getObjectItem(cCurrentModuleObject, SetPtMgrNum, cAlphaArgs, NumAlphas, rNumericArgs, NumNums, IOStat, lNumericFieldBlanks, lAlphaFieldBlanks, cAlphaFieldNames, cNumericFieldNames); UtilityRoutines::IsNameEmpty(cAlphaArgs(1), cCurrentModuleObject, ErrorsFound); SingZoneHtSetPtMgr(SetPtMgrNum).Name = cAlphaArgs(1); SingZoneHtSetPtMgr(SetPtMgrNum).CtrlVarType = cAlphaArgs(2); if (UtilityRoutines::SameString(SingZoneHtSetPtMgr(SetPtMgrNum).CtrlVarType, "Temperature")) { SingZoneHtSetPtMgr(SetPtMgrNum).CtrlTypeMode = iCtrlVarType_Temp; } else { // should not come here if idd type choice and key list is working ShowSevereError(RoutineName + cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\", invalid field."); ShowContinueError("..invalid " + cAlphaFieldNames(2) + "=\"" + cAlphaArgs(2) + "\"."); ShowContinueError("..Valid value is \"Temperature\"."); ErrorsFound = true; } SingZoneHtSetPtMgr(SetPtMgrNum).ControlZoneName = cAlphaArgs(3); SingZoneHtSetPtMgr(SetPtMgrNum).MinSetTemp = rNumericArgs(1); SingZoneHtSetPtMgr(SetPtMgrNum).MaxSetTemp = rNumericArgs(2); if (SingZoneHtSetPtMgr(SetPtMgrNum).MaxSetTemp < SingZoneHtSetPtMgr(SetPtMgrNum).MinSetTemp) { ShowWarningError(RoutineName + cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\","); ShowContinueError("..." + cNumericFieldNames(2) + "=[" + RoundSigDigits(SingZoneHtSetPtMgr(SetPtMgrNum).MaxSetTemp, 1) + "] is less than " + cNumericFieldNames(1) + "=[" + RoundSigDigits(SingZoneHtSetPtMgr(SetPtMgrNum).MinSetTemp, 1) + "]."); } SingZoneHtSetPtMgr(SetPtMgrNum).ZoneNodeNum = GetOnlySingleNode( cAlphaArgs(4), ErrorsFound, cCurrentModuleObject, cAlphaArgs(1), NodeType_Air, NodeConnectionType_Sensor, 1, ObjectIsNotParent); SingZoneHtSetPtMgr(SetPtMgrNum).ZoneInletNodeNum = GetOnlySingleNode( cAlphaArgs(5), ErrorsFound, cCurrentModuleObject, cAlphaArgs(1), NodeType_Air, NodeConnectionType_Sensor, 1, ObjectIsNotParent); NodeListError = false; GetNodeNums(cAlphaArgs(6), NumNodes, NodeNums, NodeListError, NodeType_Unknown, cCurrentModuleObject, cAlphaArgs(1), NodeConnectionType_SetPoint, 1, ObjectIsNotParent, _, cAlphaFieldNames(6)); // setpoint nodes if (!NodeListError) { NumNodesCtrld = NumNodes; SingZoneHtSetPtMgr(SetPtMgrNum).CtrlNodes.allocate(NumNodesCtrld); SingZoneHtSetPtMgr(SetPtMgrNum).NumCtrlNodes = NumNodesCtrld; SingZoneHtSetPtMgr(SetPtMgrNum).SetPt = 0.0; for (CtrldNodeNum = 1; CtrldNodeNum <= NumNodesCtrld; ++CtrldNodeNum) { SingZoneHtSetPtMgr(SetPtMgrNum).CtrlNodes(CtrldNodeNum) = NodeNums(CtrldNodeNum); } } else { // CALL ShowSevereError(RoutineName//TRIM(cCurrentModuleObject)//'="'//TRIM(cAlphaArgs(1))// & // '", invalid field.') // Call ShowContinueError('..invalid '//TRIM(cAlphaFieldNames(4))//'="'//TRIM(cAlphaArgs(4))//'".') ErrorsFound = true; } // get the actual zone number of the control zone SingZoneHtSetPtMgr(SetPtMgrNum).ControlZoneNum = UtilityRoutines::FindItemInList(cAlphaArgs(3), Zone); if (SingZoneHtSetPtMgr(SetPtMgrNum).ControlZoneNum == 0) { ShowSevereError(RoutineName + cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\", invalid field."); ShowContinueError("..invalid " + cAlphaFieldNames(3) + "=\"" + cAlphaArgs(3) + "\"."); ErrorsFound = true; } SingZoneHtSetPtMgr(SetPtMgrNum).SetPt = 0.0; AllSetPtMgrNum = SetPtMgrNum + NumSchSetPtMgrs + NumDualSchSetPtMgrs + NumOutAirSetPtMgrs + NumSZRhSetPtMgrs; if (!NodeListError) { AllSetPtMgr(AllSetPtMgrNum).CtrlNodes.allocate(NumNodesCtrld); AllSetPtMgr(AllSetPtMgrNum).CtrlNodes = SingZoneHtSetPtMgr(SetPtMgrNum).CtrlNodes; } AllSetPtMgr(AllSetPtMgrNum).Name = SingZoneHtSetPtMgr(SetPtMgrNum).Name; AllSetPtMgr(AllSetPtMgrNum).SPMType = iSPMType_SZHeating; AllSetPtMgr(AllSetPtMgrNum).CtrlTypeMode = SingZoneHtSetPtMgr(SetPtMgrNum).CtrlTypeMode; AllSetPtMgr(AllSetPtMgrNum).NumCtrlNodes = SingZoneHtSetPtMgr(SetPtMgrNum).NumCtrlNodes; } // Input the Single Zone Cooling Setpoint Managers if (NumSZClSetPtMgrs > 0) SingZoneClSetPtMgr.allocate(NumSZClSetPtMgrs); // Allocate the Setpoint Manager input data array // Input the data for each Setpoint Manager cCurrentModuleObject = "SetpointManager:SingleZone:Cooling"; for (SetPtMgrNum = 1; SetPtMgrNum <= NumSZClSetPtMgrs; ++SetPtMgrNum) { inputProcessor->getObjectItem(cCurrentModuleObject, SetPtMgrNum, cAlphaArgs, NumAlphas, rNumericArgs, NumNums, IOStat, lNumericFieldBlanks, lAlphaFieldBlanks, cAlphaFieldNames, cNumericFieldNames); UtilityRoutines::IsNameEmpty(cAlphaArgs(1), cCurrentModuleObject, ErrorsFound); SingZoneClSetPtMgr(SetPtMgrNum).Name = cAlphaArgs(1); SingZoneClSetPtMgr(SetPtMgrNum).CtrlVarType = cAlphaArgs(2); if (UtilityRoutines::SameString(SingZoneClSetPtMgr(SetPtMgrNum).CtrlVarType, "Temperature")) { SingZoneClSetPtMgr(SetPtMgrNum).CtrlTypeMode = iCtrlVarType_Temp; } else { // should not come here if idd type choice and key list is working ShowSevereError(RoutineName + cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\", invalid field."); ShowContinueError("..invalid " + cAlphaFieldNames(2) + "=\"" + cAlphaArgs(2) + "\"."); ShowContinueError("..Valid value is \"Temperature\"."); ErrorsFound = true; } SingZoneClSetPtMgr(SetPtMgrNum).ControlZoneName = cAlphaArgs(3); SingZoneClSetPtMgr(SetPtMgrNum).MinSetTemp = rNumericArgs(1); SingZoneClSetPtMgr(SetPtMgrNum).MaxSetTemp = rNumericArgs(2); if (SingZoneClSetPtMgr(SetPtMgrNum).MaxSetTemp < SingZoneClSetPtMgr(SetPtMgrNum).MinSetTemp) { ShowWarningError(RoutineName + cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\","); ShowContinueError("..." + cNumericFieldNames(2) + "=[" + RoundSigDigits(SingZoneClSetPtMgr(SetPtMgrNum).MaxSetTemp, 1) + "] is less than " + cNumericFieldNames(1) + "=[" + RoundSigDigits(SingZoneClSetPtMgr(SetPtMgrNum).MinSetTemp, 1) + "]."); } SingZoneClSetPtMgr(SetPtMgrNum).ZoneNodeNum = GetOnlySingleNode( cAlphaArgs(4), ErrorsFound, cCurrentModuleObject, cAlphaArgs(1), NodeType_Air, NodeConnectionType_Sensor, 1, ObjectIsNotParent); SingZoneClSetPtMgr(SetPtMgrNum).ZoneInletNodeNum = GetOnlySingleNode( cAlphaArgs(5), ErrorsFound, cCurrentModuleObject, cAlphaArgs(1), NodeType_Air, NodeConnectionType_Sensor, 1, ObjectIsNotParent); NodeListError = false; GetNodeNums(cAlphaArgs(6), NumNodes, NodeNums, NodeListError, NodeType_Unknown, cCurrentModuleObject, cAlphaArgs(1), NodeConnectionType_SetPoint, 1, ObjectIsNotParent, _, cAlphaFieldNames(6)); // setpoint nodes if (!NodeListError) { NumNodesCtrld = NumNodes; SingZoneClSetPtMgr(SetPtMgrNum).CtrlNodes.allocate(NumNodesCtrld); SingZoneClSetPtMgr(SetPtMgrNum).NumCtrlNodes = NumNodesCtrld; SingZoneClSetPtMgr(SetPtMgrNum).SetPt = 0.0; for (CtrldNodeNum = 1; CtrldNodeNum <= NumNodesCtrld; ++CtrldNodeNum) { SingZoneClSetPtMgr(SetPtMgrNum).CtrlNodes(CtrldNodeNum) = NodeNums(CtrldNodeNum); } } else { // CALL ShowSevereError(RoutineName//TRIM(cCurrentModuleObject)//'="'//TRIM(cAlphaArgs(1))// & // '", invalid field.') // Call ShowContinueError('..invalid '//TRIM(cAlphaFieldNames(6))//'="'//TRIM(cAlphaArgs(6))//'".') ErrorsFound = true; } // get the actual zone number of the control zone SingZoneClSetPtMgr(SetPtMgrNum).ControlZoneNum = UtilityRoutines::FindItemInList(cAlphaArgs(3), Zone); if (SingZoneClSetPtMgr(SetPtMgrNum).ControlZoneNum == 0) { ShowSevereError(RoutineName + cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\", invalid field."); ShowContinueError("..invalid " + cAlphaFieldNames(3) + "=\"" + cAlphaArgs(3) + "\"."); ErrorsFound = true; } SingZoneClSetPtMgr(SetPtMgrNum).SetPt = 0.0; AllSetPtMgrNum = SetPtMgrNum + NumSchSetPtMgrs + NumDualSchSetPtMgrs + NumOutAirSetPtMgrs + NumSZRhSetPtMgrs + NumSZHtSetPtMgrs; if (!NodeListError) { AllSetPtMgr(AllSetPtMgrNum).CtrlNodes.allocate(NumNodesCtrld); AllSetPtMgr(AllSetPtMgrNum).CtrlNodes = SingZoneClSetPtMgr(SetPtMgrNum).CtrlNodes; } AllSetPtMgr(AllSetPtMgrNum).Name = SingZoneClSetPtMgr(SetPtMgrNum).Name; AllSetPtMgr(AllSetPtMgrNum).SPMType = iSPMType_SZCooling; AllSetPtMgr(AllSetPtMgrNum).CtrlTypeMode = SingZoneClSetPtMgr(SetPtMgrNum).CtrlTypeMode; AllSetPtMgr(AllSetPtMgrNum).NumCtrlNodes = SingZoneClSetPtMgr(SetPtMgrNum).NumCtrlNodes; } // Input the Single Zone Minimum Humidity Setpoint Managers if (NumSZMinHumSetPtMgrs > 0) SZMinHumSetPtMgr.allocate(NumSZMinHumSetPtMgrs); // Input the data for each Setpoint Manager cCurrentModuleObject = "SetpointManager:SingleZone:Humidity:Minimum"; for (SetPtMgrNum = 1; SetPtMgrNum <= NumSZMinHumSetPtMgrs; ++SetPtMgrNum) { inputProcessor->getObjectItem(cCurrentModuleObject, SetPtMgrNum, cAlphaArgs, NumAlphas, rNumericArgs, NumNums, IOStat, lNumericFieldBlanks, lAlphaFieldBlanks, cAlphaFieldNames, cNumericFieldNames); UtilityRoutines::IsNameEmpty(cAlphaArgs(1), cCurrentModuleObject, ErrorsFound); SZMinHumSetPtMgr(SetPtMgrNum).Name = cAlphaArgs(1); SZMinHumSetPtMgr(SetPtMgrNum).CtrlVarType = "MinimumHumidityRatio"; SZMinHumSetPtMgr(SetPtMgrNum).CtrlTypeMode = iCtrlVarType_MinHumRat; NodeListError = false; GetNodeNums(cAlphaArgs(2), NumNodes, NodeNums, NodeListError, NodeType_Air, cCurrentModuleObject, cAlphaArgs(1), NodeConnectionType_SetPoint, 1, ObjectIsNotParent, _, cAlphaFieldNames(4)); // nodes whose min humidity ratio will be set if (!NodeListError) { NumNodesCtrld = NumNodes; SZMinHumSetPtMgr(SetPtMgrNum).CtrlNodes.allocate(NumNodesCtrld); SZMinHumSetPtMgr(SetPtMgrNum).NumCtrlNodes = NumNodesCtrld; SZMinHumSetPtMgr(SetPtMgrNum).SetPt = 0.0; for (CtrldNodeNum = 1; CtrldNodeNum <= NumNodesCtrld; ++CtrldNodeNum) { SZMinHumSetPtMgr(SetPtMgrNum).CtrlNodes(CtrldNodeNum) = NodeNums(CtrldNodeNum); } } else { // CALL ShowSevereError(RoutineName//TRIM(cCurrentModuleObject)//'="'//TRIM(cAlphaArgs(1))// & // '", invalid field.') // Call ShowContinueError('..invalid '//TRIM(cAlphaFieldNames(4))//'="'//TRIM(cAlphaArgs(4))//'".') ErrorsFound = true; } ErrInList = false; GetNodeNums(cAlphaArgs(3), NumNodes, NodeNums, ErrInList, NodeType_Air, cCurrentModuleObject, cAlphaArgs(1), NodeConnectionType_Sensor, 1, ObjectIsNotParent, _, cAlphaFieldNames(3)); // nodes of zones whose humidity is being controlled if (ErrInList) { // CALL ShowSevereError(RoutineName//TRIM(cCurrentModuleObject)//'="'//TRIM(cAlphaArgs(1))// & // '", invalid field.') // Call ShowContinueError('..invalid '//TRIM(cAlphaFieldNames(5))//'="'//TRIM(cAlphaArgs(5))//'".') ErrorsFound = true; } NumZones = NumNodes; SZMinHumSetPtMgr(SetPtMgrNum).NumZones = NumZones; // only allow one control zone for now if (NumNodes > 1) { ShowSevereError(RoutineName + cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\", entered nodelist."); ShowContinueError("..invalid " + cAlphaFieldNames(3) + "=\"" + cAlphaArgs(3) + "\"."); ShowContinueError("..only one control zone is allowed."); ErrorsFound = true; } SZMinHumSetPtMgr(SetPtMgrNum).ZoneNodes.allocate(NumZones); SZMinHumSetPtMgr(SetPtMgrNum).ZoneNum.allocate(NumZones); SZMinHumSetPtMgr(SetPtMgrNum).CtrlZoneNum.allocate(NumZones); for (ZoneNum = 1; ZoneNum <= NumZones; ++ZoneNum) { SZMinHumSetPtMgr(SetPtMgrNum).ZoneNodes(ZoneNum) = NodeNums(ZoneNum); SZMinHumSetPtMgr(SetPtMgrNum).ZoneNum(ZoneNum) = 0; SZMinHumSetPtMgr(SetPtMgrNum).CtrlZoneNum(ZoneNum) = 0; } AllSetPtMgrNum = SetPtMgrNum + NumSchSetPtMgrs + NumDualSchSetPtMgrs + NumOutAirSetPtMgrs + NumSZRhSetPtMgrs + NumSZHtSetPtMgrs + NumSZClSetPtMgrs; if (!NodeListError) { AllSetPtMgr(AllSetPtMgrNum).CtrlNodes.allocate(NumNodesCtrld); AllSetPtMgr(AllSetPtMgrNum).CtrlNodes = SZMinHumSetPtMgr(SetPtMgrNum).CtrlNodes; } AllSetPtMgr(AllSetPtMgrNum).Name = SZMinHumSetPtMgr(SetPtMgrNum).Name; AllSetPtMgr(AllSetPtMgrNum).SPMType = iSPMType_SZMinHum; AllSetPtMgr(AllSetPtMgrNum).CtrlTypeMode = SZMinHumSetPtMgr(SetPtMgrNum).CtrlTypeMode; AllSetPtMgr(AllSetPtMgrNum).NumCtrlNodes = SZMinHumSetPtMgr(SetPtMgrNum).NumCtrlNodes; } // Input the Single Zone Maximum Humidity Setpoint Managers if (NumSZMaxHumSetPtMgrs > 0) SZMaxHumSetPtMgr.allocate(NumSZMaxHumSetPtMgrs); // Input the data for each Setpoint Manager cCurrentModuleObject = "SetpointManager:SingleZone:Humidity:Maximum"; for (SetPtMgrNum = 1; SetPtMgrNum <= NumSZMaxHumSetPtMgrs; ++SetPtMgrNum) { inputProcessor->getObjectItem(cCurrentModuleObject, SetPtMgrNum, cAlphaArgs, NumAlphas, rNumericArgs, NumNums, IOStat, lNumericFieldBlanks, lAlphaFieldBlanks, cAlphaFieldNames, cNumericFieldNames); UtilityRoutines::IsNameEmpty(cAlphaArgs(1), cCurrentModuleObject, ErrorsFound); SZMaxHumSetPtMgr(SetPtMgrNum).Name = cAlphaArgs(1); SZMaxHumSetPtMgr(SetPtMgrNum).CtrlVarType = "MaximumHumidityRatio"; SZMaxHumSetPtMgr(SetPtMgrNum).CtrlTypeMode = iCtrlVarType_MaxHumRat; NodeListError = false; GetNodeNums(cAlphaArgs(2), NumNodes, NodeNums, NodeListError, NodeType_Air, cCurrentModuleObject, cAlphaArgs(1), NodeConnectionType_SetPoint, 1, ObjectIsNotParent, _, cAlphaFieldNames(2)); // nodes whose max humidity ratio will be set if (!NodeListError) { NumNodesCtrld = NumNodes; SZMaxHumSetPtMgr(SetPtMgrNum).CtrlNodes.allocate(NumNodesCtrld); SZMaxHumSetPtMgr(SetPtMgrNum).NumCtrlNodes = NumNodesCtrld; SZMaxHumSetPtMgr(SetPtMgrNum).SetPt = 0.0; for (CtrldNodeNum = 1; CtrldNodeNum <= NumNodesCtrld; ++CtrldNodeNum) { SZMaxHumSetPtMgr(SetPtMgrNum).CtrlNodes(CtrldNodeNum) = NodeNums(CtrldNodeNum); } } else { // CALL ShowSevereError(RoutineName//TRIM(cCurrentModuleObject)//'="'//TRIM(cAlphaArgs(1))// & // '", invalid field.') // Call ShowContinueError('..invalid '//TRIM(cAlphaFieldNames(4))//'="'//TRIM(cAlphaArgs(4))//'".') ErrorsFound = true; } ErrInList = false; GetNodeNums(cAlphaArgs(3), NumNodes, NodeNums, ErrInList, NodeType_Air, cCurrentModuleObject, cAlphaArgs(1), NodeConnectionType_Sensor, 1, ObjectIsNotParent, _, cAlphaFieldNames(3)); // nodes of zones whose humidity is being controlled if (ErrInList) { // CALL ShowSevereError(RoutineName//TRIM(cCurrentModuleObject)//'="'//TRIM(cAlphaArgs(1))// & // '", invalid field.') // Call ShowContinueError('..invalid '//TRIM(cAlphaFieldNames(5))//'="'//TRIM(cAlphaArgs(5))//'".') ErrorsFound = true; } NumZones = NumNodes; SZMaxHumSetPtMgr(SetPtMgrNum).NumZones = NumZones; // only allow one control zone for now if (NumNodes > 1) { ShowSevereError(RoutineName + cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\", entered nodelist."); ShowContinueError("..invalid " + cAlphaFieldNames(5) + "=\"" + cAlphaArgs(5) + "\"."); ShowContinueError("..only one control zone is allowed."); ErrorsFound = true; } SZMaxHumSetPtMgr(SetPtMgrNum).ZoneNodes.allocate(NumZones); SZMaxHumSetPtMgr(SetPtMgrNum).ZoneNum.allocate(NumZones); SZMaxHumSetPtMgr(SetPtMgrNum).CtrlZoneNum.allocate(NumZones); for (ZoneNum = 1; ZoneNum <= NumZones; ++ZoneNum) { SZMaxHumSetPtMgr(SetPtMgrNum).ZoneNodes(ZoneNum) = NodeNums(ZoneNum); // Actual zone node and controlled zone numbers set in Init subroutine SZMaxHumSetPtMgr(SetPtMgrNum).ZoneNum(ZoneNum) = 0; SZMaxHumSetPtMgr(SetPtMgrNum).CtrlZoneNum(ZoneNum) = 0; } AllSetPtMgrNum = SetPtMgrNum + NumSchSetPtMgrs + NumDualSchSetPtMgrs + NumOutAirSetPtMgrs + NumSZRhSetPtMgrs + NumSZHtSetPtMgrs + NumSZClSetPtMgrs + NumSZMinHumSetPtMgrs; if (!NodeListError) { AllSetPtMgr(AllSetPtMgrNum).CtrlNodes.allocate(NumNodesCtrld); AllSetPtMgr(AllSetPtMgrNum).CtrlNodes = SZMaxHumSetPtMgr(SetPtMgrNum).CtrlNodes; } AllSetPtMgr(AllSetPtMgrNum).Name = SZMaxHumSetPtMgr(SetPtMgrNum).Name; AllSetPtMgr(AllSetPtMgrNum).SPMType = iSPMType_SZMaxHum; AllSetPtMgr(AllSetPtMgrNum).CtrlTypeMode = SZMaxHumSetPtMgr(SetPtMgrNum).CtrlTypeMode; AllSetPtMgr(AllSetPtMgrNum).NumCtrlNodes = SZMaxHumSetPtMgr(SetPtMgrNum).NumCtrlNodes; } // Input the Mixed Air Setpoint Managers if (NumMixedAirSetPtMgrs > 0) MixedAirSetPtMgr.allocate(NumMixedAirSetPtMgrs); // Input the data for each Setpoint Manager cCurrentModuleObject = "SetpointManager:MixedAir"; for (SetPtMgrNum = 1; SetPtMgrNum <= NumMixedAirSetPtMgrs; ++SetPtMgrNum) { inputProcessor->getObjectItem(cCurrentModuleObject, SetPtMgrNum, cAlphaArgs, NumAlphas, rNumericArgs, NumNums, IOStat, lNumericFieldBlanks, lAlphaFieldBlanks, cAlphaFieldNames, cNumericFieldNames); UtilityRoutines::IsNameEmpty(cAlphaArgs(1), cCurrentModuleObject, ErrorsFound); MixedAirSetPtMgr(SetPtMgrNum).Name = cAlphaArgs(1); MixedAirSetPtMgr(SetPtMgrNum).CtrlVarType = cAlphaArgs(2); if (UtilityRoutines::SameString(MixedAirSetPtMgr(SetPtMgrNum).CtrlVarType, "Temperature")) { MixedAirSetPtMgr(SetPtMgrNum).CtrlTypeMode = iCtrlVarType_Temp; } else { // should not come here if idd type choice and key list is working ShowSevereError(RoutineName + cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\", invalid field."); ShowContinueError("..invalid " + cAlphaFieldNames(2) + "=\"" + cAlphaArgs(2) + "\"."); ShowContinueError("..Valid value is \"Temperature\"."); ErrorsFound = true; } MixedAirSetPtMgr(SetPtMgrNum).RefNode = GetOnlySingleNode( cAlphaArgs(3), ErrorsFound, cCurrentModuleObject, cAlphaArgs(1), NodeType_Air, NodeConnectionType_Sensor, 1, ObjectIsNotParent); MixedAirSetPtMgr(SetPtMgrNum).FanInNode = GetOnlySingleNode( cAlphaArgs(4), ErrorsFound, cCurrentModuleObject, cAlphaArgs(1), NodeType_Air, NodeConnectionType_Sensor, 1, ObjectIsNotParent); MixedAirSetPtMgr(SetPtMgrNum).FanOutNode = GetOnlySingleNode( cAlphaArgs(5), ErrorsFound, cCurrentModuleObject, cAlphaArgs(1), NodeType_Air, NodeConnectionType_Sensor, 1, ObjectIsNotParent); NodeListError = false; GetNodeNums(cAlphaArgs(6), NumNodes, NodeNums, NodeListError, NodeType_Air, cCurrentModuleObject, cAlphaArgs(1), NodeConnectionType_SetPoint, 1, ObjectIsNotParent, _, cAlphaFieldNames(6)); // setpoint nodes if (!NodeListError) { NumNodesCtrld = NumNodes; MixedAirSetPtMgr(SetPtMgrNum).CtrlNodes.allocate(NumNodesCtrld); MixedAirSetPtMgr(SetPtMgrNum).NumCtrlNodes = NumNodesCtrld; MixedAirSetPtMgr(SetPtMgrNum).SetPt = 0.0; for (CtrldNodeNum = 1; CtrldNodeNum <= NumNodesCtrld; ++CtrldNodeNum) { MixedAirSetPtMgr(SetPtMgrNum).CtrlNodes(CtrldNodeNum) = NodeNums(CtrldNodeNum); } } else { // CALL ShowSevereError(RoutineName//TRIM(cCurrentModuleObject)//'="'//TRIM(cAlphaArgs(1))// & // '", invalid field.') // Call ShowContinueError('..invalid '//TRIM(cAlphaFieldNames(6))//'="'//TRIM(cAlphaArgs(6))//'".') ErrorsFound = true; } Found = FindNumberInList( MixedAirSetPtMgr(SetPtMgrNum).RefNode, MixedAirSetPtMgr(SetPtMgrNum).CtrlNodes, MixedAirSetPtMgr(SetPtMgrNum).NumCtrlNodes); if (Found > 0) { ShowSevereError(RoutineName + cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\", reference node."); if (MixedAirSetPtMgr(SetPtMgrNum).NumCtrlNodes > 1) { ShowContinueError("..Reference Node is the same as one of the nodes in SetPoint NodeList"); } else { ShowContinueError("..Reference Node is the same as the SetPoint Node"); } ShowContinueError("Reference Node Name=\"" + NodeID(MixedAirSetPtMgr(SetPtMgrNum).RefNode) + "\"."); ErrorsFound = true; } AllSetPtMgrNum = SetPtMgrNum + NumSchSetPtMgrs + NumDualSchSetPtMgrs + NumOutAirSetPtMgrs + NumSZRhSetPtMgrs + NumSZHtSetPtMgrs + NumSZClSetPtMgrs + NumSZMinHumSetPtMgrs + NumSZMaxHumSetPtMgrs; if (NumAlphas > 7) { MixedAirSetPtMgr(SetPtMgrNum).CoolCoilInNode = GetOnlySingleNode( cAlphaArgs(7), ErrorsFound, cCurrentModuleObject, cAlphaArgs(1), NodeType_Air, NodeConnectionType_Sensor, 1, ObjectIsNotParent); MixedAirSetPtMgr(SetPtMgrNum).CoolCoilOutNode = GetOnlySingleNode( cAlphaArgs(8), ErrorsFound, cCurrentModuleObject, cAlphaArgs(1), NodeType_Air, NodeConnectionType_Sensor, 1, ObjectIsNotParent); if (NumNums == 1) { MixedAirSetPtMgr(SetPtMgrNum).MinCoolCoilOutTemp = rNumericArgs(1); } } if (!NodeListError) { AllSetPtMgr(AllSetPtMgrNum).CtrlNodes.allocate(NumNodesCtrld); AllSetPtMgr(AllSetPtMgrNum).CtrlNodes = MixedAirSetPtMgr(SetPtMgrNum).CtrlNodes; } AllSetPtMgr(AllSetPtMgrNum).Name = MixedAirSetPtMgr(SetPtMgrNum).Name; AllSetPtMgr(AllSetPtMgrNum).SPMType = iSPMType_MixedAir; AllSetPtMgr(AllSetPtMgrNum).CtrlTypeMode = MixedAirSetPtMgr(SetPtMgrNum).CtrlTypeMode; AllSetPtMgr(AllSetPtMgrNum).NumCtrlNodes = MixedAirSetPtMgr(SetPtMgrNum).NumCtrlNodes; } // Input the Outside Air Pretreat Setpoint Managers if (NumOAPretreatSetPtMgrs > 0) OAPretreatSetPtMgr.allocate(NumOAPretreatSetPtMgrs); // Input the data for each Setpoint Manager cCurrentModuleObject = "SetpointManager:OutdoorAirPretreat"; for (SetPtMgrNum = 1; SetPtMgrNum <= NumOAPretreatSetPtMgrs; ++SetPtMgrNum) { inputProcessor->getObjectItem(cCurrentModuleObject, SetPtMgrNum, cAlphaArgs, NumAlphas, rNumericArgs, NumNums, IOStat, lNumericFieldBlanks, lAlphaFieldBlanks, cAlphaFieldNames, cNumericFieldNames); UtilityRoutines::IsNameEmpty(cAlphaArgs(1), cCurrentModuleObject, ErrorsFound); OAPretreatSetPtMgr(SetPtMgrNum).Name = cAlphaArgs(1); OAPretreatSetPtMgr(SetPtMgrNum).CtrlVarType = cAlphaArgs(2); // setup program flow control integers. { auto const SELECT_CASE_var(UtilityRoutines::MakeUPPERCase(OAPretreatSetPtMgr(SetPtMgrNum).CtrlVarType)); if (SELECT_CASE_var == "TEMPERATURE") { OAPretreatSetPtMgr(SetPtMgrNum).CtrlTypeMode = iCtrlVarType_Temp; } else if (SELECT_CASE_var == "HUMIDITYRATIO") { OAPretreatSetPtMgr(SetPtMgrNum).CtrlTypeMode = iCtrlVarType_HumRat; } else if (SELECT_CASE_var == "MAXIMUMHUMIDITYRATIO") { OAPretreatSetPtMgr(SetPtMgrNum).CtrlTypeMode = iCtrlVarType_MaxHumRat; } else if (SELECT_CASE_var == "MINIMUMHUMIDITYRATIO") { OAPretreatSetPtMgr(SetPtMgrNum).CtrlTypeMode = iCtrlVarType_MinHumRat; } else { // should not come here if idd type choice and key list is working ShowSevereError(RoutineName + cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\", invalid field."); ShowContinueError("..invalid " + cAlphaFieldNames(2) + "=\"" + cAlphaArgs(2) + "\"."); ShowContinueError("..Valid values are \"Temperature\",\"HumidityRatio\",\"MaximumHumidityRatio\" or \"MinimumHumidityRatio\"."); ErrorsFound = true; } } OAPretreatSetPtMgr(SetPtMgrNum).MinSetTemp = rNumericArgs(1); OAPretreatSetPtMgr(SetPtMgrNum).MaxSetTemp = rNumericArgs(2); if (OAPretreatSetPtMgr(SetPtMgrNum).MaxSetTemp < OAPretreatSetPtMgr(SetPtMgrNum).MinSetTemp) { ShowWarningError(RoutineName + cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\","); ShowContinueError("..." + cNumericFieldNames(2) + "=[" + RoundSigDigits(OAPretreatSetPtMgr(SetPtMgrNum).MaxSetTemp, 1) + "] is less than " + cNumericFieldNames(1) + "=[" + RoundSigDigits(OAPretreatSetPtMgr(SetPtMgrNum).MinSetTemp, 1) + "]."); } OAPretreatSetPtMgr(SetPtMgrNum).MinSetHumRat = rNumericArgs(3); OAPretreatSetPtMgr(SetPtMgrNum).MaxSetHumRat = rNumericArgs(4); if (OAPretreatSetPtMgr(SetPtMgrNum).MaxSetHumRat < OAPretreatSetPtMgr(SetPtMgrNum).MinSetHumRat) { ShowWarningError(RoutineName + cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\","); ShowContinueError("..." + cNumericFieldNames(4) + "=[" + RoundSigDigits(OAPretreatSetPtMgr(SetPtMgrNum).MaxSetHumRat, 1) + "] is less than " + cNumericFieldNames(3) + "=[" + RoundSigDigits(OAPretreatSetPtMgr(SetPtMgrNum).MinSetHumRat, 1) + "]."); } // Because a zero humidity ratio setpoint is a special value indicating "off" or "no load" // must not allow MinSetHumRat or MaxSetHumRat to be <=0.0 if (OAPretreatSetPtMgr(SetPtMgrNum).MinSetHumRat <= 0.0) { ShowWarningError(RoutineName + cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\", invalid value."); ShowContinueError("Minimum setpoint humidity ratio <=0.0, resetting to 0.00001"); OAPretreatSetPtMgr(SetPtMgrNum).MinSetHumRat = 0.00001; } if (OAPretreatSetPtMgr(SetPtMgrNum).MaxSetHumRat <= 0.0) { ShowWarningError(RoutineName + cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\", invalid value."); ShowContinueError("Maximum setpoint humidity ratio <=0.0, resetting to 0.00001"); OAPretreatSetPtMgr(SetPtMgrNum).MaxSetHumRat = 0.00001; } OAPretreatSetPtMgr(SetPtMgrNum).RefNode = GetOnlySingleNode( cAlphaArgs(3), ErrorsFound, cCurrentModuleObject, cAlphaArgs(1), NodeType_Air, NodeConnectionType_Sensor, 1, ObjectIsNotParent); OAPretreatSetPtMgr(SetPtMgrNum).MixedOutNode = GetOnlySingleNode( cAlphaArgs(4), ErrorsFound, cCurrentModuleObject, cAlphaArgs(1), NodeType_Air, NodeConnectionType_Sensor, 1, ObjectIsNotParent); OAPretreatSetPtMgr(SetPtMgrNum).OAInNode = GetOnlySingleNode( cAlphaArgs(5), ErrorsFound, cCurrentModuleObject, cAlphaArgs(1), NodeType_Air, NodeConnectionType_Sensor, 1, ObjectIsNotParent); OAPretreatSetPtMgr(SetPtMgrNum).ReturnInNode = GetOnlySingleNode( cAlphaArgs(6), ErrorsFound, cCurrentModuleObject, cAlphaArgs(1), NodeType_Air, NodeConnectionType_Sensor, 1, ObjectIsNotParent); NodeListError = false; GetNodeNums(cAlphaArgs(7), NumNodes, NodeNums, NodeListError, NodeType_Air, cCurrentModuleObject, cAlphaArgs(1), NodeConnectionType_SetPoint, 1, ObjectIsNotParent, _, cAlphaFieldNames(7)); // setpoint nodes if (!NodeListError) { NumNodesCtrld = NumNodes; OAPretreatSetPtMgr(SetPtMgrNum).CtrlNodes.allocate(NumNodesCtrld); OAPretreatSetPtMgr(SetPtMgrNum).NumCtrlNodes = NumNodesCtrld; OAPretreatSetPtMgr(SetPtMgrNum).SetPt = 0.0; for (CtrldNodeNum = 1; CtrldNodeNum <= NumNodesCtrld; ++CtrldNodeNum) { OAPretreatSetPtMgr(SetPtMgrNum).CtrlNodes(CtrldNodeNum) = NodeNums(CtrldNodeNum); } } else { // CALL ShowSevereError(RoutineName//TRIM(cCurrentModuleObject)//'="'//TRIM(cAlphaArgs(1))// & // '", invalid field.') // Call ShowContinueError('..invalid '//TRIM(cAlphaFieldNames(7))//'="'//TRIM(cAlphaArgs(7))//'".') ErrorsFound = true; } Found = FindNumberInList( OAPretreatSetPtMgr(SetPtMgrNum).RefNode, OAPretreatSetPtMgr(SetPtMgrNum).CtrlNodes, OAPretreatSetPtMgr(SetPtMgrNum).NumCtrlNodes); if (Found > 0) { ShowSevereError(RoutineName + cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\", reference node."); if (OAPretreatSetPtMgr(SetPtMgrNum).NumCtrlNodes > 1) { ShowContinueError("..Reference Node is the same as one of the nodes in SetPoint NodeList"); } else { ShowContinueError("..Reference Node is the same as the SetPoint Node"); } ShowContinueError("Reference Node Name=\"" + NodeID(OAPretreatSetPtMgr(SetPtMgrNum).RefNode) + "\"."); ErrorsFound = true; } AllSetPtMgrNum = SetPtMgrNum + NumSchSetPtMgrs + NumDualSchSetPtMgrs + NumOutAirSetPtMgrs + NumSZRhSetPtMgrs + NumSZHtSetPtMgrs + NumSZClSetPtMgrs + NumSZMinHumSetPtMgrs + NumSZMaxHumSetPtMgrs + NumMixedAirSetPtMgrs; if (!NodeListError) { AllSetPtMgr(AllSetPtMgrNum).CtrlNodes.allocate(NumNodesCtrld); AllSetPtMgr(AllSetPtMgrNum).CtrlNodes = OAPretreatSetPtMgr(SetPtMgrNum).CtrlNodes; } AllSetPtMgr(AllSetPtMgrNum).Name = OAPretreatSetPtMgr(SetPtMgrNum).Name; AllSetPtMgr(AllSetPtMgrNum).SPMType = iSPMType_OutsideAirPretreat; AllSetPtMgr(AllSetPtMgrNum).CtrlTypeMode = OAPretreatSetPtMgr(SetPtMgrNum).CtrlTypeMode; AllSetPtMgr(AllSetPtMgrNum).NumCtrlNodes = OAPretreatSetPtMgr(SetPtMgrNum).NumCtrlNodes; } // Input the Warmest Setpoint Managers if (NumWarmestSetPtMgrs > 0) WarmestSetPtMgr.allocate(NumWarmestSetPtMgrs); // Input the data for each Setpoint Manager cCurrentModuleObject = "SetpointManager:Warmest"; for (SetPtMgrNum = 1; SetPtMgrNum <= NumWarmestSetPtMgrs; ++SetPtMgrNum) { inputProcessor->getObjectItem(cCurrentModuleObject, SetPtMgrNum, cAlphaArgs, NumAlphas, rNumericArgs, NumNums, IOStat, lNumericFieldBlanks, lAlphaFieldBlanks, cAlphaFieldNames, cNumericFieldNames); UtilityRoutines::IsNameEmpty(cAlphaArgs(1), cCurrentModuleObject, ErrorsFound); WarmestSetPtMgr(SetPtMgrNum).Name = cAlphaArgs(1); WarmestSetPtMgr(SetPtMgrNum).CtrlVarType = cAlphaArgs(2); if (UtilityRoutines::SameString(WarmestSetPtMgr(SetPtMgrNum).CtrlVarType, "Temperature")) { WarmestSetPtMgr(SetPtMgrNum).CtrlTypeMode = iCtrlVarType_Temp; } else { // should not come here if idd type choice and key list is working ShowSevereError(RoutineName + cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\", invalid field."); ShowContinueError("..invalid " + cAlphaFieldNames(2) + "=\"" + cAlphaArgs(2) + "\"."); ShowContinueError("..Valid value is \"Temperature\"."); ErrorsFound = true; } WarmestSetPtMgr(SetPtMgrNum).AirLoopName = cAlphaArgs(3); WarmestSetPtMgr(SetPtMgrNum).AirLoopNum = 0; WarmestSetPtMgr(SetPtMgrNum).MinSetTemp = rNumericArgs(1); WarmestSetPtMgr(SetPtMgrNum).MaxSetTemp = rNumericArgs(2); if (WarmestSetPtMgr(SetPtMgrNum).MaxSetTemp < WarmestSetPtMgr(SetPtMgrNum).MinSetTemp) { ShowWarningError(RoutineName + cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\","); ShowContinueError("..." + cNumericFieldNames(2) + "=[" + RoundSigDigits(WarmestSetPtMgr(SetPtMgrNum).MaxSetTemp, 1) + "] is less than " + cNumericFieldNames(1) + "=[" + RoundSigDigits(WarmestSetPtMgr(SetPtMgrNum).MinSetTemp, 1) + "]."); } { auto const SELECT_CASE_var(UtilityRoutines::MakeUPPERCase(cAlphaArgs(4))); if (SELECT_CASE_var == "MAXIMUMTEMPERATURE") { WarmestSetPtMgr(SetPtMgrNum).Strategy = MaxTemp; } else { ShowSevereError(RoutineName + cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\", invalid field."); ShowContinueError("..invalid " + cAlphaFieldNames(4) + "=\"" + cAlphaArgs(4) + "\"."); ShowContinueError("..Valid value is \"MaximumTemperature\"."); ErrorsFound = true; } } NodeListError = false; GetNodeNums(cAlphaArgs(5), NumNodes, NodeNums, NodeListError, NodeType_Air, cCurrentModuleObject, cAlphaArgs(1), NodeConnectionType_SetPoint, 1, ObjectIsNotParent, _, cAlphaFieldNames(5)); // setpoint nodes if (!NodeListError) { NumNodesCtrld = NumNodes; WarmestSetPtMgr(SetPtMgrNum).CtrlNodes.allocate(NumNodesCtrld); WarmestSetPtMgr(SetPtMgrNum).NumCtrlNodes = NumNodesCtrld; WarmestSetPtMgr(SetPtMgrNum).SetPt = 0.0; for (CtrldNodeNum = 1; CtrldNodeNum <= NumNodesCtrld; ++CtrldNodeNum) { WarmestSetPtMgr(SetPtMgrNum).CtrlNodes(CtrldNodeNum) = NodeNums(CtrldNodeNum); } } else { // CALL ShowSevereError(RoutineName//TRIM(cCurrentModuleObject)//'="'//TRIM(cAlphaArgs(1))// & // '", invalid field.') // Call ShowContinueError('..invalid '//TRIM(cAlphaFieldNames(5))//'="'//TRIM(cAlphaArgs(5))//'".') ErrorsFound = true; } AllSetPtMgrNum = SetPtMgrNum + NumSchSetPtMgrs + NumDualSchSetPtMgrs + NumOutAirSetPtMgrs + NumSZRhSetPtMgrs + NumSZHtSetPtMgrs + NumSZClSetPtMgrs + NumSZMinHumSetPtMgrs + NumSZMaxHumSetPtMgrs + NumMixedAirSetPtMgrs + NumOAPretreatSetPtMgrs; if (!NodeListError) { AllSetPtMgr(AllSetPtMgrNum).CtrlNodes.allocate(NumNodesCtrld); AllSetPtMgr(AllSetPtMgrNum).CtrlNodes = WarmestSetPtMgr(SetPtMgrNum).CtrlNodes; } AllSetPtMgr(AllSetPtMgrNum).Name = WarmestSetPtMgr(SetPtMgrNum).Name; AllSetPtMgr(AllSetPtMgrNum).SPMType = iSPMType_Warmest; AllSetPtMgr(AllSetPtMgrNum).CtrlTypeMode = WarmestSetPtMgr(SetPtMgrNum).CtrlTypeMode; AllSetPtMgr(AllSetPtMgrNum).NumCtrlNodes = WarmestSetPtMgr(SetPtMgrNum).NumCtrlNodes; } // Input the Coldest Setpoint Managers if (NumColdestSetPtMgrs > 0) ColdestSetPtMgr.allocate(NumColdestSetPtMgrs); // Input the data for each Setpoint Manager cCurrentModuleObject = "SetpointManager:Coldest"; for (SetPtMgrNum = 1; SetPtMgrNum <= NumColdestSetPtMgrs; ++SetPtMgrNum) { inputProcessor->getObjectItem(cCurrentModuleObject, SetPtMgrNum, cAlphaArgs, NumAlphas, rNumericArgs, NumNums, IOStat, lNumericFieldBlanks, lAlphaFieldBlanks, cAlphaFieldNames, cNumericFieldNames); UtilityRoutines::IsNameEmpty(cAlphaArgs(1), cCurrentModuleObject, ErrorsFound); ColdestSetPtMgr(SetPtMgrNum).Name = cAlphaArgs(1); ColdestSetPtMgr(SetPtMgrNum).CtrlVarType = cAlphaArgs(2); if (UtilityRoutines::SameString(ColdestSetPtMgr(SetPtMgrNum).CtrlVarType, "Temperature")) { ColdestSetPtMgr(SetPtMgrNum).CtrlTypeMode = iCtrlVarType_Temp; } else { // should not come here if idd type choice and key list is working ShowSevereError(RoutineName + cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\", invalid field."); ShowContinueError("..invalid " + cAlphaFieldNames(2) + "=\"" + cAlphaArgs(2) + "\"."); ShowContinueError("..Valid value is \"Temperature\"."); ErrorsFound = true; } ColdestSetPtMgr(SetPtMgrNum).AirLoopName = cAlphaArgs(3); ColdestSetPtMgr(SetPtMgrNum).AirLoopNum = 0; ColdestSetPtMgr(SetPtMgrNum).MinSetTemp = rNumericArgs(1); ColdestSetPtMgr(SetPtMgrNum).MaxSetTemp = rNumericArgs(2); if (ColdestSetPtMgr(SetPtMgrNum).MaxSetTemp < ColdestSetPtMgr(SetPtMgrNum).MinSetTemp) { ShowWarningError(RoutineName + cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\","); ShowContinueError("..." + cNumericFieldNames(2) + "=[" + RoundSigDigits(ColdestSetPtMgr(SetPtMgrNum).MaxSetTemp, 1) + "] is less than " + cNumericFieldNames(1) + "=[" + RoundSigDigits(ColdestSetPtMgr(SetPtMgrNum).MinSetTemp, 1) + "]."); } { auto const SELECT_CASE_var(UtilityRoutines::MakeUPPERCase(cAlphaArgs(4))); if (SELECT_CASE_var == "MINIMUMTEMPERATURE") { ColdestSetPtMgr(SetPtMgrNum).Strategy = MinTemp; } else { ShowSevereError(RoutineName + cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\", invalid field."); ShowContinueError("..invalid " + cAlphaFieldNames(4) + "=\"" + cAlphaArgs(4) + "\"."); ShowContinueError("..Valid value is \"MinimumTemperature\"."); ErrorsFound = true; } } NodeListError = false; GetNodeNums(cAlphaArgs(5), NumNodes, NodeNums, NodeListError, NodeType_Air, cCurrentModuleObject, cAlphaArgs(1), NodeConnectionType_SetPoint, 1, ObjectIsNotParent, _, cAlphaFieldNames(5)); // setpoint nodes if (!NodeListError) { NumNodesCtrld = NumNodes; ColdestSetPtMgr(SetPtMgrNum).CtrlNodes.allocate(NumNodesCtrld); ColdestSetPtMgr(SetPtMgrNum).NumCtrlNodes = NumNodesCtrld; ColdestSetPtMgr(SetPtMgrNum).SetPt = 0.0; for (CtrldNodeNum = 1; CtrldNodeNum <= NumNodesCtrld; ++CtrldNodeNum) { ColdestSetPtMgr(SetPtMgrNum).CtrlNodes(CtrldNodeNum) = NodeNums(CtrldNodeNum); } } else { // CALL ShowSevereError(RoutineName//TRIM(cCurrentModuleObject)//'="'//TRIM(cAlphaArgs(1))// & // '", invalid field.') // Call ShowContinueError('..invalid '//TRIM(cAlphaFieldNames(5))//'="'//TRIM(cAlphaArgs(5))//'".') ErrorsFound = true; } AllSetPtMgrNum = SetPtMgrNum + NumSchSetPtMgrs + NumDualSchSetPtMgrs + NumOutAirSetPtMgrs + NumSZRhSetPtMgrs + NumSZHtSetPtMgrs + NumSZClSetPtMgrs + NumSZMinHumSetPtMgrs + NumSZMaxHumSetPtMgrs + NumMixedAirSetPtMgrs + NumOAPretreatSetPtMgrs + NumWarmestSetPtMgrs; if (!NodeListError) { AllSetPtMgr(AllSetPtMgrNum).CtrlNodes.allocate(NumNodesCtrld); AllSetPtMgr(AllSetPtMgrNum).CtrlNodes = ColdestSetPtMgr(SetPtMgrNum).CtrlNodes; } AllSetPtMgr(AllSetPtMgrNum).Name = ColdestSetPtMgr(SetPtMgrNum).Name; AllSetPtMgr(AllSetPtMgrNum).SPMType = iSPMType_Coldest; AllSetPtMgr(AllSetPtMgrNum).CtrlTypeMode = ColdestSetPtMgr(SetPtMgrNum).CtrlTypeMode; AllSetPtMgr(AllSetPtMgrNum).NumCtrlNodes = ColdestSetPtMgr(SetPtMgrNum).NumCtrlNodes; } // Input the Warmest Temp Flow Setpoint Managers if (NumWarmestSetPtMgrsTempFlow > 0) WarmestSetPtMgrTempFlow.allocate(NumWarmestSetPtMgrsTempFlow); // Input the data for each Setpoint Manager cCurrentModuleObject = "SetpointManager:WarmestTemperatureFlow"; for (SetPtMgrNum = 1; SetPtMgrNum <= NumWarmestSetPtMgrsTempFlow; ++SetPtMgrNum) { inputProcessor->getObjectItem(cCurrentModuleObject, SetPtMgrNum, cAlphaArgs, NumAlphas, rNumericArgs, NumNums, IOStat, lNumericFieldBlanks, lAlphaFieldBlanks, cAlphaFieldNames, cNumericFieldNames); UtilityRoutines::IsNameEmpty(cAlphaArgs(1), cCurrentModuleObject, ErrorsFound); WarmestSetPtMgrTempFlow(SetPtMgrNum).Name = cAlphaArgs(1); WarmestSetPtMgrTempFlow(SetPtMgrNum).CtrlVarType = cAlphaArgs(2); if (UtilityRoutines::SameString(WarmestSetPtMgrTempFlow(SetPtMgrNum).CtrlVarType, "Temperature")) { WarmestSetPtMgrTempFlow(SetPtMgrNum).CtrlTypeMode = iCtrlVarType_Temp; } else { // should not come here if idd type choice and key list is working ShowSevereError(RoutineName + cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\", invalid field."); ShowContinueError("..invalid " + cAlphaFieldNames(2) + "=\"" + cAlphaArgs(2) + "\"."); ShowContinueError("..Valid value is \"Temperature\"."); ErrorsFound = true; } WarmestSetPtMgrTempFlow(SetPtMgrNum).AirLoopName = cAlphaArgs(3); WarmestSetPtMgrTempFlow(SetPtMgrNum).AirLoopNum = 0; WarmestSetPtMgrTempFlow(SetPtMgrNum).MinSetTemp = rNumericArgs(1); WarmestSetPtMgrTempFlow(SetPtMgrNum).MaxSetTemp = rNumericArgs(2); if (WarmestSetPtMgrTempFlow(SetPtMgrNum).MaxSetTemp < WarmestSetPtMgrTempFlow(SetPtMgrNum).MinSetTemp) { ShowWarningError(RoutineName + cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\","); ShowContinueError("..." + cNumericFieldNames(2) + "=[" + RoundSigDigits(WarmestSetPtMgrTempFlow(SetPtMgrNum).MaxSetTemp, 1) + "] is less than " + cNumericFieldNames(1) + "=[" + RoundSigDigits(WarmestSetPtMgrTempFlow(SetPtMgrNum).MinSetTemp, 1) + "]."); } WarmestSetPtMgrTempFlow(SetPtMgrNum).MinTurndown = rNumericArgs(3); if (WarmestSetPtMgrTempFlow(SetPtMgrNum).MinTurndown >= 0.8) { ShowWarningError(RoutineName + cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\","); ShowContinueError("..." + cNumericFieldNames(3) + "=[" + RoundSigDigits(WarmestSetPtMgrTempFlow(SetPtMgrNum).MinTurndown, 2) + "] is greater than 0.8;"); ShowContinueError("...typical values for " + cNumericFieldNames(3) + " are less than 0.8."); } { auto const SELECT_CASE_var(UtilityRoutines::MakeUPPERCase(cAlphaArgs(4))); if (SELECT_CASE_var == "TEMPERATUREFIRST") { WarmestSetPtMgrTempFlow(SetPtMgrNum).Strategy = TempFirst; } else if (SELECT_CASE_var == "FLOWFIRST") { WarmestSetPtMgrTempFlow(SetPtMgrNum).Strategy = FlowFirst; } else { ShowSevereError(RoutineName + cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\", invalid field."); ShowContinueError("..invalid " + cAlphaFieldNames(4) + "=\"" + cAlphaArgs(4) + "\"."); ShowContinueError("..Valid values are \"TemperatureFirst\" or \"FlowFirst\"."); ErrorsFound = true; } } NodeListError = false; GetNodeNums(cAlphaArgs(5), NumNodes, NodeNums, NodeListError, NodeType_Air, cCurrentModuleObject, cAlphaArgs(1), NodeConnectionType_SetPoint, 1, ObjectIsNotParent, _, cAlphaFieldNames(5)); // setpoint nodes if (!NodeListError) { NumNodesCtrld = NumNodes; WarmestSetPtMgrTempFlow(SetPtMgrNum).CtrlNodes.allocate(NumNodesCtrld); WarmestSetPtMgrTempFlow(SetPtMgrNum).NumCtrlNodes = NumNodesCtrld; WarmestSetPtMgrTempFlow(SetPtMgrNum).SetPt = 0.0; for (CtrldNodeNum = 1; CtrldNodeNum <= NumNodesCtrld; ++CtrldNodeNum) { WarmestSetPtMgrTempFlow(SetPtMgrNum).CtrlNodes(CtrldNodeNum) = NodeNums(CtrldNodeNum); } } else { // CALL ShowSevereError(RoutineName//TRIM(cCurrentModuleObject)//'="'//TRIM(cAlphaArgs(1))// & // '", invalid field.') // Call ShowContinueError('..invalid '//TRIM(cAlphaFieldNames(5))//'="'//TRIM(cAlphaArgs(5))//'".') ErrorsFound = true; } AllSetPtMgrNum = SetPtMgrNum + NumSchSetPtMgrs + NumDualSchSetPtMgrs + NumOutAirSetPtMgrs + NumSZRhSetPtMgrs + NumSZHtSetPtMgrs + NumSZClSetPtMgrs + NumSZMinHumSetPtMgrs + NumSZMaxHumSetPtMgrs + NumMixedAirSetPtMgrs + NumOAPretreatSetPtMgrs + NumWarmestSetPtMgrs + NumColdestSetPtMgrs; if (!NodeListError) { AllSetPtMgr(AllSetPtMgrNum).CtrlNodes.allocate(NumNodesCtrld); AllSetPtMgr(AllSetPtMgrNum).CtrlNodes = WarmestSetPtMgrTempFlow(SetPtMgrNum).CtrlNodes; } AllSetPtMgr(AllSetPtMgrNum).Name = WarmestSetPtMgrTempFlow(SetPtMgrNum).Name; AllSetPtMgr(AllSetPtMgrNum).SPMType = iSPMType_WarmestTempFlow; AllSetPtMgr(AllSetPtMgrNum).CtrlTypeMode = WarmestSetPtMgrTempFlow(SetPtMgrNum).CtrlTypeMode; AllSetPtMgr(AllSetPtMgrNum).NumCtrlNodes = WarmestSetPtMgrTempFlow(SetPtMgrNum).NumCtrlNodes; } // Input the Return Air Bypass Flow Setpoint Managers if (NumRABFlowSetPtMgrs > 0) RABFlowSetPtMgr.allocate(NumRABFlowSetPtMgrs); // Input the data for each Setpoint Manager cCurrentModuleObject = "SetpointManager:ReturnAirBypassFlow"; for (SetPtMgrNum = 1; SetPtMgrNum <= NumRABFlowSetPtMgrs; ++SetPtMgrNum) { inputProcessor->getObjectItem(cCurrentModuleObject, SetPtMgrNum, cAlphaArgs, NumAlphas, rNumericArgs, NumNums, IOStat, lNumericFieldBlanks, lAlphaFieldBlanks, cAlphaFieldNames, cNumericFieldNames); UtilityRoutines::IsNameEmpty(cAlphaArgs(1), cCurrentModuleObject, ErrorsFound); RABFlowSetPtMgr(SetPtMgrNum).Name = cAlphaArgs(1); RABFlowSetPtMgr(SetPtMgrNum).CtrlVarType = cAlphaArgs(2); RABFlowSetPtMgr(SetPtMgrNum).NumCtrlNodes = 1; NumNodesCtrld = 1; if (UtilityRoutines::SameString(RABFlowSetPtMgr(SetPtMgrNum).CtrlVarType, "Flow")) { RABFlowSetPtMgr(SetPtMgrNum).CtrlTypeMode = iCtrlVarType_MassFlow; } else { // should not come here if idd type choice and key list is working ShowSevereError(RoutineName + cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\", invalid field."); ShowContinueError("..invalid " + cAlphaFieldNames(2) + "=\"" + cAlphaArgs(2) + "\"."); ShowContinueError("..Valid value is \"Temperature\"."); ErrorsFound = true; } RABFlowSetPtMgr(SetPtMgrNum).AirLoopName = cAlphaArgs(3); RABFlowSetPtMgr(SetPtMgrNum).AirLoopNum = 0; RABFlowSetPtMgr(SetPtMgrNum).Sched = cAlphaArgs(4); RABFlowSetPtMgr(SetPtMgrNum).SchedPtr = GetScheduleIndex(cAlphaArgs(4)); if (RABFlowSetPtMgr(SetPtMgrNum).SchedPtr == 0) { if (lAlphaFieldBlanks(4)) { ShowSevereError(RoutineName + cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\", blank required field."); ShowContinueError("..required field " + cAlphaFieldNames(4)); } else { ShowSevereError(RoutineName + cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\", invalid field."); ShowContinueError("..invalid " + cAlphaFieldNames(4) + "=\"" + cAlphaArgs(4) + "\"."); } ErrorsFound = true; } AllSetPtMgrNum = SetPtMgrNum + NumSchSetPtMgrs + NumDualSchSetPtMgrs + NumOutAirSetPtMgrs + NumSZRhSetPtMgrs + NumSZHtSetPtMgrs + NumSZClSetPtMgrs + NumSZMinHumSetPtMgrs + NumSZMaxHumSetPtMgrs + NumMixedAirSetPtMgrs + NumOAPretreatSetPtMgrs + NumWarmestSetPtMgrs + NumColdestSetPtMgrs + NumWarmestSetPtMgrsTempFlow; RABFlowSetPtMgr(SetPtMgrNum).AllSetPtMgrIndex = AllSetPtMgrNum; RABFlowSetPtMgr(SetPtMgrNum).CtrlNodes.allocate(NumNodesCtrld); RABFlowSetPtMgr(SetPtMgrNum).CtrlNodes = 0; AllSetPtMgr(AllSetPtMgrNum).CtrlNodes.allocate(NumNodesCtrld); // need to reset this to the control node (RABSplitOutNode) in Init, will be 0 here AllSetPtMgr(AllSetPtMgrNum).CtrlNodes = RABFlowSetPtMgr(SetPtMgrNum).CtrlNodes; AllSetPtMgr(AllSetPtMgrNum).Name = RABFlowSetPtMgr(SetPtMgrNum).Name; AllSetPtMgr(AllSetPtMgrNum).SPMType = iSPMType_RAB; AllSetPtMgr(AllSetPtMgrNum).CtrlTypeMode = RABFlowSetPtMgr(SetPtMgrNum).CtrlTypeMode; AllSetPtMgr(AllSetPtMgrNum).NumCtrlNodes = RABFlowSetPtMgr(SetPtMgrNum).NumCtrlNodes; } // Input the MultiZone Average Cooling Setpoint Managers if (NumMZClgAverageSetPtMgrs > 0) MZAverageCoolingSetPtMgr.allocate(NumMZClgAverageSetPtMgrs); // Input the data for each setpoint manager cCurrentModuleObject = "SetpointManager:MultiZone:Cooling:Average"; for (SetPtMgrNum = 1; SetPtMgrNum <= NumMZClgAverageSetPtMgrs; ++SetPtMgrNum) { inputProcessor->getObjectItem(cCurrentModuleObject, SetPtMgrNum, cAlphaArgs, NumAlphas, rNumericArgs, NumNums, IOStat, lNumericFieldBlanks, lAlphaFieldBlanks, cAlphaFieldNames, cNumericFieldNames); UtilityRoutines::IsNameEmpty(cAlphaArgs(1), cCurrentModuleObject, ErrorsFound); MZAverageCoolingSetPtMgr(SetPtMgrNum).Name = cAlphaArgs(1); MZAverageCoolingSetPtMgr(SetPtMgrNum).AirLoopName = cAlphaArgs(2); MZAverageCoolingSetPtMgr(SetPtMgrNum).AirLoopNum = 0; MZAverageCoolingSetPtMgr(SetPtMgrNum).MinSetTemp = rNumericArgs(1); MZAverageCoolingSetPtMgr(SetPtMgrNum).MaxSetTemp = rNumericArgs(2); MZAverageCoolingSetPtMgr(SetPtMgrNum).CtrlVarType = "Temperature"; MZAverageCoolingSetPtMgr(SetPtMgrNum).CtrlTypeMode = iCtrlVarType_Temp; if (MZAverageCoolingSetPtMgr(SetPtMgrNum).MaxSetTemp < MZAverageCoolingSetPtMgr(SetPtMgrNum).MinSetTemp) { ShowWarningError(RoutineName + cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\","); ShowContinueError("..." + cNumericFieldNames(2) + "=[" + RoundSigDigits(MZAverageCoolingSetPtMgr(SetPtMgrNum).MaxSetTemp, 1) + "] is less than " + cNumericFieldNames(1) + "=[" + RoundSigDigits(MZAverageCoolingSetPtMgr(SetPtMgrNum).MinSetTemp, 1) + "]."); } NodeListError = false; GetNodeNums(cAlphaArgs(3), NumNodes, NodeNums, NodeListError, NodeType_Air, cCurrentModuleObject, cAlphaArgs(1), NodeConnectionType_SetPoint, 1, ObjectIsNotParent, _, cAlphaFieldNames(3)); // setpoint nodes if (!NodeListError) { NumNodesCtrld = NumNodes; MZAverageCoolingSetPtMgr(SetPtMgrNum).CtrlNodes.allocate(NumNodesCtrld); MZAverageCoolingSetPtMgr(SetPtMgrNum).NumCtrlNodes = NumNodesCtrld; MZAverageCoolingSetPtMgr(SetPtMgrNum).SetPt = 0.0; for (CtrldNodeNum = 1; CtrldNodeNum <= NumNodesCtrld; ++CtrldNodeNum) { MZAverageCoolingSetPtMgr(SetPtMgrNum).CtrlNodes(CtrldNodeNum) = NodeNums(CtrldNodeNum); } } else { // CALL ShowSevereError(RoutineName//TRIM(cCurrentModuleObject)//'="'//TRIM(cAlphaArgs(1))// & // '", invalid field.') // Call ShowContinueError('..invalid '//TRIM(cAlphaFieldNames(3))//'="'//TRIM(cAlphaArgs(3))//'".') ErrorsFound = true; } AllSetPtMgrNum = SetPtMgrNum + NumSchSetPtMgrs + NumDualSchSetPtMgrs + NumOutAirSetPtMgrs + NumSZRhSetPtMgrs + NumSZHtSetPtMgrs + NumSZClSetPtMgrs + NumSZMinHumSetPtMgrs + NumSZMaxHumSetPtMgrs + NumMixedAirSetPtMgrs + NumOAPretreatSetPtMgrs + NumWarmestSetPtMgrs + NumColdestSetPtMgrs + NumWarmestSetPtMgrsTempFlow + NumRABFlowSetPtMgrs; if (!NodeListError) { AllSetPtMgr(AllSetPtMgrNum).CtrlNodes.allocate(NumNodesCtrld); AllSetPtMgr(AllSetPtMgrNum).CtrlNodes = MZAverageCoolingSetPtMgr(SetPtMgrNum).CtrlNodes; } AllSetPtMgr(AllSetPtMgrNum).Name = MZAverageCoolingSetPtMgr(SetPtMgrNum).Name; AllSetPtMgr(AllSetPtMgrNum).SPMType = iSPMType_MZCoolingAverage; AllSetPtMgr(AllSetPtMgrNum).CtrlTypeMode = MZAverageCoolingSetPtMgr(SetPtMgrNum).CtrlTypeMode; AllSetPtMgr(AllSetPtMgrNum).NumCtrlNodes = MZAverageCoolingSetPtMgr(SetPtMgrNum).NumCtrlNodes; } // Input the MultiZone Average Heating Setpoint Managers if (NumMZHtgAverageSetPtMgrs > 0) MZAverageHeatingSetPtMgr.allocate(NumMZHtgAverageSetPtMgrs); // Input the data for each setpoint manager cCurrentModuleObject = "SetpointManager:MultiZone:Heating:Average"; for (SetPtMgrNum = 1; SetPtMgrNum <= NumMZHtgAverageSetPtMgrs; ++SetPtMgrNum) { inputProcessor->getObjectItem(cCurrentModuleObject, SetPtMgrNum, cAlphaArgs, NumAlphas, rNumericArgs, NumNums, IOStat, lNumericFieldBlanks, lAlphaFieldBlanks, cAlphaFieldNames, cNumericFieldNames); UtilityRoutines::IsNameEmpty(cAlphaArgs(1), cCurrentModuleObject, ErrorsFound); MZAverageHeatingSetPtMgr(SetPtMgrNum).Name = cAlphaArgs(1); MZAverageHeatingSetPtMgr(SetPtMgrNum).AirLoopName = cAlphaArgs(2); MZAverageHeatingSetPtMgr(SetPtMgrNum).AirLoopNum = 0; MZAverageHeatingSetPtMgr(SetPtMgrNum).MinSetTemp = rNumericArgs(1); MZAverageHeatingSetPtMgr(SetPtMgrNum).MaxSetTemp = rNumericArgs(2); MZAverageHeatingSetPtMgr(SetPtMgrNum).CtrlVarType = "Temperature"; MZAverageHeatingSetPtMgr(SetPtMgrNum).CtrlTypeMode = iCtrlVarType_Temp; if (MZAverageHeatingSetPtMgr(SetPtMgrNum).MaxSetTemp < MZAverageHeatingSetPtMgr(SetPtMgrNum).MinSetTemp) { ShowWarningError(RoutineName + cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\","); ShowContinueError("..." + cNumericFieldNames(2) + "=[" + RoundSigDigits(MZAverageHeatingSetPtMgr(SetPtMgrNum).MaxSetTemp, 1) + "] is less than " + cNumericFieldNames(1) + "=[" + RoundSigDigits(MZAverageHeatingSetPtMgr(SetPtMgrNum).MinSetTemp, 1) + "]."); } NodeListError = false; GetNodeNums(cAlphaArgs(3), NumNodes, NodeNums, NodeListError, NodeType_Air, cCurrentModuleObject, cAlphaArgs(1), NodeConnectionType_SetPoint, 1, ObjectIsNotParent, _, cAlphaFieldNames(3)); // setpoint nodes if (!NodeListError) { NumNodesCtrld = NumNodes; MZAverageHeatingSetPtMgr(SetPtMgrNum).CtrlNodes.allocate(NumNodesCtrld); MZAverageHeatingSetPtMgr(SetPtMgrNum).NumCtrlNodes = NumNodesCtrld; MZAverageHeatingSetPtMgr(SetPtMgrNum).SetPt = 0.0; for (CtrldNodeNum = 1; CtrldNodeNum <= NumNodesCtrld; ++CtrldNodeNum) { MZAverageHeatingSetPtMgr(SetPtMgrNum).CtrlNodes(CtrldNodeNum) = NodeNums(CtrldNodeNum); } } else { // CALL ShowSevereError(RoutineName//TRIM(cCurrentModuleObject)//'="'//TRIM(cAlphaArgs(1))// & // '", invalid field.') // Call ShowContinueError('..invalid '//TRIM(cAlphaFieldNames(3))//'="'//TRIM(cAlphaArgs(3))//'".') ErrorsFound = true; } AllSetPtMgrNum = SetPtMgrNum + NumSchSetPtMgrs + NumDualSchSetPtMgrs + NumOutAirSetPtMgrs + NumSZRhSetPtMgrs + NumSZHtSetPtMgrs + NumSZClSetPtMgrs + NumSZMinHumSetPtMgrs + NumSZMaxHumSetPtMgrs + NumMixedAirSetPtMgrs + NumOAPretreatSetPtMgrs + NumWarmestSetPtMgrs + NumColdestSetPtMgrs + NumWarmestSetPtMgrsTempFlow + NumRABFlowSetPtMgrs + NumMZClgAverageSetPtMgrs; if (!NodeListError) { AllSetPtMgr(AllSetPtMgrNum).CtrlNodes.allocate(NumNodesCtrld); AllSetPtMgr(AllSetPtMgrNum).CtrlNodes = MZAverageHeatingSetPtMgr(SetPtMgrNum).CtrlNodes; } AllSetPtMgr(AllSetPtMgrNum).Name = MZAverageHeatingSetPtMgr(SetPtMgrNum).Name; AllSetPtMgr(AllSetPtMgrNum).SPMType = iSPMType_MZHeatingAverage; AllSetPtMgr(AllSetPtMgrNum).CtrlTypeMode = MZAverageHeatingSetPtMgr(SetPtMgrNum).CtrlTypeMode; AllSetPtMgr(AllSetPtMgrNum).NumCtrlNodes = MZAverageHeatingSetPtMgr(SetPtMgrNum).NumCtrlNodes; } // Input the MultiZone Average Minimum Humidity Setpoint Managers if (NumMZAverageMinHumSetPtMgrs > 0) MZAverageMinHumSetPtMgr.allocate(NumMZAverageMinHumSetPtMgrs); // Input the data for each setpoint manager cCurrentModuleObject = "SetpointManager:MultiZone:MinimumHumidity:Average"; for (SetPtMgrNum = 1; SetPtMgrNum <= NumMZAverageMinHumSetPtMgrs; ++SetPtMgrNum) { inputProcessor->getObjectItem(cCurrentModuleObject, SetPtMgrNum, cAlphaArgs, NumAlphas, rNumericArgs, NumNums, IOStat, lNumericFieldBlanks, lAlphaFieldBlanks, cAlphaFieldNames, cNumericFieldNames); UtilityRoutines::IsNameEmpty(cAlphaArgs(1), cCurrentModuleObject, ErrorsFound); MZAverageMinHumSetPtMgr(SetPtMgrNum).Name = cAlphaArgs(1); MZAverageMinHumSetPtMgr(SetPtMgrNum).AirLoopName = cAlphaArgs(2); MZAverageMinHumSetPtMgr(SetPtMgrNum).AirLoopNum = 0; MZAverageMinHumSetPtMgr(SetPtMgrNum).MinSetHum = rNumericArgs(1); MZAverageMinHumSetPtMgr(SetPtMgrNum).MaxSetHum = rNumericArgs(2); MZAverageMinHumSetPtMgr(SetPtMgrNum).CtrlVarType = "MinimumHumidityRatio"; MZAverageMinHumSetPtMgr(SetPtMgrNum).CtrlTypeMode = iCtrlVarType_MinHumRat; if (MZAverageMinHumSetPtMgr(SetPtMgrNum).MaxSetHum < MZAverageMinHumSetPtMgr(SetPtMgrNum).MinSetHum) { ShowWarningError(RoutineName + cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\","); ShowContinueError("..." + cNumericFieldNames(2) + "=[" + RoundSigDigits(MZAverageMinHumSetPtMgr(SetPtMgrNum).MaxSetHum, 3) + "] is less than " + cNumericFieldNames(1) + "=[" + RoundSigDigits(MZAverageMinHumSetPtMgr(SetPtMgrNum).MinSetHum, 3) + "]."); } NodeListError = false; GetNodeNums(cAlphaArgs(3), NumNodes, NodeNums, NodeListError, NodeType_Air, cCurrentModuleObject, cAlphaArgs(1), NodeConnectionType_SetPoint, 1, ObjectIsNotParent, _, cAlphaFieldNames(3)); // setpoint nodes if (!NodeListError) { NumNodesCtrld = NumNodes; MZAverageMinHumSetPtMgr(SetPtMgrNum).CtrlNodes.allocate(NumNodesCtrld); MZAverageMinHumSetPtMgr(SetPtMgrNum).NumCtrlNodes = NumNodesCtrld; MZAverageMinHumSetPtMgr(SetPtMgrNum).SetPt = 0.0; for (CtrldNodeNum = 1; CtrldNodeNum <= NumNodesCtrld; ++CtrldNodeNum) { MZAverageMinHumSetPtMgr(SetPtMgrNum).CtrlNodes(CtrldNodeNum) = NodeNums(CtrldNodeNum); } } else { // CALL ShowSevereError(RoutineName//TRIM(cCurrentModuleObject)//'="'//TRIM(cAlphaArgs(1))// & // '", invalid field.') // Call ShowContinueError('..invalid '//TRIM(cAlphaFieldNames(3))//'="'//TRIM(cAlphaArgs(3))//'".') ErrorsFound = true; } AllSetPtMgrNum = SetPtMgrNum + NumSchSetPtMgrs + NumDualSchSetPtMgrs + NumOutAirSetPtMgrs + NumSZRhSetPtMgrs + NumSZHtSetPtMgrs + NumSZClSetPtMgrs + NumSZMinHumSetPtMgrs + NumSZMaxHumSetPtMgrs + NumMixedAirSetPtMgrs + NumOAPretreatSetPtMgrs + NumWarmestSetPtMgrs + NumColdestSetPtMgrs + NumWarmestSetPtMgrsTempFlow + NumRABFlowSetPtMgrs + NumMZClgAverageSetPtMgrs + NumMZHtgAverageSetPtMgrs; if (!NodeListError) { AllSetPtMgr(AllSetPtMgrNum).CtrlNodes.allocate(NumNodesCtrld); AllSetPtMgr(AllSetPtMgrNum).CtrlNodes = MZAverageMinHumSetPtMgr(SetPtMgrNum).CtrlNodes; } AllSetPtMgr(AllSetPtMgrNum).Name = MZAverageMinHumSetPtMgr(SetPtMgrNum).Name; AllSetPtMgr(AllSetPtMgrNum).SPMType = iSPMType_MZMinHumAverage; AllSetPtMgr(AllSetPtMgrNum).CtrlTypeMode = MZAverageMinHumSetPtMgr(SetPtMgrNum).CtrlTypeMode; AllSetPtMgr(AllSetPtMgrNum).NumCtrlNodes = MZAverageMinHumSetPtMgr(SetPtMgrNum).NumCtrlNodes; } // Input the MultiZone Average Maximum Humidity SetPoint Managers if (NumMZAverageMaxHumSetPtMgrs > 0) MZAverageMaxHumSetPtMgr.allocate(NumMZAverageMaxHumSetPtMgrs); // Input the data for each setpoint manager cCurrentModuleObject = "SetpointManager:MultiZone:MaximumHumidity:Average"; for (SetPtMgrNum = 1; SetPtMgrNum <= NumMZAverageMaxHumSetPtMgrs; ++SetPtMgrNum) { inputProcessor->getObjectItem(cCurrentModuleObject, SetPtMgrNum, cAlphaArgs, NumAlphas, rNumericArgs, NumNums, IOStat, lNumericFieldBlanks, lAlphaFieldBlanks, cAlphaFieldNames, cNumericFieldNames); UtilityRoutines::IsNameEmpty(cAlphaArgs(1), cCurrentModuleObject, ErrorsFound); MZAverageMaxHumSetPtMgr(SetPtMgrNum).Name = cAlphaArgs(1); MZAverageMaxHumSetPtMgr(SetPtMgrNum).AirLoopName = cAlphaArgs(2); MZAverageMaxHumSetPtMgr(SetPtMgrNum).AirLoopNum = 0; MZAverageMaxHumSetPtMgr(SetPtMgrNum).MinSetHum = rNumericArgs(1); MZAverageMaxHumSetPtMgr(SetPtMgrNum).MaxSetHum = rNumericArgs(2); MZAverageMaxHumSetPtMgr(SetPtMgrNum).CtrlVarType = "MaximumHumidityRatio"; MZAverageMaxHumSetPtMgr(SetPtMgrNum).CtrlTypeMode = iCtrlVarType_MaxHumRat; if (MZAverageMaxHumSetPtMgr(SetPtMgrNum).MaxSetHum < MZAverageMaxHumSetPtMgr(SetPtMgrNum).MinSetHum) { ShowWarningError(RoutineName + cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\","); ShowContinueError("..." + cNumericFieldNames(2) + "=[" + RoundSigDigits(MZAverageMaxHumSetPtMgr(SetPtMgrNum).MaxSetHum, 3) + "] is less than " + cNumericFieldNames(1) + "=[" + RoundSigDigits(MZAverageMaxHumSetPtMgr(SetPtMgrNum).MinSetHum, 3) + "]."); } NodeListError = false; GetNodeNums(cAlphaArgs(3), NumNodes, NodeNums, NodeListError, NodeType_Air, cCurrentModuleObject, cAlphaArgs(1), NodeConnectionType_SetPoint, 1, ObjectIsNotParent, _, cAlphaFieldNames(3)); // setpoint nodes if (!NodeListError) { NumNodesCtrld = NumNodes; MZAverageMaxHumSetPtMgr(SetPtMgrNum).CtrlNodes.allocate(NumNodesCtrld); MZAverageMaxHumSetPtMgr(SetPtMgrNum).NumCtrlNodes = NumNodesCtrld; MZAverageMaxHumSetPtMgr(SetPtMgrNum).SetPt = 0.0; for (CtrldNodeNum = 1; CtrldNodeNum <= NumNodesCtrld; ++CtrldNodeNum) { MZAverageMaxHumSetPtMgr(SetPtMgrNum).CtrlNodes(CtrldNodeNum) = NodeNums(CtrldNodeNum); } } else { // CALL ShowSevereError(RoutineName//TRIM(cCurrentModuleObject)//'="'//TRIM(cAlphaArgs(1))// & // '", invalid field.') // Call ShowContinueError('..invalid '//TRIM(cAlphaFieldNames(3))//'="'//TRIM(cAlphaArgs(3))//'".') ErrorsFound = true; } AllSetPtMgrNum = SetPtMgrNum + NumSchSetPtMgrs + NumDualSchSetPtMgrs + NumOutAirSetPtMgrs + NumSZRhSetPtMgrs + NumSZHtSetPtMgrs + NumSZClSetPtMgrs + NumSZMinHumSetPtMgrs + NumSZMaxHumSetPtMgrs + NumMixedAirSetPtMgrs + NumOAPretreatSetPtMgrs + NumWarmestSetPtMgrs + NumColdestSetPtMgrs + NumWarmestSetPtMgrsTempFlow + NumRABFlowSetPtMgrs + NumMZClgAverageSetPtMgrs + NumMZHtgAverageSetPtMgrs + NumMZAverageMinHumSetPtMgrs; if (!NodeListError) { AllSetPtMgr(AllSetPtMgrNum).CtrlNodes.allocate(NumNodesCtrld); AllSetPtMgr(AllSetPtMgrNum).CtrlNodes = MZAverageMaxHumSetPtMgr(SetPtMgrNum).CtrlNodes; } AllSetPtMgr(AllSetPtMgrNum).Name = MZAverageMaxHumSetPtMgr(SetPtMgrNum).Name; AllSetPtMgr(AllSetPtMgrNum).SPMType = iSPMType_MZMaxHumAverage; AllSetPtMgr(AllSetPtMgrNum).CtrlTypeMode = MZAverageMaxHumSetPtMgr(SetPtMgrNum).CtrlTypeMode; AllSetPtMgr(AllSetPtMgrNum).NumCtrlNodes = MZAverageMaxHumSetPtMgr(SetPtMgrNum).NumCtrlNodes; } // Input the Multizone Minimum Humidity Ratio SetPoint Managers if (NumMZMinHumSetPtMgrs > 0) MZMinHumSetPtMgr.allocate(NumMZMinHumSetPtMgrs); // Input the data for each setpoint manager cCurrentModuleObject = "SetpointManager:MultiZone:Humidity:Minimum"; for (SetPtMgrNum = 1; SetPtMgrNum <= NumMZMinHumSetPtMgrs; ++SetPtMgrNum) { inputProcessor->getObjectItem(cCurrentModuleObject, SetPtMgrNum, cAlphaArgs, NumAlphas, rNumericArgs, NumNums, IOStat, lNumericFieldBlanks, lAlphaFieldBlanks, cAlphaFieldNames, cNumericFieldNames); UtilityRoutines::IsNameEmpty(cAlphaArgs(1), cCurrentModuleObject, ErrorsFound); MZMinHumSetPtMgr(SetPtMgrNum).Name = cAlphaArgs(1); MZMinHumSetPtMgr(SetPtMgrNum).AirLoopName = cAlphaArgs(2); MZMinHumSetPtMgr(SetPtMgrNum).AirLoopNum = 0; MZMinHumSetPtMgr(SetPtMgrNum).MinSetHum = rNumericArgs(1); MZMinHumSetPtMgr(SetPtMgrNum).MaxSetHum = rNumericArgs(2); MZMinHumSetPtMgr(SetPtMgrNum).CtrlVarType = "MinimumHumidityRatio"; MZMinHumSetPtMgr(SetPtMgrNum).CtrlTypeMode = iCtrlVarType_MinHumRat; if (MZMinHumSetPtMgr(SetPtMgrNum).MaxSetHum < MZMinHumSetPtMgr(SetPtMgrNum).MinSetHum) { ShowWarningError(RoutineName + cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\","); ShowContinueError("..." + cNumericFieldNames(2) + "=[" + RoundSigDigits(MZMinHumSetPtMgr(SetPtMgrNum).MaxSetHum, 3) + "] is less than " + cNumericFieldNames(1) + "=[" + RoundSigDigits(MZMinHumSetPtMgr(SetPtMgrNum).MinSetHum, 3) + "]."); } NodeListError = false; GetNodeNums(cAlphaArgs(3), NumNodes, NodeNums, NodeListError, NodeType_Air, cCurrentModuleObject, cAlphaArgs(1), NodeConnectionType_SetPoint, 1, ObjectIsNotParent, _, cAlphaFieldNames(3)); // setpoint nodes if (!NodeListError) { NumNodesCtrld = NumNodes; MZMinHumSetPtMgr(SetPtMgrNum).CtrlNodes.allocate(NumNodesCtrld); MZMinHumSetPtMgr(SetPtMgrNum).NumCtrlNodes = NumNodesCtrld; MZMinHumSetPtMgr(SetPtMgrNum).SetPt = 0.0; for (CtrldNodeNum = 1; CtrldNodeNum <= NumNodesCtrld; ++CtrldNodeNum) { MZMinHumSetPtMgr(SetPtMgrNum).CtrlNodes(CtrldNodeNum) = NodeNums(CtrldNodeNum); } } else { // CALL ShowSevereError(RoutineName//TRIM(cCurrentModuleObject)//'="'//TRIM(cAlphaArgs(1))// & // '", invalid field.') // Call ShowContinueError('..invalid '//TRIM(cAlphaFieldNames(3))//'="'//TRIM(cAlphaArgs(3))//'".') ErrorsFound = true; } AllSetPtMgrNum = SetPtMgrNum + NumSchSetPtMgrs + NumDualSchSetPtMgrs + NumOutAirSetPtMgrs + NumSZRhSetPtMgrs + NumSZHtSetPtMgrs + NumSZClSetPtMgrs + NumSZMinHumSetPtMgrs + NumSZMaxHumSetPtMgrs + NumMixedAirSetPtMgrs + NumOAPretreatSetPtMgrs + NumWarmestSetPtMgrs + NumColdestSetPtMgrs + NumWarmestSetPtMgrsTempFlow + NumRABFlowSetPtMgrs + NumMZClgAverageSetPtMgrs + NumMZHtgAverageSetPtMgrs + NumMZAverageMinHumSetPtMgrs + NumMZAverageMaxHumSetPtMgrs; if (!NodeListError) { AllSetPtMgr(AllSetPtMgrNum).CtrlNodes.allocate(NumNodesCtrld); AllSetPtMgr(AllSetPtMgrNum).CtrlNodes = MZMinHumSetPtMgr(SetPtMgrNum).CtrlNodes; } AllSetPtMgr(AllSetPtMgrNum).Name = MZMinHumSetPtMgr(SetPtMgrNum).Name; AllSetPtMgr(AllSetPtMgrNum).SPMType = iSPMType_MZMinHum; AllSetPtMgr(AllSetPtMgrNum).CtrlTypeMode = MZMinHumSetPtMgr(SetPtMgrNum).CtrlTypeMode; AllSetPtMgr(AllSetPtMgrNum).NumCtrlNodes = MZMinHumSetPtMgr(SetPtMgrNum).NumCtrlNodes; } // Input the Multizone Maximum Humidity Ratio SetPoint Managers if (NumMZMaxHumSetPtMgrs > 0) MZMaxHumSetPtMgr.allocate(NumMZMaxHumSetPtMgrs); // Input the data for each setpoint manager cCurrentModuleObject = "SetpointManager:MultiZone:Humidity:Maximum"; for (SetPtMgrNum = 1; SetPtMgrNum <= NumMZMaxHumSetPtMgrs; ++SetPtMgrNum) { inputProcessor->getObjectItem(cCurrentModuleObject, SetPtMgrNum, cAlphaArgs, NumAlphas, rNumericArgs, NumNums, IOStat, lNumericFieldBlanks, lAlphaFieldBlanks, cAlphaFieldNames, cNumericFieldNames); UtilityRoutines::IsNameEmpty(cAlphaArgs(1), cCurrentModuleObject, ErrorsFound); MZMaxHumSetPtMgr(SetPtMgrNum).Name = cAlphaArgs(1); MZMaxHumSetPtMgr(SetPtMgrNum).AirLoopName = cAlphaArgs(2); MZMaxHumSetPtMgr(SetPtMgrNum).AirLoopNum = 0; MZMaxHumSetPtMgr(SetPtMgrNum).MinSetHum = rNumericArgs(1); MZMaxHumSetPtMgr(SetPtMgrNum).MaxSetHum = rNumericArgs(2); MZMaxHumSetPtMgr(SetPtMgrNum).CtrlVarType = "MaximumHumidityRatio"; MZMaxHumSetPtMgr(SetPtMgrNum).CtrlTypeMode = iCtrlVarType_MaxHumRat; if (MZMaxHumSetPtMgr(SetPtMgrNum).MaxSetHum < MZMaxHumSetPtMgr(SetPtMgrNum).MinSetHum) { ShowWarningError(RoutineName + cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\","); ShowContinueError("..." + cNumericFieldNames(2) + "=[" + RoundSigDigits(MZMaxHumSetPtMgr(SetPtMgrNum).MaxSetHum, 3) + "] is less than " + cNumericFieldNames(1) + "=[" + RoundSigDigits(MZMaxHumSetPtMgr(SetPtMgrNum).MinSetHum, 3) + "]."); } NodeListError = false; GetNodeNums(cAlphaArgs(3), NumNodes, NodeNums, NodeListError, NodeType_Air, cCurrentModuleObject, cAlphaArgs(1), NodeConnectionType_SetPoint, 1, ObjectIsNotParent, _, cAlphaFieldNames(3)); // setpoint nodes if (!NodeListError) { NumNodesCtrld = NumNodes; MZMaxHumSetPtMgr(SetPtMgrNum).CtrlNodes.allocate(NumNodesCtrld); MZMaxHumSetPtMgr(SetPtMgrNum).NumCtrlNodes = NumNodesCtrld; MZMaxHumSetPtMgr(SetPtMgrNum).SetPt = 0.0; for (CtrldNodeNum = 1; CtrldNodeNum <= NumNodesCtrld; ++CtrldNodeNum) { MZMaxHumSetPtMgr(SetPtMgrNum).CtrlNodes(CtrldNodeNum) = NodeNums(CtrldNodeNum); } } else { // CALL ShowSevereError(RoutineName//TRIM(cCurrentModuleObject)//'="'//TRIM(cAlphaArgs(1))// & // '", invalid field.') // Call ShowContinueError('..invalid '//TRIM(cAlphaFieldNames(3))//'="'//TRIM(cAlphaArgs(3))//'".') ErrorsFound = true; } AllSetPtMgrNum = SetPtMgrNum + NumSchSetPtMgrs + NumDualSchSetPtMgrs + NumOutAirSetPtMgrs + NumSZRhSetPtMgrs + NumSZHtSetPtMgrs + NumSZClSetPtMgrs + NumSZMinHumSetPtMgrs + NumSZMaxHumSetPtMgrs + NumMixedAirSetPtMgrs + NumOAPretreatSetPtMgrs + NumWarmestSetPtMgrs + NumColdestSetPtMgrs + NumWarmestSetPtMgrsTempFlow + NumRABFlowSetPtMgrs + NumMZClgAverageSetPtMgrs + NumMZHtgAverageSetPtMgrs + NumMZAverageMinHumSetPtMgrs + NumMZAverageMaxHumSetPtMgrs + NumMZMinHumSetPtMgrs; if (!NodeListError) { AllSetPtMgr(AllSetPtMgrNum).CtrlNodes.allocate(NumNodesCtrld); AllSetPtMgr(AllSetPtMgrNum).CtrlNodes = MZMaxHumSetPtMgr(SetPtMgrNum).CtrlNodes; } AllSetPtMgr(AllSetPtMgrNum).Name = MZMaxHumSetPtMgr(SetPtMgrNum).Name; AllSetPtMgr(AllSetPtMgrNum).SPMType = iSPMType_MZMaxHum; AllSetPtMgr(AllSetPtMgrNum).CtrlTypeMode = MZMaxHumSetPtMgr(SetPtMgrNum).CtrlTypeMode; AllSetPtMgr(AllSetPtMgrNum).NumCtrlNodes = MZMaxHumSetPtMgr(SetPtMgrNum).NumCtrlNodes; } // Input the Follow Outdoor Air Temperature Setpoint Managers if (NumFollowOATempSetPtMgrs > 0) FollowOATempSetPtMgr.allocate(NumFollowOATempSetPtMgrs); // Input the data for each Setpoint Manager cCurrentModuleObject = "SetpointManager:FollowOutdoorAirTemperature"; for (SetPtMgrNum = 1; SetPtMgrNum <= NumFollowOATempSetPtMgrs; ++SetPtMgrNum) { inputProcessor->getObjectItem(cCurrentModuleObject, SetPtMgrNum, cAlphaArgs, NumAlphas, rNumericArgs, NumNums, IOStat, lNumericFieldBlanks, lAlphaFieldBlanks, cAlphaFieldNames, cNumericFieldNames); UtilityRoutines::IsNameEmpty(cAlphaArgs(1), cCurrentModuleObject, ErrorsFound); FollowOATempSetPtMgr(SetPtMgrNum).Name = cAlphaArgs(1); FollowOATempSetPtMgr(SetPtMgrNum).CtrlVarType = cAlphaArgs(2); if (UtilityRoutines::SameString(FollowOATempSetPtMgr(SetPtMgrNum).CtrlVarType, "Temperature")) { FollowOATempSetPtMgr(SetPtMgrNum).CtrlTypeMode = iCtrlVarType_Temp; } else if (UtilityRoutines::SameString(FollowOATempSetPtMgr(SetPtMgrNum).CtrlVarType, "MaximumTemperature")) { FollowOATempSetPtMgr(SetPtMgrNum).CtrlTypeMode = iCtrlVarType_MaxTemp; } else if (UtilityRoutines::SameString(FollowOATempSetPtMgr(SetPtMgrNum).CtrlVarType, "MinimumTemperature")) { FollowOATempSetPtMgr(SetPtMgrNum).CtrlTypeMode = iCtrlVarType_MinTemp; } else { // should not come here if idd type choice and key list is working ShowSevereError(RoutineName + cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\", invalid field."); ShowContinueError("..invalid " + cAlphaFieldNames(2) + "=\"" + cAlphaArgs(2) + "\"."); ShowContinueError("..Valid values are \"Temperature\",\"MaximumTemperature\" or \"MinimumTemperature\"."); ErrorsFound = true; } FollowOATempSetPtMgr(SetPtMgrNum).RefTempType = cAlphaArgs(3); if (UtilityRoutines::SameString(FollowOATempSetPtMgr(SetPtMgrNum).RefTempType, "OutdoorAirWetBulb")) { FollowOATempSetPtMgr(SetPtMgrNum).RefTypeMode = iRefTempType_WetBulb; } else if (UtilityRoutines::SameString(FollowOATempSetPtMgr(SetPtMgrNum).RefTempType, "OutdoorAirDryBulb")) { FollowOATempSetPtMgr(SetPtMgrNum).RefTypeMode = iRefTempType_DryBulb; } else { ShowSevereError(RoutineName + cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\", invalid field."); ShowContinueError("..invalid " + cAlphaFieldNames(3) + "=\"" + cAlphaArgs(3) + "\"."); ShowContinueError("..Valid values are \"OutdoorAirWetBulb\" or \"OutdoorAirDryBulb\"."); ErrorsFound = true; } FollowOATempSetPtMgr(SetPtMgrNum).Offset = rNumericArgs(1); FollowOATempSetPtMgr(SetPtMgrNum).MaxSetTemp = rNumericArgs(2); FollowOATempSetPtMgr(SetPtMgrNum).MinSetTemp = rNumericArgs(3); if (FollowOATempSetPtMgr(SetPtMgrNum).MaxSetTemp < FollowOATempSetPtMgr(SetPtMgrNum).MinSetTemp) { ShowWarningError(RoutineName + cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\","); ShowContinueError("..." + cNumericFieldNames(2) + "=[" + RoundSigDigits(FollowOATempSetPtMgr(SetPtMgrNum).MaxSetTemp, 1) + "] is less than " + cNumericFieldNames(3) + "=[" + RoundSigDigits(FollowOATempSetPtMgr(SetPtMgrNum).MinSetTemp, 1) + "]."); } NodeListError = false; GetNodeNums(cAlphaArgs(4), NumNodes, NodeNums, NodeListError, NodeType_Unknown, cCurrentModuleObject, cAlphaArgs(1), NodeConnectionType_SetPoint, 1, ObjectIsNotParent, _, cAlphaFieldNames(4)); // setpoint nodes if (!NodeListError) { NumNodesCtrld = NumNodes; FollowOATempSetPtMgr(SetPtMgrNum).CtrlNodes.allocate(NumNodesCtrld); FollowOATempSetPtMgr(SetPtMgrNum).NumCtrlNodes = NumNodesCtrld; FollowOATempSetPtMgr(SetPtMgrNum).SetPt = 0.0; for (CtrldNodeNum = 1; CtrldNodeNum <= NumNodesCtrld; ++CtrldNodeNum) { FollowOATempSetPtMgr(SetPtMgrNum).CtrlNodes(CtrldNodeNum) = NodeNums(CtrldNodeNum); } } else { // CALL ShowSevereError(RoutineName//TRIM(cCurrentModuleObject)//'="'//TRIM(cAlphaArgs(1))// & // '", invalid field.') // Call ShowContinueError('..invalid '//TRIM(cAlphaFieldNames(4))//'="'//TRIM(cAlphaArgs(4))//'".') ErrorsFound = true; } AllSetPtMgrNum = SetPtMgrNum + NumSchSetPtMgrs + NumDualSchSetPtMgrs + NumOutAirSetPtMgrs + NumSZRhSetPtMgrs + NumSZHtSetPtMgrs + NumSZClSetPtMgrs + NumSZMinHumSetPtMgrs + NumSZMaxHumSetPtMgrs + NumMixedAirSetPtMgrs + NumOAPretreatSetPtMgrs + NumWarmestSetPtMgrs + NumColdestSetPtMgrs + NumWarmestSetPtMgrsTempFlow + NumRABFlowSetPtMgrs + NumMZClgAverageSetPtMgrs + NumMZHtgAverageSetPtMgrs + NumMZAverageMinHumSetPtMgrs + NumMZAverageMaxHumSetPtMgrs + NumMZMinHumSetPtMgrs + NumMZMaxHumSetPtMgrs; if (!NodeListError) { AllSetPtMgr(AllSetPtMgrNum).CtrlNodes.allocate(NumNodesCtrld); AllSetPtMgr(AllSetPtMgrNum).CtrlNodes = FollowOATempSetPtMgr(SetPtMgrNum).CtrlNodes; } AllSetPtMgr(AllSetPtMgrNum).Name = FollowOATempSetPtMgr(SetPtMgrNum).Name; AllSetPtMgr(AllSetPtMgrNum).SPMType = iSPMType_FollowOATemp; AllSetPtMgr(AllSetPtMgrNum).CtrlTypeMode = FollowOATempSetPtMgr(SetPtMgrNum).CtrlTypeMode; AllSetPtMgr(AllSetPtMgrNum).NumCtrlNodes = FollowOATempSetPtMgr(SetPtMgrNum).NumCtrlNodes; } // Input the Follow System Node Temperature Setpoint Managers if (NumFollowSysNodeTempSetPtMgrs > 0) FollowSysNodeTempSetPtMgr.allocate(NumFollowSysNodeTempSetPtMgrs); // Input the data for each Setpoint Manager cCurrentModuleObject = "SetpointManager:FollowSystemNodeTemperature"; for (SetPtMgrNum = 1; SetPtMgrNum <= NumFollowSysNodeTempSetPtMgrs; ++SetPtMgrNum) { inputProcessor->getObjectItem(cCurrentModuleObject, SetPtMgrNum, cAlphaArgs, NumAlphas, rNumericArgs, NumNums, IOStat, lNumericFieldBlanks, lAlphaFieldBlanks, cAlphaFieldNames, cNumericFieldNames); UtilityRoutines::IsNameEmpty(cAlphaArgs(1), cCurrentModuleObject, ErrorsFound); FollowSysNodeTempSetPtMgr(SetPtMgrNum).Name = cAlphaArgs(1); FollowSysNodeTempSetPtMgr(SetPtMgrNum).CtrlVarType = cAlphaArgs(2); if (UtilityRoutines::SameString(FollowSysNodeTempSetPtMgr(SetPtMgrNum).CtrlVarType, "Temperature")) { FollowSysNodeTempSetPtMgr(SetPtMgrNum).CtrlTypeMode = iCtrlVarType_Temp; } else if (UtilityRoutines::SameString(FollowSysNodeTempSetPtMgr(SetPtMgrNum).CtrlVarType, "MaximumTemperature")) { FollowSysNodeTempSetPtMgr(SetPtMgrNum).CtrlTypeMode = iCtrlVarType_MaxTemp; } else if (UtilityRoutines::SameString(FollowSysNodeTempSetPtMgr(SetPtMgrNum).CtrlVarType, "MinimumTemperature")) { FollowSysNodeTempSetPtMgr(SetPtMgrNum).CtrlTypeMode = iCtrlVarType_MinTemp; } else { // should not come here if idd type choice and key list is working ShowSevereError(RoutineName + cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\", invalid field."); ShowContinueError("..invalid " + cAlphaFieldNames(2) + "=\"" + cAlphaArgs(2) + "\"."); ShowContinueError("..Valid values are \"Temperature\",\"MaximumTemperature\" or \"MinimumTemperature\"."); ErrorsFound = true; } FollowSysNodeTempSetPtMgr(SetPtMgrNum).RefNodeNum = GetOnlySingleNode( cAlphaArgs(3), ErrorsFound, cCurrentModuleObject, cAlphaArgs(1), NodeType_Unknown, NodeConnectionType_Sensor, 1, ObjectIsNotParent); FollowSysNodeTempSetPtMgr(SetPtMgrNum).RefTempType = cAlphaArgs(4); if (UtilityRoutines::SameString(FollowSysNodeTempSetPtMgr(SetPtMgrNum).RefTempType, "NodeWetBulb")) { FollowSysNodeTempSetPtMgr(SetPtMgrNum).RefTypeMode = iRefTempType_WetBulb; } else if (UtilityRoutines::SameString(FollowSysNodeTempSetPtMgr(SetPtMgrNum).RefTempType, "NodeDryBulb")) { FollowSysNodeTempSetPtMgr(SetPtMgrNum).RefTypeMode = iRefTempType_DryBulb; } else { // should not come here if idd type choice and key list is working ShowSevereError(RoutineName + cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\", invalid field."); ShowContinueError("..invalid " + cAlphaFieldNames(3) + "=\"" + cAlphaArgs(3) + "\"."); ShowContinueError("..Valid values are \"NodeWetBulb\" or \"NodeDryBulb\"."); ErrorsFound = true; } FollowSysNodeTempSetPtMgr(SetPtMgrNum).Offset = rNumericArgs(1); FollowSysNodeTempSetPtMgr(SetPtMgrNum).MaxSetTemp = rNumericArgs(2); FollowSysNodeTempSetPtMgr(SetPtMgrNum).MinSetTemp = rNumericArgs(3); if (FollowSysNodeTempSetPtMgr(SetPtMgrNum).MaxSetTemp < FollowSysNodeTempSetPtMgr(SetPtMgrNum).MinSetTemp) { ShowWarningError(RoutineName + cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\","); ShowContinueError("..." + cNumericFieldNames(2) + "=[" + RoundSigDigits(FollowSysNodeTempSetPtMgr(SetPtMgrNum).MaxSetTemp, 1) + "] is less than " + cNumericFieldNames(3) + "=[" + RoundSigDigits(FollowSysNodeTempSetPtMgr(SetPtMgrNum).MinSetTemp, 1) + "]."); } NodeListError = false; GetNodeNums(cAlphaArgs(5), NumNodes, NodeNums, NodeListError, NodeType_Unknown, cCurrentModuleObject, cAlphaArgs(1), NodeConnectionType_SetPoint, 1, ObjectIsNotParent, _, cAlphaFieldNames(5)); // setpoint nodes if (!NodeListError) { NumNodesCtrld = NumNodes; FollowSysNodeTempSetPtMgr(SetPtMgrNum).CtrlNodes.allocate(NumNodesCtrld); FollowSysNodeTempSetPtMgr(SetPtMgrNum).NumCtrlNodes = NumNodesCtrld; FollowSysNodeTempSetPtMgr(SetPtMgrNum).SetPt = 0.0; for (CtrldNodeNum = 1; CtrldNodeNum <= NumNodesCtrld; ++CtrldNodeNum) { FollowSysNodeTempSetPtMgr(SetPtMgrNum).CtrlNodes(CtrldNodeNum) = NodeNums(CtrldNodeNum); } } else { // CALL ShowSevereError(RoutineName//TRIM(cCurrentModuleObject)//'="'//TRIM(cAlphaArgs(1))// & // '", invalid field.') // Call ShowContinueError('..invalid '//TRIM(cAlphaFieldNames(4))//'="'//TRIM(cAlphaArgs(4))//'".') ErrorsFound = true; } AllSetPtMgrNum = SetPtMgrNum + NumSchSetPtMgrs + NumDualSchSetPtMgrs + NumOutAirSetPtMgrs + NumSZRhSetPtMgrs + NumSZHtSetPtMgrs + NumSZClSetPtMgrs + NumSZMinHumSetPtMgrs + NumSZMaxHumSetPtMgrs + NumMixedAirSetPtMgrs + NumOAPretreatSetPtMgrs + NumWarmestSetPtMgrs + NumColdestSetPtMgrs + NumWarmestSetPtMgrsTempFlow + NumRABFlowSetPtMgrs + NumMZClgAverageSetPtMgrs + NumMZHtgAverageSetPtMgrs + NumMZAverageMinHumSetPtMgrs + NumMZAverageMaxHumSetPtMgrs + NumMZMinHumSetPtMgrs + NumMZMaxHumSetPtMgrs + NumFollowOATempSetPtMgrs; if (!NodeListError) { AllSetPtMgr(AllSetPtMgrNum).CtrlNodes.allocate(NumNodesCtrld); AllSetPtMgr(AllSetPtMgrNum).CtrlNodes = FollowSysNodeTempSetPtMgr(SetPtMgrNum).CtrlNodes; } AllSetPtMgr(AllSetPtMgrNum).Name = FollowSysNodeTempSetPtMgr(SetPtMgrNum).Name; AllSetPtMgr(AllSetPtMgrNum).SPMType = iSPMType_FollowSysNodeTemp; AllSetPtMgr(AllSetPtMgrNum).CtrlTypeMode = FollowSysNodeTempSetPtMgr(SetPtMgrNum).CtrlTypeMode; AllSetPtMgr(AllSetPtMgrNum).NumCtrlNodes = FollowSysNodeTempSetPtMgr(SetPtMgrNum).NumCtrlNodes; } // Input the Ground Temperature Setpoint Managers if (NumGroundTempSetPtMgrs > 0) GroundTempSetPtMgr.allocate(NumGroundTempSetPtMgrs); // Input the data for each Setpoint Manager cCurrentModuleObject = "SetpointManager:FollowGroundTemperature"; for (SetPtMgrNum = 1; SetPtMgrNum <= NumGroundTempSetPtMgrs; ++SetPtMgrNum) { inputProcessor->getObjectItem(cCurrentModuleObject, SetPtMgrNum, cAlphaArgs, NumAlphas, rNumericArgs, NumNums, IOStat, lNumericFieldBlanks, lAlphaFieldBlanks, cAlphaFieldNames, cNumericFieldNames); UtilityRoutines::IsNameEmpty(cAlphaArgs(1), cCurrentModuleObject, ErrorsFound); GroundTempSetPtMgr(SetPtMgrNum).Name = cAlphaArgs(1); GroundTempSetPtMgr(SetPtMgrNum).CtrlVarType = cAlphaArgs(2); if (UtilityRoutines::SameString(GroundTempSetPtMgr(SetPtMgrNum).CtrlVarType, "Temperature")) { GroundTempSetPtMgr(SetPtMgrNum).CtrlTypeMode = iCtrlVarType_Temp; } else if (UtilityRoutines::SameString(GroundTempSetPtMgr(SetPtMgrNum).CtrlVarType, "MaximumTemperature")) { GroundTempSetPtMgr(SetPtMgrNum).CtrlTypeMode = iCtrlVarType_MaxTemp; } else if (UtilityRoutines::SameString(GroundTempSetPtMgr(SetPtMgrNum).CtrlVarType, "MinimumTemperature")) { GroundTempSetPtMgr(SetPtMgrNum).CtrlTypeMode = iCtrlVarType_MinTemp; } else { // should not come here if idd type choice and key list is working ShowSevereError(RoutineName + cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\", invalid field."); ShowContinueError("..invalid " + cAlphaFieldNames(2) + "=\"" + cAlphaArgs(2) + "\"."); ShowContinueError("..Valid values are \"Temperature\",\"MaximumTemperature\" or \"MinimumTemperature\"."); ErrorsFound = true; } GroundTempSetPtMgr(SetPtMgrNum).RefGroundTempObjType = cAlphaArgs(3); if (UtilityRoutines::SameString(GroundTempSetPtMgr(SetPtMgrNum).RefGroundTempObjType, "Site:GroundTemperature:BuildingSurface")) { GroundTempSetPtMgr(SetPtMgrNum).RefTypeMode = iRefGroundTempObjType_BuildingSurface; if (NoSurfaceGroundTempObjWarning) { if (!GroundTempObjInput) { ShowWarningError(RoutineName + cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\" requires \"Site:GroundTemperature:BuildingSurface\" in the input."); ShowContinueError("Defaults, constant throughout the year of (" + RoundSigDigits(GroundTemp, 1) + ") will be used."); } NoSurfaceGroundTempObjWarning = false; } } else if (UtilityRoutines::SameString(GroundTempSetPtMgr(SetPtMgrNum).RefGroundTempObjType, "Site:GroundTemperature:Shallow")) { GroundTempSetPtMgr(SetPtMgrNum).RefTypeMode = iRefGroundTempObjType_Shallow; if (NoShallowGroundTempObjWarning) { if (!GroundTemp_SurfaceObjInput) { ShowWarningError(RoutineName + cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\" requires \"Site:GroundTemperature:Shallow\" in the input."); ShowContinueError("Defaults, constant throughout the year of (" + RoundSigDigits(GroundTemp_Surface, 1) + ") will be used."); } NoShallowGroundTempObjWarning = false; } } else if (UtilityRoutines::SameString(GroundTempSetPtMgr(SetPtMgrNum).RefGroundTempObjType, "Site:GroundTemperature:Deep")) { GroundTempSetPtMgr(SetPtMgrNum).RefTypeMode = iRefGroundTempObjType_Deep; if (NoDeepGroundTempObjWarning) { if (!GroundTemp_DeepObjInput) { ShowWarningError(RoutineName + cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\" requires \"Site:GroundTemperature:Deep\" in the input."); ShowContinueError("Defaults, constant throughout the year of (" + RoundSigDigits(GroundTemp_Deep, 1) + ") will be used."); } NoDeepGroundTempObjWarning = false; } } else if (UtilityRoutines::SameString(GroundTempSetPtMgr(SetPtMgrNum).RefGroundTempObjType, "Site:GroundTemperature:FCfactorMethod")) { GroundTempSetPtMgr(SetPtMgrNum).RefTypeMode = iRefGroundTempObjType_FCfactorMethod; if (NoFCGroundTempObjWarning) { if (!FCGroundTemps) { ShowWarningError(RoutineName + cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\" requires \"Site:GroundTemperature:FCfactorMethod\" in the input."); ShowContinueError("Defaults, constant throughout the year of (" + RoundSigDigits(GroundTempFC, 1) + ") will be used."); } NoFCGroundTempObjWarning = false; } } else { // should not come here if idd type choice and key list is working ShowSevereError(RoutineName + cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\", invalid field."); ShowContinueError("..invalid " + cAlphaFieldNames(3) + "=\"" + cAlphaArgs(3) + "\"."); ShowContinueError("..Valid values are \"Site:GroundTemperature:BuildingSurface\", \"Site:GroundTemperature:Shallow\","); ShowContinueError(" \"Site:GroundTemperature:Deep\" or \"Site:GroundTemperature:FCfactorMethod\"."); ErrorsFound = true; } GroundTempSetPtMgr(SetPtMgrNum).Offset = rNumericArgs(1); GroundTempSetPtMgr(SetPtMgrNum).MaxSetTemp = rNumericArgs(2); GroundTempSetPtMgr(SetPtMgrNum).MinSetTemp = rNumericArgs(3); if (GroundTempSetPtMgr(SetPtMgrNum).MaxSetTemp < GroundTempSetPtMgr(SetPtMgrNum).MinSetTemp) { ShowWarningError(RoutineName + cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\","); ShowContinueError("..." + cNumericFieldNames(2) + "=[" + RoundSigDigits(GroundTempSetPtMgr(SetPtMgrNum).MaxSetTemp, 1) + "] is less than " + cNumericFieldNames(3) + "=[" + RoundSigDigits(GroundTempSetPtMgr(SetPtMgrNum).MinSetTemp, 1) + "]."); } NodeListError = false; GetNodeNums(cAlphaArgs(4), NumNodes, NodeNums, NodeListError, NodeType_Unknown, cCurrentModuleObject, cAlphaArgs(1), NodeConnectionType_SetPoint, 1, ObjectIsNotParent, _, cAlphaFieldNames(4)); // setpoint nodes if (!NodeListError) { NumNodesCtrld = NumNodes; GroundTempSetPtMgr(SetPtMgrNum).CtrlNodes.allocate(NumNodesCtrld); GroundTempSetPtMgr(SetPtMgrNum).NumCtrlNodes = NumNodesCtrld; GroundTempSetPtMgr(SetPtMgrNum).SetPt = 0.0; for (CtrldNodeNum = 1; CtrldNodeNum <= NumNodesCtrld; ++CtrldNodeNum) { GroundTempSetPtMgr(SetPtMgrNum).CtrlNodes(CtrldNodeNum) = NodeNums(CtrldNodeNum); } } else { // CALL ShowSevereError(RoutineName//TRIM(cCurrentModuleObject)//'="'//TRIM(cAlphaArgs(1))// & // '", invalid field.') // Call ShowContinueError('..invalid '//TRIM(cAlphaFieldNames(4))//'="'//TRIM(cAlphaArgs(4))//'".') ErrorsFound = true; } AllSetPtMgrNum = SetPtMgrNum + NumSchSetPtMgrs + NumDualSchSetPtMgrs + NumOutAirSetPtMgrs + NumSZRhSetPtMgrs + NumSZHtSetPtMgrs + NumSZClSetPtMgrs + NumSZMinHumSetPtMgrs + NumSZMaxHumSetPtMgrs + NumMixedAirSetPtMgrs + NumOAPretreatSetPtMgrs + NumWarmestSetPtMgrs + NumColdestSetPtMgrs + NumWarmestSetPtMgrsTempFlow + NumRABFlowSetPtMgrs + NumMZClgAverageSetPtMgrs + NumMZHtgAverageSetPtMgrs + NumMZAverageMinHumSetPtMgrs + NumMZAverageMaxHumSetPtMgrs + NumMZMinHumSetPtMgrs + NumMZMaxHumSetPtMgrs + NumFollowOATempSetPtMgrs + NumFollowSysNodeTempSetPtMgrs; if (!NodeListError) { AllSetPtMgr(AllSetPtMgrNum).CtrlNodes.allocate(NumNodesCtrld); AllSetPtMgr(AllSetPtMgrNum).CtrlNodes = GroundTempSetPtMgr(SetPtMgrNum).CtrlNodes; } AllSetPtMgr(AllSetPtMgrNum).Name = GroundTempSetPtMgr(SetPtMgrNum).Name; AllSetPtMgr(AllSetPtMgrNum).SPMType = iSPMType_GroundTemp; AllSetPtMgr(AllSetPtMgrNum).CtrlTypeMode = GroundTempSetPtMgr(SetPtMgrNum).CtrlTypeMode; AllSetPtMgr(AllSetPtMgrNum).NumCtrlNodes = GroundTempSetPtMgr(SetPtMgrNum).NumCtrlNodes; } for (SetPtMgrNum = 1; SetPtMgrNum <= NumWarmestSetPtMgrsTempFlow; ++SetPtMgrNum) { SetupOutputVariable("Setpoint Manager Warmest Temperature Critical Zone Number", OutputProcessor::Unit::None, WarmestSetPtMgrTempFlow(SetPtMgrNum).CritZoneNum, "System", "Average", WarmestSetPtMgrTempFlow(SetPtMgrNum).Name); SetupOutputVariable("Setpoint Manager Warmest Temperature Turndown Flow Fraction", OutputProcessor::Unit::None, WarmestSetPtMgrTempFlow(SetPtMgrNum).Turndown, "System", "Average", WarmestSetPtMgrTempFlow(SetPtMgrNum).Name); } // Input the Condenser Entering Set Point Managers if (NumCondEntSetPtMgrs > 0) CondEntSetPtMgr.allocate(NumCondEntSetPtMgrs); // Allocate the Set Point Manager input data array // Input the data for each Set Point Manager cCurrentModuleObject = "SetpointManager:CondenserEnteringReset"; for (SetPtMgrNum = 1; SetPtMgrNum <= NumCondEntSetPtMgrs; ++SetPtMgrNum) { inputProcessor->getObjectItem(cCurrentModuleObject, SetPtMgrNum, cAlphaArgs, NumAlphas, rNumericArgs, NumNums, IOStat, lNumericFieldBlanks, lAlphaFieldBlanks, cAlphaFieldNames, cNumericFieldNames); UtilityRoutines::IsNameEmpty(cAlphaArgs(1), cCurrentModuleObject, ErrorsFound); CondEntSetPtMgr(SetPtMgrNum).Name = cAlphaArgs(1); CondEntSetPtMgr(SetPtMgrNum).CtrlVarType = cAlphaArgs(2); if (UtilityRoutines::SameString(CondEntSetPtMgr(SetPtMgrNum).CtrlVarType, "Temperature")) { CondEntSetPtMgr(SetPtMgrNum).CtrlTypeMode = iCtrlVarType_Temp; } else { // should not come here if idd type choice and key list is working ShowSevereError(" found invalid control type of " + cAlphaArgs(2) + " in " + cCurrentModuleObject + " = " + cAlphaArgs(1)); ErrorsFound = true; } CondEntSetPtMgr(SetPtMgrNum).CondEntTempSched = cAlphaArgs(3); CondEntSetPtMgr(SetPtMgrNum).CondEntTempSchedPtr = GetScheduleIndex(cAlphaArgs(3)); CondEntSetPtMgr(SetPtMgrNum).MinTwrWbCurve = GetCurveIndex(cAlphaArgs(4)); CondEntSetPtMgr(SetPtMgrNum).MinOaWbCurve = GetCurveIndex(cAlphaArgs(5)); CondEntSetPtMgr(SetPtMgrNum).OptCondEntCurve = GetCurveIndex(cAlphaArgs(6)); CondEntSetPtMgr(SetPtMgrNum).MinimumLiftTD = rNumericArgs(1); CondEntSetPtMgr(SetPtMgrNum).MaxCondEntTemp = rNumericArgs(2); CondEntSetPtMgr(SetPtMgrNum).TowerDsnInletAirWetBulb = rNumericArgs(3); CondEntSetPtMgr(SetPtMgrNum).CtrlNodeListName = cAlphaArgs(7); if (CondEntSetPtMgr(SetPtMgrNum).MaxCondEntTemp < CondEntSetPtMgr(SetPtMgrNum).TowerDsnInletAirWetBulb) { ShowWarningError(RoutineName + cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\","); ShowContinueError("..." + cNumericFieldNames(2) + "=[" + RoundSigDigits(CondEntSetPtMgr(SetPtMgrNum).MaxCondEntTemp, 1) + "] is less than " + cNumericFieldNames(1) + "=[" + RoundSigDigits(CondEntSetPtMgr(SetPtMgrNum).TowerDsnInletAirWetBulb, 1) + "]."); } NodeListError = false; GetNodeNums(CondEntSetPtMgr(SetPtMgrNum).CtrlNodeListName, NumNodes, NodeNums, NodeListError, NodeType_Unknown, cCurrentModuleObject, cAlphaArgs(1), NodeConnectionType_SetPoint, 1, ObjectIsNotParent, _, cAlphaFieldNames(7)); if (!NodeListError) { NumNodesCtrld = NumNodes; CondEntSetPtMgr(SetPtMgrNum).CtrlNodes.allocate(NumNodesCtrld); CondEntSetPtMgr(SetPtMgrNum).NumCtrlNodes = NumNodesCtrld; CondEntSetPtMgr(SetPtMgrNum).SetPt = 0.0; for (CtrldNodeNum = 1; CtrldNodeNum <= NumNodesCtrld; ++CtrldNodeNum) { CondEntSetPtMgr(SetPtMgrNum).CtrlNodes(CtrldNodeNum) = NodeNums(CtrldNodeNum); } } else { // CALL ShowContinueError('Invalid '//TRIM(cAlphaFieldNames(3))//' in '//TRIM(cCurrentModuleObject)//' = '// & // TRIM(CondEntSetPtMgr(SetPtMgrNum)%Name)) ErrorsFound = true; } AllSetPtMgrNum = SetPtMgrNum + NumSchSetPtMgrs + NumDualSchSetPtMgrs + NumOutAirSetPtMgrs + NumSZRhSetPtMgrs + NumSZHtSetPtMgrs + NumSZClSetPtMgrs + NumSZMinHumSetPtMgrs + NumSZMaxHumSetPtMgrs + NumMixedAirSetPtMgrs + NumOAPretreatSetPtMgrs + NumWarmestSetPtMgrs + NumColdestSetPtMgrs + NumWarmestSetPtMgrsTempFlow + NumRABFlowSetPtMgrs + NumMZClgAverageSetPtMgrs + NumMZHtgAverageSetPtMgrs + NumMZAverageMinHumSetPtMgrs + NumMZAverageMaxHumSetPtMgrs + NumMZMinHumSetPtMgrs + NumMZMaxHumSetPtMgrs + NumFollowOATempSetPtMgrs + NumFollowSysNodeTempSetPtMgrs + NumGroundTempSetPtMgrs; if (!NodeListError) { AllSetPtMgr(AllSetPtMgrNum).CtrlNodes.allocate(NumNodesCtrld); AllSetPtMgr(AllSetPtMgrNum).CtrlNodes = CondEntSetPtMgr(SetPtMgrNum).CtrlNodes; } AllSetPtMgr(AllSetPtMgrNum).Name = CondEntSetPtMgr(SetPtMgrNum).Name; AllSetPtMgr(AllSetPtMgrNum).SPMType = iSPMType_CondEntReset; AllSetPtMgr(AllSetPtMgrNum).CtrlTypeMode = CondEntSetPtMgr(SetPtMgrNum).CtrlTypeMode; AllSetPtMgr(AllSetPtMgrNum).NumCtrlNodes = CondEntSetPtMgr(SetPtMgrNum).NumCtrlNodes; } // Input the Ideal Condenser Entering Set Point Managers // Allocate the Set Point Manager input data array if (NumIdealCondEntSetPtMgrs > 0) IdealCondEntSetPtMgr.allocate(NumIdealCondEntSetPtMgrs); // Input the data for each Set Point Manager cCurrentModuleObject = "SetpointManager:CondenserEnteringReset:Ideal"; for (SetPtMgrNum = 1; SetPtMgrNum <= NumIdealCondEntSetPtMgrs; ++SetPtMgrNum) { inputProcessor->getObjectItem(cCurrentModuleObject, SetPtMgrNum, cAlphaArgs, NumAlphas, rNumericArgs, NumNums, IOStat, lNumericFieldBlanks, lAlphaFieldBlanks, cAlphaFieldNames, cNumericFieldNames); UtilityRoutines::IsNameEmpty(cAlphaArgs(1), cCurrentModuleObject, ErrorsFound); IdealCondEntSetPtMgr(SetPtMgrNum).Name = cAlphaArgs(1); IdealCondEntSetPtMgr(SetPtMgrNum).CtrlVarType = cAlphaArgs(2); if (UtilityRoutines::SameString(IdealCondEntSetPtMgr(SetPtMgrNum).CtrlVarType, "Temperature")) { IdealCondEntSetPtMgr(SetPtMgrNum).CtrlTypeMode = iCtrlVarType_Temp; } else { ShowSevereError(" found invalid control type of " + cAlphaArgs(2) + " in " + cCurrentModuleObject + " = " + cAlphaArgs(1)); ErrorsFound = true; } IdealCondEntSetPtMgr(SetPtMgrNum).MinimumLiftTD = rNumericArgs(1); IdealCondEntSetPtMgr(SetPtMgrNum).MaxCondEntTemp = rNumericArgs(2); IdealCondEntSetPtMgr(SetPtMgrNum).CtrlNodeListName = cAlphaArgs(3); NodeListError = false; GetNodeNums(IdealCondEntSetPtMgr(SetPtMgrNum).CtrlNodeListName, NumNodes, NodeNums, NodeListError, NodeType_Unknown, cCurrentModuleObject, cAlphaArgs(1), NodeConnectionType_SetPoint, 1, ObjectIsNotParent, _, cAlphaFieldNames(3)); if (!NodeListError) { NumNodesCtrld = NumNodes; IdealCondEntSetPtMgr(SetPtMgrNum).CtrlNodes.allocate(NumNodesCtrld); IdealCondEntSetPtMgr(SetPtMgrNum).NumCtrlNodes = NumNodesCtrld; IdealCondEntSetPtMgr(SetPtMgrNum).SetPt = 0.0; for (CtrldNodeNum = 1; CtrldNodeNum <= NumNodesCtrld; ++CtrldNodeNum) { IdealCondEntSetPtMgr(SetPtMgrNum).CtrlNodes(CtrldNodeNum) = NodeNums(CtrldNodeNum); } } else { // CALL ShowContinueError('Invalid '//TRIM(cAlphaFieldNames(3))//' in '//TRIM(cCurrentModuleObject)//' = '// & // TRIM(IdealCondEntSetPtMgr(SetPtMgrNum)%Name)) ErrorsFound = true; } AllSetPtMgrNum = SetPtMgrNum + NumSchSetPtMgrs + NumDualSchSetPtMgrs + NumOutAirSetPtMgrs + NumSZRhSetPtMgrs + NumSZHtSetPtMgrs + NumSZClSetPtMgrs + NumSZMinHumSetPtMgrs + NumSZMaxHumSetPtMgrs + NumMixedAirSetPtMgrs + NumOAPretreatSetPtMgrs + NumWarmestSetPtMgrs + NumColdestSetPtMgrs + NumWarmestSetPtMgrsTempFlow + NumRABFlowSetPtMgrs + NumMZClgAverageSetPtMgrs + NumMZHtgAverageSetPtMgrs + NumMZAverageMinHumSetPtMgrs + NumMZAverageMaxHumSetPtMgrs + NumMZMinHumSetPtMgrs + NumMZMaxHumSetPtMgrs + NumFollowOATempSetPtMgrs + NumFollowSysNodeTempSetPtMgrs + NumGroundTempSetPtMgrs + NumCondEntSetPtMgrs; if (!NodeListError) { AllSetPtMgr(AllSetPtMgrNum).CtrlNodes.allocate(NumNodesCtrld); AllSetPtMgr(AllSetPtMgrNum).CtrlNodes = IdealCondEntSetPtMgr(SetPtMgrNum).CtrlNodes; } AllSetPtMgr(AllSetPtMgrNum).Name = IdealCondEntSetPtMgr(SetPtMgrNum).Name; AllSetPtMgr(AllSetPtMgrNum).SPMType = iSPMType_IdealCondEntReset; AllSetPtMgr(AllSetPtMgrNum).CtrlTypeMode = IdealCondEntSetPtMgr(SetPtMgrNum).CtrlTypeMode; AllSetPtMgr(AllSetPtMgrNum).NumCtrlNodes = IdealCondEntSetPtMgr(SetPtMgrNum).NumCtrlNodes; } if (NumSZOneStageCoolingSetPtMgrs > 0) SZOneStageCoolingSetPtMgr.allocate(NumSZOneStageCoolingSetPtMgrs); cCurrentModuleObject = "SetpointManager:SingleZone:OneStageCooling"; for (SetPtMgrNum = 1; SetPtMgrNum <= NumSZOneStageCoolingSetPtMgrs; ++SetPtMgrNum) { inputProcessor->getObjectItem(cCurrentModuleObject, SetPtMgrNum, cAlphaArgs, NumAlphas, rNumericArgs, NumNums, IOStat, lNumericFieldBlanks, lAlphaFieldBlanks, cAlphaFieldNames, cNumericFieldNames); UtilityRoutines::IsNameEmpty(cAlphaArgs(1), cCurrentModuleObject, ErrorsFound); SZOneStageCoolingSetPtMgr(SetPtMgrNum).Name = cAlphaArgs(1); SZOneStageCoolingSetPtMgr(SetPtMgrNum).CtrlVarType = "Temperature"; SZOneStageCoolingSetPtMgr(SetPtMgrNum).CtrlTypeMode = iCtrlVarType_Temp; SZOneStageCoolingSetPtMgr(SetPtMgrNum).CoolingOnTemp = rNumericArgs(1); SZOneStageCoolingSetPtMgr(SetPtMgrNum).CoolingOffTemp = rNumericArgs(2); if (SZOneStageCoolingSetPtMgr(SetPtMgrNum).CoolingOffTemp < SZOneStageCoolingSetPtMgr(SetPtMgrNum).CoolingOnTemp) { // throw warning, off must be warmer than on ShowWarningError(RoutineName + cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\","); ShowContinueError("..." + cNumericFieldNames(2) + "=[" + RoundSigDigits(SZOneStageCoolingSetPtMgr(SetPtMgrNum).CoolingOffTemp, 1) + "] is less than " + cNumericFieldNames(1) + "=[" + RoundSigDigits(SZOneStageCoolingSetPtMgr(SetPtMgrNum).CoolingOnTemp, 1) + "]."); } SZOneStageCoolingSetPtMgr(SetPtMgrNum).ControlZoneName = cAlphaArgs(2); SZOneStageCoolingSetPtMgr(SetPtMgrNum).ZoneNodeNum = GetSystemNodeNumberForZone(cAlphaArgs(2)); // get the actual zone number of the control zone SZOneStageCoolingSetPtMgr(SetPtMgrNum).ControlZoneNum = UtilityRoutines::FindItemInList(cAlphaArgs(2), Zone); if (SZOneStageCoolingSetPtMgr(SetPtMgrNum).ControlZoneNum == 0) { ShowSevereError(RoutineName + cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\", invalid field."); ShowContinueError("..invalid " + cAlphaFieldNames(2) + "=\"" + cAlphaArgs(2) + "\"."); ErrorsFound = true; } else { if (allocated(StageZoneLogic)) { if (!StageZoneLogic(SZOneStageCoolingSetPtMgr(SetPtMgrNum).ControlZoneNum)) { ShowSevereError(RoutineName + cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\", invalid field."); ShowContinueError("..invalid " + cAlphaFieldNames(2) + "=\"" + cAlphaArgs(2) + "\"."); ShowContinueError("Zone thermostat must use ZoneControl:Thermostat:StagedDualSetpoint."); ErrorsFound = true; } } } NodeListError = false; GetNodeNums(cAlphaArgs(3), NumNodes, NodeNums, NodeListError, NodeType_Unknown, cCurrentModuleObject, cAlphaArgs(1), NodeConnectionType_SetPoint, 1, ObjectIsNotParent, _, cAlphaFieldNames(3)); // setpoint nodes if (!NodeListError) { NumNodesCtrld = NumNodes; SZOneStageCoolingSetPtMgr(SetPtMgrNum).CtrlNodes.allocate(NumNodesCtrld); SZOneStageCoolingSetPtMgr(SetPtMgrNum).NumCtrlNodes = NumNodesCtrld; SZOneStageCoolingSetPtMgr(SetPtMgrNum).SetPt = 0.0; for (CtrldNodeNum = 1; CtrldNodeNum <= NumNodesCtrld; ++CtrldNodeNum) { SZOneStageCoolingSetPtMgr(SetPtMgrNum).CtrlNodes(CtrldNodeNum) = NodeNums(CtrldNodeNum); } } else { ErrorsFound = true; } AllSetPtMgrNum = SetPtMgrNum + NumSchSetPtMgrs + NumDualSchSetPtMgrs + NumOutAirSetPtMgrs + NumSZRhSetPtMgrs + NumSZHtSetPtMgrs + NumSZClSetPtMgrs + NumSZMinHumSetPtMgrs + NumSZMaxHumSetPtMgrs + NumMixedAirSetPtMgrs + NumOAPretreatSetPtMgrs + NumWarmestSetPtMgrs + NumColdestSetPtMgrs + NumWarmestSetPtMgrsTempFlow + NumRABFlowSetPtMgrs + NumMZClgAverageSetPtMgrs + NumMZHtgAverageSetPtMgrs + NumMZAverageMinHumSetPtMgrs + NumMZAverageMaxHumSetPtMgrs + NumMZMinHumSetPtMgrs + NumMZMaxHumSetPtMgrs + NumFollowOATempSetPtMgrs + NumFollowSysNodeTempSetPtMgrs + NumGroundTempSetPtMgrs + NumCondEntSetPtMgrs + NumIdealCondEntSetPtMgrs; if (!NodeListError) { AllSetPtMgr(AllSetPtMgrNum).CtrlNodes.allocate(NumNodesCtrld); AllSetPtMgr(AllSetPtMgrNum).CtrlNodes = SZOneStageCoolingSetPtMgr(SetPtMgrNum).CtrlNodes; } AllSetPtMgr(AllSetPtMgrNum).Name = SZOneStageCoolingSetPtMgr(SetPtMgrNum).Name; AllSetPtMgr(AllSetPtMgrNum).SPMType = iSPMType_SZOneStageCooling; AllSetPtMgr(AllSetPtMgrNum).CtrlTypeMode = SZOneStageCoolingSetPtMgr(SetPtMgrNum).CtrlTypeMode; AllSetPtMgr(AllSetPtMgrNum).NumCtrlNodes = SZOneStageCoolingSetPtMgr(SetPtMgrNum).NumCtrlNodes; } if (NumSZOneStageHeatingSetPtMgrs > 0) SZOneStageHeatingSetPtMgr.allocate(NumSZOneStageHeatingSetPtMgrs); cCurrentModuleObject = "SetpointManager:SingleZone:OneStageHeating"; for (SetPtMgrNum = 1; SetPtMgrNum <= NumSZOneStageHeatingSetPtMgrs; ++SetPtMgrNum) { inputProcessor->getObjectItem(cCurrentModuleObject, SetPtMgrNum, cAlphaArgs, NumAlphas, rNumericArgs, NumNums, IOStat, lNumericFieldBlanks, lAlphaFieldBlanks, cAlphaFieldNames, cNumericFieldNames); UtilityRoutines::IsNameEmpty(cAlphaArgs(1), cCurrentModuleObject, ErrorsFound); SZOneStageHeatingSetPtMgr(SetPtMgrNum).Name = cAlphaArgs(1); SZOneStageHeatingSetPtMgr(SetPtMgrNum).CtrlVarType = "Temperature"; SZOneStageHeatingSetPtMgr(SetPtMgrNum).CtrlTypeMode = iCtrlVarType_Temp; SZOneStageHeatingSetPtMgr(SetPtMgrNum).HeatingOnTemp = rNumericArgs(1); SZOneStageHeatingSetPtMgr(SetPtMgrNum).HeatingOffTemp = rNumericArgs(2); if (SZOneStageHeatingSetPtMgr(SetPtMgrNum).HeatingOffTemp > SZOneStageHeatingSetPtMgr(SetPtMgrNum).HeatingOnTemp) { // throw warning, off must be cooler than on ShowWarningError(RoutineName + cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\","); ShowContinueError("..." + cNumericFieldNames(2) + "=[" + RoundSigDigits(SZOneStageHeatingSetPtMgr(SetPtMgrNum).HeatingOnTemp, 1) + "] is less than " + cNumericFieldNames(1) + "=[" + RoundSigDigits(SZOneStageHeatingSetPtMgr(SetPtMgrNum).HeatingOffTemp, 1) + "]."); } SZOneStageHeatingSetPtMgr(SetPtMgrNum).ControlZoneName = cAlphaArgs(2); SZOneStageHeatingSetPtMgr(SetPtMgrNum).ZoneNodeNum = GetSystemNodeNumberForZone(cAlphaArgs(2)); // get the actual zone number of the control zone SZOneStageHeatingSetPtMgr(SetPtMgrNum).ControlZoneNum = UtilityRoutines::FindItemInList(cAlphaArgs(2), Zone); if (SZOneStageHeatingSetPtMgr(SetPtMgrNum).ControlZoneNum == 0) { ShowSevereError(RoutineName + cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\", invalid field."); ShowContinueError("..invalid " + cAlphaFieldNames(2) + "=\"" + cAlphaArgs(2) + "\"."); ErrorsFound = true; } else { if (allocated(StageZoneLogic)) { if (!StageZoneLogic(SZOneStageHeatingSetPtMgr(SetPtMgrNum).ControlZoneNum)) { ShowSevereError(RoutineName + cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\", invalid field."); ShowContinueError("..invalid " + cAlphaFieldNames(2) + "=\"" + cAlphaArgs(2) + "\"."); ShowContinueError("Zone thermostat must use ZoneControl:Thermostat:StagedDualSetpoint."); ErrorsFound = true; } } } NodeListError = false; GetNodeNums(cAlphaArgs(3), NumNodes, NodeNums, NodeListError, NodeType_Unknown, cCurrentModuleObject, cAlphaArgs(1), NodeConnectionType_SetPoint, 1, ObjectIsNotParent, _, cAlphaFieldNames(3)); // setpoint nodes if (!NodeListError) { NumNodesCtrld = NumNodes; SZOneStageHeatingSetPtMgr(SetPtMgrNum).CtrlNodes.allocate(NumNodesCtrld); SZOneStageHeatingSetPtMgr(SetPtMgrNum).NumCtrlNodes = NumNodesCtrld; SZOneStageHeatingSetPtMgr(SetPtMgrNum).SetPt = 0.0; for (CtrldNodeNum = 1; CtrldNodeNum <= NumNodesCtrld; ++CtrldNodeNum) { SZOneStageHeatingSetPtMgr(SetPtMgrNum).CtrlNodes(CtrldNodeNum) = NodeNums(CtrldNodeNum); } } else { ErrorsFound = true; } AllSetPtMgrNum = SetPtMgrNum + NumSchSetPtMgrs + NumDualSchSetPtMgrs + NumOutAirSetPtMgrs + NumSZRhSetPtMgrs + NumSZHtSetPtMgrs + NumSZClSetPtMgrs + NumSZMinHumSetPtMgrs + NumSZMaxHumSetPtMgrs + NumMixedAirSetPtMgrs + NumOAPretreatSetPtMgrs + NumWarmestSetPtMgrs + NumColdestSetPtMgrs + NumWarmestSetPtMgrsTempFlow + NumRABFlowSetPtMgrs + NumMZClgAverageSetPtMgrs + NumMZHtgAverageSetPtMgrs + NumMZAverageMinHumSetPtMgrs + NumMZAverageMaxHumSetPtMgrs + NumMZMinHumSetPtMgrs + NumMZMaxHumSetPtMgrs + NumFollowOATempSetPtMgrs + NumFollowSysNodeTempSetPtMgrs + NumGroundTempSetPtMgrs + NumCondEntSetPtMgrs + NumIdealCondEntSetPtMgrs + NumSZOneStageCoolingSetPtMgrs; if (!NodeListError) { AllSetPtMgr(AllSetPtMgrNum).CtrlNodes.allocate(NumNodesCtrld); AllSetPtMgr(AllSetPtMgrNum).CtrlNodes = SZOneStageHeatingSetPtMgr(SetPtMgrNum).CtrlNodes; } AllSetPtMgr(AllSetPtMgrNum).Name = SZOneStageHeatingSetPtMgr(SetPtMgrNum).Name; AllSetPtMgr(AllSetPtMgrNum).SPMType = iSPMType_SZOneStageHeating; AllSetPtMgr(AllSetPtMgrNum).CtrlTypeMode = SZOneStageHeatingSetPtMgr(SetPtMgrNum).CtrlTypeMode; AllSetPtMgr(AllSetPtMgrNum).NumCtrlNodes = SZOneStageHeatingSetPtMgr(SetPtMgrNum).NumCtrlNodes; } if (NumReturnWaterResetChWSetPtMgrs > 0) ReturnWaterResetChWSetPtMgr.allocate(NumReturnWaterResetChWSetPtMgrs); cCurrentModuleObject = "SetpointManager:ReturnTemperature:ChilledWater"; for (SetPtMgrNum = 1; SetPtMgrNum <= NumReturnWaterResetChWSetPtMgrs; ++SetPtMgrNum) { // get the object inputs inputProcessor->getObjectItem(cCurrentModuleObject, SetPtMgrNum, cAlphaArgs, NumAlphas, rNumericArgs, NumNums, IOStat, lNumericFieldBlanks, lAlphaFieldBlanks, cAlphaFieldNames, cNumericFieldNames); UtilityRoutines::IsNameEmpty(cAlphaArgs(1), cCurrentModuleObject, ErrorsFound); ReturnWaterResetChWSetPtMgr(SetPtMgrNum).Name = cAlphaArgs(1); // process the sense and actuate nodes bool errFlag = false; ReturnWaterResetChWSetPtMgr(SetPtMgrNum).supplyNodeIndex = GetOnlySingleNode(cAlphaArgs(2), errFlag, cCurrentModuleObject, cAlphaArgs(1), NodeType_Unknown, NodeConnectionType_SetPoint, 1, ObjectIsNotParent, cAlphaFieldNames(2)); // setpoint nodes ReturnWaterResetChWSetPtMgr(SetPtMgrNum).returnNodeIndex = GetOnlySingleNode(cAlphaArgs(3), errFlag, cCurrentModuleObject, cAlphaArgs(1), NodeType_Unknown, NodeConnectionType_Sensor, 1, ObjectIsNotParent, cAlphaFieldNames(3)); // setpoint nodes // process the setpoint inputs ReturnWaterResetChWSetPtMgr(SetPtMgrNum).minimumChilledWaterSetpoint = rNumericArgs(1); ReturnWaterResetChWSetPtMgr(SetPtMgrNum).maximumChilledWaterSetpoint = rNumericArgs(2); // process the return temperature type/value std::string returnType(cAlphaArgs(4)); if (UtilityRoutines::SameString(returnType, "SCHEDULED")) { ReturnWaterResetChWSetPtMgr(SetPtMgrNum).returnTemperatureScheduleIndex = GetScheduleIndex(cAlphaArgs(5)); if (ReturnWaterResetChWSetPtMgr(SetPtMgrNum).returnTemperatureScheduleIndex == 0) { ShowSevereError(RoutineName + cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\", invalid field."); ShowContinueError("..invalid " + cAlphaFieldNames(5) + "=\"" + cAlphaArgs(5) + "\"."); ErrorsFound = true; } } else if (UtilityRoutines::SameString(returnType, "CONSTANT")) { ReturnWaterResetChWSetPtMgr(SetPtMgrNum).returnTemperatureConstantTarget = rNumericArgs(3); } else if (UtilityRoutines::SameString(returnType, "RETURNTEMPERATURESETPOINT")) { ReturnWaterResetChWSetPtMgr(SetPtMgrNum).useReturnTempSetpoint = true; } else { ShowSevereError(RoutineName + cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\", invalid field."); ShowContinueError("..invalid " + cAlphaFieldNames(4) + "=\"" + cAlphaArgs(4) + "\"."); ErrorsFound = true; } // setup the "base" class AllSetPtMgrNum = SetPtMgrNum + NumSchSetPtMgrs + NumDualSchSetPtMgrs + NumOutAirSetPtMgrs + NumSZRhSetPtMgrs + NumSZHtSetPtMgrs + NumSZClSetPtMgrs + NumSZMinHumSetPtMgrs + NumSZMaxHumSetPtMgrs + NumMixedAirSetPtMgrs + NumOAPretreatSetPtMgrs + NumWarmestSetPtMgrs + NumColdestSetPtMgrs + NumWarmestSetPtMgrsTempFlow + NumRABFlowSetPtMgrs + NumMZClgAverageSetPtMgrs + NumMZHtgAverageSetPtMgrs + NumMZAverageMinHumSetPtMgrs + NumMZAverageMaxHumSetPtMgrs + NumMZMinHumSetPtMgrs + NumMZMaxHumSetPtMgrs + NumFollowOATempSetPtMgrs + NumFollowSysNodeTempSetPtMgrs + NumGroundTempSetPtMgrs + NumCondEntSetPtMgrs + NumIdealCondEntSetPtMgrs + NumSZOneStageCoolingSetPtMgrs + NumSZOneStageHeatingSetPtMgrs; AllSetPtMgr(AllSetPtMgrNum).CtrlNodes.allocate(1); AllSetPtMgr(AllSetPtMgrNum).CtrlNodes(1) = ReturnWaterResetChWSetPtMgr(SetPtMgrNum).supplyNodeIndex; AllSetPtMgr(AllSetPtMgrNum).Name = ReturnWaterResetChWSetPtMgr(SetPtMgrNum).Name; AllSetPtMgr(AllSetPtMgrNum).SPMType = iSPMType_ReturnWaterResetChW; AllSetPtMgr(AllSetPtMgrNum).CtrlTypeMode = iCtrlVarType_Temp; AllSetPtMgr(AllSetPtMgrNum).NumCtrlNodes = 1; } if (NumReturnWaterResetHWSetPtMgrs > 0) ReturnWaterResetHWSetPtMgr.allocate(NumReturnWaterResetHWSetPtMgrs); cCurrentModuleObject = "SetpointManager:ReturnTemperature:HotWater"; for (SetPtMgrNum = 1; SetPtMgrNum <= NumReturnWaterResetHWSetPtMgrs; ++SetPtMgrNum) { // get the object inputs inputProcessor->getObjectItem(cCurrentModuleObject, SetPtMgrNum, cAlphaArgs, NumAlphas, rNumericArgs, NumNums, IOStat, lNumericFieldBlanks, lAlphaFieldBlanks, cAlphaFieldNames, cNumericFieldNames); UtilityRoutines::IsNameEmpty(cAlphaArgs(1), cCurrentModuleObject, ErrorsFound); ReturnWaterResetHWSetPtMgr(SetPtMgrNum).Name = cAlphaArgs(1); // process the sense and actuate nodes bool errFlag = false; ReturnWaterResetHWSetPtMgr(SetPtMgrNum).supplyNodeIndex = GetOnlySingleNode(cAlphaArgs(2), errFlag, cCurrentModuleObject, cAlphaArgs(1), NodeType_Unknown, NodeConnectionType_SetPoint, 1, ObjectIsNotParent, cAlphaFieldNames(2)); // setpoint nodes ReturnWaterResetHWSetPtMgr(SetPtMgrNum).returnNodeIndex = GetOnlySingleNode(cAlphaArgs(3), errFlag, cCurrentModuleObject, cAlphaArgs(1), NodeType_Unknown, NodeConnectionType_Sensor, 1, ObjectIsNotParent, cAlphaFieldNames(3)); // setpoint nodes // process the setpoint inputs ReturnWaterResetHWSetPtMgr(SetPtMgrNum).minimumHotWaterSetpoint = rNumericArgs(1); ReturnWaterResetHWSetPtMgr(SetPtMgrNum).maximumHotWaterSetpoint = rNumericArgs(2); // process the return temperature type/value std::string returnType(cAlphaArgs(4)); if (UtilityRoutines::SameString(returnType, "SCHEDULED")) { ReturnWaterResetHWSetPtMgr(SetPtMgrNum).returnTemperatureScheduleIndex = GetScheduleIndex(cAlphaArgs(5)); if (ReturnWaterResetHWSetPtMgr(SetPtMgrNum).returnTemperatureScheduleIndex == 0) { ShowSevereError(RoutineName + cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\", invalid field."); ShowContinueError("..invalid " + cAlphaFieldNames(5) + "=\"" + cAlphaArgs(5) + "\"."); ErrorsFound = true; } } else if (UtilityRoutines::SameString(returnType, "CONSTANT")) { ReturnWaterResetHWSetPtMgr(SetPtMgrNum).returnTemperatureConstantTarget = rNumericArgs(3); } else if (UtilityRoutines::SameString(returnType, "RETURNTEMPERATURESETPOINT")) { ReturnWaterResetHWSetPtMgr(SetPtMgrNum).useReturnTempSetpoint = true; } else { ShowSevereError(RoutineName + cCurrentModuleObject + "=\"" + cAlphaArgs(1) + "\", invalid field."); ShowContinueError("..invalid " + cAlphaFieldNames(4) + "=\"" + cAlphaArgs(4) + "\"."); ErrorsFound = true; } // setup the "base" class AllSetPtMgrNum = SetPtMgrNum + NumSchSetPtMgrs + NumDualSchSetPtMgrs + NumOutAirSetPtMgrs + NumSZRhSetPtMgrs + NumSZHtSetPtMgrs + NumSZClSetPtMgrs + NumSZMinHumSetPtMgrs + NumSZMaxHumSetPtMgrs + NumMixedAirSetPtMgrs + NumOAPretreatSetPtMgrs + NumWarmestSetPtMgrs + NumColdestSetPtMgrs + NumWarmestSetPtMgrsTempFlow + NumRABFlowSetPtMgrs + NumMZClgAverageSetPtMgrs + NumMZHtgAverageSetPtMgrs + NumMZAverageMinHumSetPtMgrs + NumMZAverageMaxHumSetPtMgrs + NumMZMinHumSetPtMgrs + NumMZMaxHumSetPtMgrs + NumFollowOATempSetPtMgrs + NumFollowSysNodeTempSetPtMgrs + NumGroundTempSetPtMgrs + NumCondEntSetPtMgrs + NumIdealCondEntSetPtMgrs + NumSZOneStageCoolingSetPtMgrs + NumSZOneStageHeatingSetPtMgrs + NumReturnWaterResetChWSetPtMgrs; AllSetPtMgr(AllSetPtMgrNum).CtrlNodes.allocate(1); AllSetPtMgr(AllSetPtMgrNum).CtrlNodes(1) = ReturnWaterResetHWSetPtMgr(SetPtMgrNum).supplyNodeIndex; AllSetPtMgr(AllSetPtMgrNum).Name = ReturnWaterResetHWSetPtMgr(SetPtMgrNum).Name; AllSetPtMgr(AllSetPtMgrNum).SPMType = iSPMType_ReturnWaterResetHW; AllSetPtMgr(AllSetPtMgrNum).CtrlTypeMode = iCtrlVarType_Temp; AllSetPtMgr(AllSetPtMgrNum).NumCtrlNodes = 1; } cAlphaFieldNames.deallocate(); cAlphaArgs.deallocate(); lAlphaFieldBlanks.deallocate(); cNumericFieldNames.deallocate(); rNumericArgs.deallocate(); lNumericFieldBlanks.deallocate(); } void VerifySetPointManagers(bool &EP_UNUSED(ErrorsFound)) // flag to denote node conflicts in input. !unused1208 { // SUBROUTINE INFORMATION: // AUTHOR Richard Raustad, FSEC // DATE WRITTEN July 2008 // MODIFIED Rick Strand, Aug 2014 (removed deallocation of AllSetPtMgrs so ScheduledTES could also verify control nodes) // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE // Check the SetPointManager data to eliminate conflicts. // METHODOLOGY EMPLOYED: // 1) Check for duplicate names in individual setpoint managers. // Control nodes = A B C D // Check A with B, C, and D // Check B with C and D // Check C with D // 2) Check for duplicate names in all other setpoint managers // Verify setpoint managers use same control type (e.g. TEMP) and then check for duplicate nodes // SPM 1 - Control nodes A - D, SPM 2 - Control nodes E - H, SPM 3 - Control nodes I - L // If SPM 1 has same control type as SPM 2 and SPM 3 (e.g. all use SPM%CtrlTypeMode = iCtrlVarType_Temp) then: // Check A with E-H and I-L // Check B with E-H and I-L // Check C with E-H and I-L // Check D with E-H and I-L // Then check SPM 2 nodes with SPM 3. Check E with I-L, F with I-L, etc. // 3) For SET POINT MANAGER:RETURN AIR BYPASS FLOW // check for duplicate air loop names. // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int SetPtMgrNum; // Setpoint Manager index int TempSetPtMgrNum; // Setpoint Manager index for warning messages int CtrldNodeNum; // index of the items in the controlled node node list int TempCtrldNodeNum; // index of the items in the controlled node node list, used for warning messages for (SetPtMgrNum = 1; SetPtMgrNum <= NumAllSetPtMgrs; ++SetPtMgrNum) { // check for duplicate nodes in each setpoint managers control node list (node lists of size 1 do not need verification) // issue warning only since duplicate node names within a setpoint manager does not cause a conflict (i.e., same // value written to node) but may indicate an error in the node name. for (CtrldNodeNum = 1; CtrldNodeNum <= AllSetPtMgr(SetPtMgrNum).NumCtrlNodes - 1; ++CtrldNodeNum) { for (TempCtrldNodeNum = CtrldNodeNum + 1; TempCtrldNodeNum <= AllSetPtMgr(SetPtMgrNum).NumCtrlNodes; ++TempCtrldNodeNum) { if (AllSetPtMgr(SetPtMgrNum).CtrlNodes(CtrldNodeNum) != AllSetPtMgr(SetPtMgrNum).CtrlNodes(TempCtrldNodeNum)) continue; ShowWarningError(cValidSPMTypes(AllSetPtMgr(SetPtMgrNum).SPMType) + "=\"" + AllSetPtMgr(SetPtMgrNum).Name + "\""); ShowContinueError("...duplicate node specified = " + NodeID(AllSetPtMgr(SetPtMgrNum).CtrlNodes(CtrldNodeNum))); ShowContinueError("...control type variable = " + cValidCtrlTypes(AllSetPtMgr(SetPtMgrNum).CtrlTypeMode)); } } // check for node conflicts in all other setpoint managers for (TempSetPtMgrNum = SetPtMgrNum + 1; TempSetPtMgrNum <= NumAllSetPtMgrs; ++TempSetPtMgrNum) { // check the air loop name in addition to the node names for these SP manager types // IF((AllSetPtMgr(SetPtMgrNum)%SPMType == iSPMType_WarmestTempFlow .AND. & // AllSetPtMgr(TempSetPtMgrNum)%SPMType == iSPMType_WarmestTempFlow) .OR. & // (AllSetPtMgr(SetPtMgrNum)%SPMType == iSPMType_RAB .AND. & // AllSetPtMgr(TempSetPtMgrNum)%SPMType == iSPMType_RAB) .OR. & // (AllSetPtMgr(SetPtMgrNum)%SPMType == iSPMType_Coldest .AND. & // AllSetPtMgr(TempSetPtMgrNum)%SPMType == iSPMType_Coldest) .OR. & // (AllSetPtMgr(SetPtMgrNum)%SPMType == iSPMType_Warmest .AND. & // AllSetPtMgr(TempSetPtMgrNum)%SPMType == iSPMType_Warmest))THEN if ((AllSetPtMgr(SetPtMgrNum).SPMType == iSPMType_RAB && AllSetPtMgr(TempSetPtMgrNum).SPMType == iSPMType_RAB)) { // check the air loop name for duplicates in this SP manager type if (AllSetPtMgr(SetPtMgrNum).AirLoopNum == AllSetPtMgr(TempSetPtMgrNum).AirLoopNum) { ShowWarningError(cValidSPMTypes(AllSetPtMgr(SetPtMgrNum).SPMType) + "=\"" + AllSetPtMgr(SetPtMgrNum).Name + "\""); ShowContinueError("...air loop name conflicts with another setpoint manager."); ShowContinueError("...conflicting setpoint manager = " + cValidSPMTypes(AllSetPtMgr(TempSetPtMgrNum).SPMType) + " \"" + AllSetPtMgr(TempSetPtMgrNum).Name + "\""); ShowContinueError("...conflicting air loop name = " + AllSetPtMgr(SetPtMgrNum).AirLoopName); // ErrorsFound=.TRUE. } // check for duplicate control nodes if (AllSetPtMgr(SetPtMgrNum).CtrlTypeMode != AllSetPtMgr(TempSetPtMgrNum).CtrlTypeMode) continue; for (CtrldNodeNum = 1; CtrldNodeNum <= AllSetPtMgr(SetPtMgrNum).NumCtrlNodes; ++CtrldNodeNum) { for (TempCtrldNodeNum = 1; TempCtrldNodeNum <= AllSetPtMgr(TempSetPtMgrNum).NumCtrlNodes; ++TempCtrldNodeNum) { if ((AllSetPtMgr(SetPtMgrNum).CtrlNodes(CtrldNodeNum) == AllSetPtMgr(TempSetPtMgrNum).CtrlNodes(TempCtrldNodeNum)) && AllSetPtMgr(SetPtMgrNum).CtrlNodes(CtrldNodeNum) != 0) { ShowWarningError(cValidSPMTypes(AllSetPtMgr(SetPtMgrNum).SPMType) + "=\"" + AllSetPtMgr(SetPtMgrNum).Name + "\""); ShowContinueError("...setpoint node conflicts with another setpoint manager."); ShowContinueError("...conflicting setpoint manager = " + cValidSPMTypes(AllSetPtMgr(TempSetPtMgrNum).SPMType) + " \"" + AllSetPtMgr(TempSetPtMgrNum).Name + "\""); ShowContinueError("...conflicting node name = " + NodeID(AllSetPtMgr(SetPtMgrNum).CtrlNodes(CtrldNodeNum))); ShowContinueError("...control type variable = " + cValidCtrlTypes(AllSetPtMgr(SetPtMgrNum).CtrlTypeMode)); // ErrorsFound=.TRUE. } } } } else { // not a RAB setpoint manager // check just the control nodes for other types of SP managers if (AllSetPtMgr(SetPtMgrNum).CtrlTypeMode != AllSetPtMgr(TempSetPtMgrNum).CtrlTypeMode) continue; for (CtrldNodeNum = 1; CtrldNodeNum <= AllSetPtMgr(SetPtMgrNum).NumCtrlNodes; ++CtrldNodeNum) { for (TempCtrldNodeNum = 1; TempCtrldNodeNum <= AllSetPtMgr(TempSetPtMgrNum).NumCtrlNodes; ++TempCtrldNodeNum) { if (AllSetPtMgr(SetPtMgrNum).CtrlNodes(CtrldNodeNum) != AllSetPtMgr(TempSetPtMgrNum).CtrlNodes(TempCtrldNodeNum)) continue; // only warn if scheduled setpoint manager is setting mass flow rate on the same node used by RAB if (AllSetPtMgr(SetPtMgrNum).SPMType == iSPMType_RAB || AllSetPtMgr(TempSetPtMgrNum).SPMType == iSPMType_RAB) { ShowWarningError(cValidSPMTypes(AllSetPtMgr(SetPtMgrNum).SPMType) + "=\"" + AllSetPtMgr(SetPtMgrNum).Name + "\""); ShowContinueError("...setpoint node conflicts with another setpoint manager."); ShowContinueError("...conflicting setpoint manager =" + cValidSPMTypes(AllSetPtMgr(TempSetPtMgrNum).SPMType) + ":\"" + AllSetPtMgr(TempSetPtMgrNum).Name + "\""); ShowContinueError("...conflicting node name = " + NodeID(AllSetPtMgr(SetPtMgrNum).CtrlNodes(CtrldNodeNum))); ShowContinueError("...control type variable = " + cValidCtrlTypes(AllSetPtMgr(SetPtMgrNum).CtrlTypeMode)); ShowContinueError( "...return air bypass flow setpoint manager will have priority setting mass flow rate on this node."); } else { // severe error for other SP manager types ShowWarningError(cValidSPMTypes(AllSetPtMgr(SetPtMgrNum).SPMType) + "=\"" + AllSetPtMgr(SetPtMgrNum).Name + "\""); ShowContinueError("...setpoint node conflicts with another setpoint manager."); ShowContinueError("...conflicting setpoint manager = " + cValidSPMTypes(AllSetPtMgr(TempSetPtMgrNum).SPMType) + ":\"" + AllSetPtMgr(TempSetPtMgrNum).Name + "\""); ShowContinueError("...conflicting node name = " + NodeID(AllSetPtMgr(SetPtMgrNum).CtrlNodes(CtrldNodeNum))); ShowContinueError("...control type variable = " + cValidCtrlTypes(AllSetPtMgr(SetPtMgrNum).CtrlTypeMode)); // ErrorsFound=.TRUE. } } } } } // DO TempSetPtMgrNum = SetPtMgrNum+1, AllSetPtMgrs } // DO SetPtMgrNum = 1, AllSetPtMgrs // Removed the following line for ScheduledTES control implementation // if ( allocated( AllSetPtMgr ) ) AllSetPtMgr.deallocate(); } void InitSetPointManagers() { // SUBROUTINE INFORMATION: // AUTHOR Fred Buhl // DATE WRITTEN October 2000 // MODIFIED Shirey/Raustad (FSEC), Jan 2004 // Nov 2004 - Jan 2005 M. J. Witte, GARD Analytics, Inc. // Add new setpoint managers: // SET POINT MANAGER:SINGLE ZONE HEATING and // SET POINT MANAGER:SINGLE ZONE COOLING // SET POINT MANAGER:OUTSIDE AIR PRETREAT // Work supported by ASHRAE research project 1254-RP // Haves Oct 2004 // July 2010 B.A. Nigusse, FSEC/UCF // Added new setpoint managers: // SetpointManager:MultiZone:Heating:Average // SetpointManager:MultiZone:Cooling:Average // SetpointManager:MultiZone:MinimumHumidity:Average // SetpointManager:MultiZone:MaximumHumidity:Average // Aug 2010 B.A. Nigusse, FSEC/UCF // Added new setpoint managers: // SetpointManager:MultiZone:Humidity:Minimum // SetpointManager:MultiZone:Humidity:Maximum // Sep 2010 B.A. Nigusse, FSEC/UCF // Added control varibles for SetpointManage:Scheduled // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // This subroutine is for initializations of the Setpoint Manager objects. // METHODOLOGY EMPLOYED: // Uses the status flags to trigger initializations. // Using/Aliasing using DataAirSystems::PrimaryAirSystem; using DataHeatBalance::Zone; using DataHVACGlobals::NumCondLoops; using DataHVACGlobals::NumPlantLoops; using DataZoneControls::HumidityControlZone; using DataZoneControls::NumHumidityControlZones; using DataZoneEquipment::ZoneEquipConfig; using DataZoneEquipment::ZoneEquipInputsFilled; using namespace DataPlant; using DataEnvironment::GroundTemp; using DataEnvironment::GroundTemp_Deep; using DataEnvironment::GroundTemp_Surface; using DataEnvironment::GroundTempFC; using OutAirNodeManager::CheckOutAirNodeNumber; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: static bool MyEnvrnFlag(true); // flag for init once at start of environment int SetZoneNum; int ControlledZoneNum; int ZoneNode; int ZoneInletNode; int SetPtMgrNum; int ZoneIndex; int CtrlNodeIndex; int NodeNum; int AirLoopNum; int LoopNum; int LoopNum2; static bool ErrorsFound(false); int ConZoneNum; int MixedAirNode; int BranchNum; int BranchNum2; int InletBranchNum; int CompNum; int CompNum2; static bool LookForFan(false); std::string CompType; std::string cSetPointManagerType; int FanNodeIn; int FanNodeOut; int LoopInNode; int HStatZoneNum; bool HstatZoneFound; int ZonesCooledIndex; // Cooled zones index in an air loop int BranchNumPlantSide; int CompNumPlantSide; static int TypeNum(0); static int NumChiller(0); static int TypeOf_Num(0); ManagerOn = true; // One time initializations if (ZoneEquipInputsFilled && AirLoopInputsFilled) { // check that the zone equipment and air loop data has been read in if (InitSetPointManagersOneTimeFlag) { // "SetpointManager:SingleZone:Heating" cSetPointManagerType = cValidSPMTypes(iSPMType_SZHeating); for (SetPtMgrNum = 1; SetPtMgrNum <= NumSZHtSetPtMgrs; ++SetPtMgrNum) { ZoneInletNode = SingZoneHtSetPtMgr(SetPtMgrNum).ZoneInletNodeNum; ZoneNode = SingZoneHtSetPtMgr(SetPtMgrNum).ZoneNodeNum; // find the index in the ZoneEquipConfig array of the control zone (the one with the main or only thermostat) ConZoneNum = 0; for (ControlledZoneNum = 1; ControlledZoneNum <= NumOfZones; ++ControlledZoneNum) { if (ZoneEquipConfig(ControlledZoneNum).ZoneNode == ZoneNode) { ConZoneNum = ControlledZoneNum; } } if (ConZoneNum == 0) { ShowSevereError(cSetPointManagerType + "=\"" + SingZoneHtSetPtMgr(SetPtMgrNum).Name + "\", Zone Node not found:"); ShowContinueError("Node=\"" + NodeID(SingZoneHtSetPtMgr(SetPtMgrNum).ZoneNodeNum) + "\", not found in any controlled Zone"); ErrorsFound = true; } else { bool found = false; for (int zoneInNode = 1; zoneInNode <= ZoneEquipConfig(ConZoneNum).NumInletNodes; ++zoneInNode) { if (SingZoneHtSetPtMgr(SetPtMgrNum).ZoneInletNodeNum == ZoneEquipConfig(ConZoneNum).InletNode(zoneInNode)) { found = true; } } if (!found) { ShowSevereError(cSetPointManagerType + "=\"" + SingZoneHtSetPtMgr(SetPtMgrNum).Name + "\", The zone inlet node of " + NodeID(SingZoneHtSetPtMgr(SetPtMgrNum).ZoneInletNodeNum)); ShowContinueError("is not found in Zone = " + ZoneEquipConfig(ConZoneNum).ZoneName + ". Please check inputs."); ErrorsFound = true; } } } // "SetpointManager:SingleZone:Cooling" cSetPointManagerType = cValidSPMTypes(iSPMType_SZCooling); for (SetPtMgrNum = 1; SetPtMgrNum <= NumSZClSetPtMgrs; ++SetPtMgrNum) { ZoneInletNode = SingZoneClSetPtMgr(SetPtMgrNum).ZoneInletNodeNum; ZoneNode = SingZoneClSetPtMgr(SetPtMgrNum).ZoneNodeNum; // find the index in the ZoneEquipConfig array of the control zone (the one with the main or only thermostat) ConZoneNum = 0; for (ControlledZoneNum = 1; ControlledZoneNum <= NumOfZones; ++ControlledZoneNum) { if (ZoneEquipConfig(ControlledZoneNum).ZoneNode == ZoneNode) { ConZoneNum = ControlledZoneNum; } } if (ConZoneNum == 0) { ShowSevereError(cSetPointManagerType + "=\"" + SingZoneClSetPtMgr(SetPtMgrNum).Name + "\", Zone Node not found:"); ShowContinueError("Node=\"" + NodeID(SingZoneClSetPtMgr(SetPtMgrNum).ZoneNodeNum) + "\", not found in any controlled Zone"); ErrorsFound = true; } else { bool found = false; for (int zoneInNode = 1; zoneInNode <= ZoneEquipConfig(ConZoneNum).NumInletNodes; ++zoneInNode) { if (SingZoneClSetPtMgr(SetPtMgrNum).ZoneInletNodeNum == ZoneEquipConfig(ConZoneNum).InletNode(zoneInNode)) { found = true; } } if (!found) { ShowSevereError(cSetPointManagerType + "=\"" + SingZoneClSetPtMgr(SetPtMgrNum).Name + "\", The zone inlet node of " + NodeID(SingZoneClSetPtMgr(SetPtMgrNum).ZoneInletNodeNum)); ShowContinueError("is not found in Zone = " + ZoneEquipConfig(ConZoneNum).ZoneName + ". Please check inputs."); ErrorsFound = true; } } } // Minimum humidity setpoint managers cSetPointManagerType = cValidSPMTypes(iSPMType_SZMinHum); for (SetPtMgrNum = 1; SetPtMgrNum <= NumSZMinHumSetPtMgrs; ++SetPtMgrNum) { for (SetZoneNum = 1; SetZoneNum <= SZMinHumSetPtMgr(SetPtMgrNum).NumZones; ++SetZoneNum) { // set the actual and controlled zone numbers for (ControlledZoneNum = 1; ControlledZoneNum <= NumOfZones; ++ControlledZoneNum) { if (ZoneEquipConfig(ControlledZoneNum).ZoneNode == SZMinHumSetPtMgr(SetPtMgrNum).ZoneNodes(SetZoneNum)) { SZMinHumSetPtMgr(SetPtMgrNum).CtrlZoneNum(SetZoneNum) = ControlledZoneNum; SZMinHumSetPtMgr(SetPtMgrNum).ZoneNum(SetZoneNum) = ZoneEquipConfig(ControlledZoneNum).ActualZoneNum; break; } } // still need to validate... if (SZMinHumSetPtMgr(SetPtMgrNum).CtrlZoneNum(SetZoneNum) == 0) { // didn't find ShowSevereError(cSetPointManagerType + "=\"" + SZMinHumSetPtMgr(SetPtMgrNum).Name + "\", invalid zone"); ShowContinueError("could not find Controlled Zone=" + Zone(SZMinHumSetPtMgr(SetPtMgrNum).ZoneNum(SetZoneNum)).Name); ErrorsFound = true; } else { // make sure humidity controlled zone HstatZoneFound = false; for (HStatZoneNum = 1; HStatZoneNum <= NumHumidityControlZones; ++HStatZoneNum) { if (HumidityControlZone(HStatZoneNum).ActualZoneNum != SZMinHumSetPtMgr(SetPtMgrNum).ZoneNum(SetZoneNum)) continue; HstatZoneFound = true; break; } if (!HstatZoneFound) { ShowSevereError(cSetPointManagerType + "=\"" + SZMinHumSetPtMgr(SetPtMgrNum).Name + "\", invalid humidistat specification"); ShowContinueError("could not locate Humidistat in Zone=" + Zone(SZMinHumSetPtMgr(SetPtMgrNum).ZoneNum(SetZoneNum)).Name); ErrorsFound = true; } } } } // Maximum humidity setpoint managers cSetPointManagerType = cValidSPMTypes(iSPMType_SZMaxHum); for (SetPtMgrNum = 1; SetPtMgrNum <= NumSZMaxHumSetPtMgrs; ++SetPtMgrNum) { for (SetZoneNum = 1; SetZoneNum <= SZMaxHumSetPtMgr(SetPtMgrNum).NumZones; ++SetZoneNum) { // set the actual and controlled zone numbers for (ControlledZoneNum = 1; ControlledZoneNum <= NumOfZones; ++ControlledZoneNum) { if (ZoneEquipConfig(ControlledZoneNum).ZoneNode == SZMaxHumSetPtMgr(SetPtMgrNum).ZoneNodes(SetZoneNum)) { SZMaxHumSetPtMgr(SetPtMgrNum).CtrlZoneNum(SetZoneNum) = ControlledZoneNum; SZMaxHumSetPtMgr(SetPtMgrNum).ZoneNum(SetZoneNum) = ZoneEquipConfig(ControlledZoneNum).ActualZoneNum; break; } } // still need to validate... if (SZMaxHumSetPtMgr(SetPtMgrNum).CtrlZoneNum(SetZoneNum) == 0) { // didn't find ShowSevereError(cSetPointManagerType + "=\"" + SZMaxHumSetPtMgr(SetPtMgrNum).Name + "\", invalid zone"); ShowContinueError("could not find Controlled Zone=" + Zone(SZMaxHumSetPtMgr(SetPtMgrNum).ZoneNum(SetZoneNum)).Name); ErrorsFound = true; } else { // make sure humidity controlled zone HstatZoneFound = false; for (HStatZoneNum = 1; HStatZoneNum <= NumHumidityControlZones; ++HStatZoneNum) { if (HumidityControlZone(HStatZoneNum).ActualZoneNum != SZMaxHumSetPtMgr(SetPtMgrNum).ZoneNum(SetZoneNum)) continue; HstatZoneFound = true; break; } if (!HstatZoneFound) { ShowSevereError(cSetPointManagerType + "=\"" + SZMaxHumSetPtMgr(SetPtMgrNum).Name + "\", invalid humidistat specification"); ShowContinueError("could not locate Humidistat in Zone=" + Zone(SZMaxHumSetPtMgr(SetPtMgrNum).ZoneNum(SetZoneNum)).Name); ErrorsFound = true; } } } } // single zone reheat setpoint manager cSetPointManagerType = cValidSPMTypes(iSPMType_SZReheat); for (SetPtMgrNum = 1; SetPtMgrNum <= NumSZRhSetPtMgrs; ++SetPtMgrNum) { FanNodeIn = 0; FanNodeOut = 0; MixedAirNode = 0; AirLoopNum = 0; InletBranchNum = 0; LoopInNode = 0; LookForFan = false; ZoneInletNode = SingZoneRhSetPtMgr(SetPtMgrNum).ZoneInletNodeNum; ZoneNode = SingZoneRhSetPtMgr(SetPtMgrNum).ZoneNodeNum; // find the index in the ZoneEquipConfig array of the control zone (the one with the main or only thermostat) ConZoneNum = 0; for (ControlledZoneNum = 1; ControlledZoneNum <= NumOfZones; ++ControlledZoneNum) { if (ZoneEquipConfig(ControlledZoneNum).ZoneNode == ZoneNode) { ConZoneNum = ControlledZoneNum; } } if (ConZoneNum == 0) { ShowSevereError(cSetPointManagerType + "=\"" + SingZoneRhSetPtMgr(SetPtMgrNum).Name + "\", Zone Node not found:"); ShowContinueError("Node=\"" + NodeID(SingZoneRhSetPtMgr(SetPtMgrNum).ZoneNodeNum) + "\", not found in any controlled Zone"); ErrorsFound = true; } else { bool found = false; for (int zoneInNode = 1; zoneInNode <= ZoneEquipConfig(ConZoneNum).NumInletNodes; ++zoneInNode) { if (SingZoneRhSetPtMgr(SetPtMgrNum).ZoneInletNodeNum == ZoneEquipConfig(ConZoneNum).InletNode(zoneInNode)) { found = true; AirLoopNum = ZoneEquipConfig(ConZoneNum).InletNodeAirLoopNum(zoneInNode); } } if (!found) { ShowSevereError(cSetPointManagerType + "=\"" + SingZoneRhSetPtMgr(SetPtMgrNum).Name + "\", The zone inlet node of "+NodeID(SingZoneRhSetPtMgr(SetPtMgrNum).ZoneInletNodeNum)); ShowContinueError("is not found in Zone = " + ZoneEquipConfig(ConZoneNum).ZoneName +". Please check inputs."); ErrorsFound = true; } if (AirLoopNum == 0) { ShowSevereError(cSetPointManagerType + "=\"" + SingZoneRhSetPtMgr(SetPtMgrNum).Name + "\", The zone inlet node is not connected to an air loop."); ErrorsFound = true; continue; } MixedAirNode = PrimaryAirSystem(AirLoopNum).OASysOutletNodeNum; InletBranchNum = PrimaryAirSystem(AirLoopNum).InletBranchNum(1); LoopInNode = PrimaryAirSystem(AirLoopNum).Branch(InletBranchNum).NodeNumIn; // get the supply fan inlet and outlet nodes if (MixedAirNode > 0) { for (BranchNum = 1; BranchNum <= PrimaryAirSystem(AirLoopNum).NumBranches; ++BranchNum) { for (CompNum = 1; CompNum <= PrimaryAirSystem(AirLoopNum).Branch(BranchNum).TotalComponents; ++CompNum) { CompType = PrimaryAirSystem(AirLoopNum).Branch(BranchNum).Comp(CompNum).TypeOf; if (MixedAirNode == PrimaryAirSystem(AirLoopNum).Branch(BranchNum).Comp(CompNum).NodeNumIn) { LookForFan = true; } if (LookForFan) { // cpw22Aug2010 Add Fan:ComponentModel (new) if (UtilityRoutines::SameString(CompType, "Fan:ConstantVolume") || UtilityRoutines::SameString(CompType, "Fan:VariableVolume") || UtilityRoutines::SameString(CompType, "Fan:OnOff") || UtilityRoutines::SameString(CompType, "Fan:ComponentModel")) { FanNodeIn = PrimaryAirSystem(AirLoopNum).Branch(BranchNum).Comp(CompNum).NodeNumIn; FanNodeOut = PrimaryAirSystem(AirLoopNum).Branch(BranchNum).Comp(CompNum).NodeNumOut; break; } } } } } else { for (BranchNum = 1; BranchNum <= PrimaryAirSystem(AirLoopNum).NumBranches; ++BranchNum) { for (CompNum = 1; CompNum <= PrimaryAirSystem(AirLoopNum).Branch(BranchNum).TotalComponents; ++CompNum) { CompType = PrimaryAirSystem(AirLoopNum).Branch(BranchNum).Comp(CompNum).TypeOf; // cpw22Aug2010 Add Fan:ComponentModel (new) if (UtilityRoutines::SameString(CompType, "Fan:ConstantVolume") || UtilityRoutines::SameString(CompType, "Fan:VariableVolume") || UtilityRoutines::SameString(CompType, "Fan:OnOff") || UtilityRoutines::SameString(CompType, "Fan:ComponentModel")) { FanNodeIn = PrimaryAirSystem(AirLoopNum).Branch(BranchNum).Comp(CompNum).NodeNumIn; FanNodeOut = PrimaryAirSystem(AirLoopNum).Branch(BranchNum).Comp(CompNum).NodeNumOut; } } } } SingZoneRhSetPtMgr(SetPtMgrNum).FanNodeIn = FanNodeIn; SingZoneRhSetPtMgr(SetPtMgrNum).FanNodeOut = FanNodeOut; SingZoneRhSetPtMgr(SetPtMgrNum).MixedAirNode = MixedAirNode; SingZoneRhSetPtMgr(SetPtMgrNum).AirLoopNum = AirLoopNum; SingZoneRhSetPtMgr(SetPtMgrNum).OAInNode = PrimaryAirSystem(AirLoopNum).OAMixOAInNodeNum; // this next line assumes that OA system is the first thing on the branch, what if there is a relief fan or heat recovery coil // or other component in there first? does it matter? SingZoneRhSetPtMgr(SetPtMgrNum).RetNode = PrimaryAirSystem(AirLoopNum).OASysInletNodeNum; SingZoneRhSetPtMgr(SetPtMgrNum).LoopInNode = LoopInNode; } } // Warmest Setpoint Managers cSetPointManagerType = cValidSPMTypes(iSPMType_Warmest); for (SetPtMgrNum = 1; SetPtMgrNum <= NumWarmestSetPtMgrs; ++SetPtMgrNum) { if (NumPrimaryAirSys > 0) { AirLoopNum = UtilityRoutines::FindItemInList( WarmestSetPtMgr(SetPtMgrNum).AirLoopName, AirToZoneNodeInfo, &AirLoopZoneEquipConnectData::AirLoopName); if (AirLoopNum == 0) { ShowSevereError(cSetPointManagerType + "=\"" + WarmestSetPtMgr(SetPtMgrNum).Name + "\", invalid Air Loop specified:"); ShowContinueError("Air Loop not found =\"" + WarmestSetPtMgr(SetPtMgrNum).AirLoopName + "\"."); ErrorsFound = true; } else { WarmestSetPtMgr(SetPtMgrNum).AirLoopNum = AirLoopNum; } if (AirToZoneNodeInfo(AirLoopNum).NumZonesCooled == 0) { ShowSevereError(cSetPointManagerType + "=\"" + WarmestSetPtMgr(SetPtMgrNum).Name + "\", no zones with cooling found:"); ShowContinueError("Air Loop provides no cooling, Air Loop=\"" + WarmestSetPtMgr(SetPtMgrNum).AirLoopName + "\"."); ErrorsFound = true; } } else { ShowSevereError(cSetPointManagerType + "=\"" + WarmestSetPtMgr(SetPtMgrNum).Name + "\", no AirLoopHVAC objects found:"); ShowContinueError("Setpoint Manager needs an AirLoopHVAC to operate."); ErrorsFound = true; } } // Coldest Setpoint Managers cSetPointManagerType = cValidSPMTypes(iSPMType_Coldest); for (SetPtMgrNum = 1; SetPtMgrNum <= NumColdestSetPtMgrs; ++SetPtMgrNum) { if (NumPrimaryAirSys > 0) { AirLoopNum = UtilityRoutines::FindItemInList( ColdestSetPtMgr(SetPtMgrNum).AirLoopName, AirToZoneNodeInfo, &AirLoopZoneEquipConnectData::AirLoopName); if (AirLoopNum == 0) { ShowSevereError(cSetPointManagerType + "=\"" + ColdestSetPtMgr(SetPtMgrNum).Name + "\", invalid Air Loop specified:"); ShowContinueError("Air Loop not found =\"" + ColdestSetPtMgr(SetPtMgrNum).AirLoopName + "\"."); ErrorsFound = true; } else { ColdestSetPtMgr(SetPtMgrNum).AirLoopNum = AirLoopNum; } if (AirToZoneNodeInfo(AirLoopNum).NumZonesHeated == 0) { if (AirToZoneNodeInfo(AirLoopNum).NumZonesCooled == 0) { ShowSevereError(cSetPointManagerType + "=\"" + ColdestSetPtMgr(SetPtMgrNum).Name + "\", no zones with heating or cooling found:"); ShowContinueError("Air Loop provides no heating or cooling, Air Loop=\"" + ColdestSetPtMgr(SetPtMgrNum).AirLoopName + "\"."); ErrorsFound = true; } } } else { ShowSevereError(cSetPointManagerType + "=\"" + ColdestSetPtMgr(SetPtMgrNum).Name + "\", no AirLoopHVAC objects found:"); ShowContinueError("Setpoint Manager needs an AirLoopHVAC to operate."); ErrorsFound = true; } } // Warmest Temp Flow Setpoint Managers cSetPointManagerType = cValidSPMTypes(iSPMType_WarmestTempFlow); for (SetPtMgrNum = 1; SetPtMgrNum <= NumWarmestSetPtMgrsTempFlow; ++SetPtMgrNum) { if (NumPrimaryAirSys > 0) { AirLoopNum = UtilityRoutines::FindItemInList( WarmestSetPtMgrTempFlow(SetPtMgrNum).AirLoopName, AirToZoneNodeInfo, &AirLoopZoneEquipConnectData::AirLoopName); if (AirLoopNum == 0) { ShowSevereError(cSetPointManagerType + "=\"" + WarmestSetPtMgrTempFlow(SetPtMgrNum).Name + "\", invalid Air Loop specified:"); ShowContinueError("Air Loop not found =\"" + WarmestSetPtMgrTempFlow(SetPtMgrNum).AirLoopName + "\"."); ErrorsFound = true; } else { WarmestSetPtMgrTempFlow(SetPtMgrNum).AirLoopNum = AirLoopNum; WarmestSetPtMgrTempFlow(SetPtMgrNum).SimReady = true; } if (AirToZoneNodeInfo(AirLoopNum).NumZonesCooled == 0) { ShowSevereError(cSetPointManagerType + "=\"" + WarmestSetPtMgrTempFlow(SetPtMgrNum).Name + "\", no zones with cooling found:"); ShowContinueError("Air Loop provides no cooling, Air Loop=\"" + WarmestSetPtMgrTempFlow(SetPtMgrNum).AirLoopName + "\"."); ErrorsFound = true; } } else { ShowSevereError(cSetPointManagerType + "=\"" + WarmestSetPtMgrTempFlow(SetPtMgrNum).Name + "\", no AirLoopHVAC objects found:"); ShowContinueError("Setpoint Manager needs an AirLoopHVAC to operate."); ErrorsFound = true; } } // return air bypass flow set manager cSetPointManagerType = cValidSPMTypes(iSPMType_RAB); for (SetPtMgrNum = 1; SetPtMgrNum <= NumRABFlowSetPtMgrs; ++SetPtMgrNum) { if (NumPrimaryAirSys > 0) { AirLoopNum = UtilityRoutines::FindItemInList( RABFlowSetPtMgr(SetPtMgrNum).AirLoopName, AirToZoneNodeInfo, &AirLoopZoneEquipConnectData::AirLoopName); AllSetPtMgr(RABFlowSetPtMgr(SetPtMgrNum).AllSetPtMgrIndex).AirLoopNum = AirLoopNum; AllSetPtMgr(RABFlowSetPtMgr(SetPtMgrNum).AllSetPtMgrIndex).AirLoopName = RABFlowSetPtMgr(SetPtMgrNum).AirLoopName; if (AirLoopNum == 0) { ShowSevereError(cSetPointManagerType + "=\"" + RABFlowSetPtMgr(SetPtMgrNum).Name + "\", invalid Air Loop specified:"); ShowContinueError("Air Loop not found =\"" + RABFlowSetPtMgr(SetPtMgrNum).AirLoopName + "\"."); ErrorsFound = true; } else { RABFlowSetPtMgr(SetPtMgrNum).AirLoopNum = AirLoopNum; if (PrimaryAirSystem(AirLoopNum).RABExists) { RABFlowSetPtMgr(SetPtMgrNum).RABMixInNode = PrimaryAirSystem(AirLoopNum).RABMixInNode; RABFlowSetPtMgr(SetPtMgrNum).SupMixInNode = PrimaryAirSystem(AirLoopNum).SupMixInNode; RABFlowSetPtMgr(SetPtMgrNum).MixOutNode = PrimaryAirSystem(AirLoopNum).MixOutNode; RABFlowSetPtMgr(SetPtMgrNum).RABSplitOutNode = PrimaryAirSystem(AirLoopNum).RABSplitOutNode; RABFlowSetPtMgr(SetPtMgrNum).SysOutNode = AirToZoneNodeInfo(AirLoopNum).AirLoopSupplyNodeNum(1); RABFlowSetPtMgr(SetPtMgrNum).CtrlNodes(1) = RABFlowSetPtMgr(SetPtMgrNum).RABSplitOutNode; AllSetPtMgr(RABFlowSetPtMgr(SetPtMgrNum).AllSetPtMgrIndex).CtrlNodes(1) = RABFlowSetPtMgr(SetPtMgrNum).RABSplitOutNode; } else { ShowSevereError(cSetPointManagerType + "=\"" + RABFlowSetPtMgr(SetPtMgrNum).Name + "\", no RAB in air loop found:"); ShowContinueError("Air Loop=\"" + RABFlowSetPtMgr(SetPtMgrNum).AirLoopName + "\"."); ErrorsFound = true; } } } else { ShowSevereError(cSetPointManagerType + "=\"" + RABFlowSetPtMgr(SetPtMgrNum).Name + "\", no AirLoopHVAC objects found:"); ShowContinueError("Setpoint Manager needs an AirLoopHVAC to operate."); ErrorsFound = true; } } // MultiZone Average Cooling Setpoint Managers cSetPointManagerType = cValidSPMTypes(iSPMType_MZCoolingAverage); for (SetPtMgrNum = 1; SetPtMgrNum <= NumMZClgAverageSetPtMgrs; ++SetPtMgrNum) { if (NumPrimaryAirSys > 0) { AirLoopNum = UtilityRoutines::FindItemInList( MZAverageCoolingSetPtMgr(SetPtMgrNum).AirLoopName, AirToZoneNodeInfo, &AirLoopZoneEquipConnectData::AirLoopName); if (AirLoopNum == 0) { ShowSevereError(cSetPointManagerType + "=\"" + MZAverageCoolingSetPtMgr(SetPtMgrNum).Name + "\", invalid Air Loop specified:"); ShowContinueError("Air Loop not found =\"" + MZAverageCoolingSetPtMgr(SetPtMgrNum).AirLoopName + "\"."); ErrorsFound = true; } else { MZAverageCoolingSetPtMgr(SetPtMgrNum).AirLoopNum = AirLoopNum; } if (AirToZoneNodeInfo(AirLoopNum).NumZonesCooled == 0) { ShowSevereError(cSetPointManagerType + "=\"" + MZAverageCoolingSetPtMgr(SetPtMgrNum).Name + "\", no zones with cooling found:"); ShowContinueError("Air Loop provides no cooling, Air Loop=\"" + MZAverageCoolingSetPtMgr(SetPtMgrNum).AirLoopName + "\"."); ErrorsFound = true; } } else { ShowSevereError(cSetPointManagerType + "=\"" + MZAverageCoolingSetPtMgr(SetPtMgrNum).Name + "\", no AirLoopHVAC objects found:"); ShowContinueError("Setpoint Manager needs an AirLoopHVAC to operate."); ErrorsFound = true; } } // MultiZone Average Heating Setpoint Managers cSetPointManagerType = cValidSPMTypes(iSPMType_MZHeatingAverage); for (SetPtMgrNum = 1; SetPtMgrNum <= NumMZHtgAverageSetPtMgrs; ++SetPtMgrNum) { if (NumPrimaryAirSys > 0) { AirLoopNum = UtilityRoutines::FindItemInList( MZAverageHeatingSetPtMgr(SetPtMgrNum).AirLoopName, AirToZoneNodeInfo, &AirLoopZoneEquipConnectData::AirLoopName); if (AirLoopNum == 0) { ShowSevereError(cSetPointManagerType + "=\"" + MZAverageHeatingSetPtMgr(SetPtMgrNum).Name + "\", invalid Air Loop specified:"); ShowContinueError("Air Loop not found =\"" + MZAverageHeatingSetPtMgr(SetPtMgrNum).AirLoopName + "\"."); ErrorsFound = true; } else { MZAverageHeatingSetPtMgr(SetPtMgrNum).AirLoopNum = AirLoopNum; } // Commented out as we are using %NumZonesCooled instead of %NumZonesHeated for all systems for now // IF (AirToZoneNodeInfo(AirLoopNum)%NumZonesHeated == 0) THEN // CALL ShowSevereError(TRIM(cSetPointManagerType)//': Air Loop provides no heating ' // & // TRIM(MZAverageHeatingSetPtMgr(SetPtMgrNum)%Name)) // CALL ShowContinueError('Occurs in Setpoint Manager='//TRIM(MZAverageHeatingSetPtMgr(SetPtMgrNum)%Name)) // ErrorsFound = .TRUE. // END IF } else { ShowSevereError(cSetPointManagerType + "=\"" + MZAverageHeatingSetPtMgr(SetPtMgrNum).Name + "\", no AirLoopHVAC objects found:"); ShowContinueError("Setpoint Manager needs an AirLoopHVAC to operate."); ErrorsFound = true; } } // MultiZone Average Minimum Humidity Setpoint Managers cSetPointManagerType = cValidSPMTypes(iSPMType_MZMinHumAverage); for (SetPtMgrNum = 1; SetPtMgrNum <= NumMZAverageMinHumSetPtMgrs; ++SetPtMgrNum) { if (NumPrimaryAirSys > 0) { AirLoopNum = UtilityRoutines::FindItemInList( MZAverageMinHumSetPtMgr(SetPtMgrNum).AirLoopName, AirToZoneNodeInfo, &AirLoopZoneEquipConnectData::AirLoopName); if (AirLoopNum == 0) { ShowSevereError(cSetPointManagerType + "=\"" + MZAverageMinHumSetPtMgr(SetPtMgrNum).Name + "\", invalid Air Loop specified:"); ShowContinueError("Air Loop not found =\"" + MZAverageMinHumSetPtMgr(SetPtMgrNum).AirLoopName + "\"."); ErrorsFound = true; } else { MZAverageMinHumSetPtMgr(SetPtMgrNum).AirLoopNum = AirLoopNum; // make sure humidity controlled zone HstatZoneFound = false; for (HStatZoneNum = 1; HStatZoneNum <= NumHumidityControlZones; ++HStatZoneNum) { for (ZonesCooledIndex = 1; ZonesCooledIndex <= AirToZoneNodeInfo(MZAverageMinHumSetPtMgr(SetPtMgrNum).AirLoopNum).NumZonesCooled; ++ZonesCooledIndex) { if (HumidityControlZone(HStatZoneNum).ActualZoneNum != AirToZoneNodeInfo(MZAverageMinHumSetPtMgr(SetPtMgrNum).AirLoopNum).CoolCtrlZoneNums(ZonesCooledIndex)) continue; HstatZoneFound = true; break; } } if (!HstatZoneFound) { ShowSevereError(cSetPointManagerType + "=\"" + MZAverageMinHumSetPtMgr(SetPtMgrNum).Name + "\", invalid humidistat specification"); ShowContinueError("could not locate Humidistat in any of the zones served by the Air loop=" + PrimaryAirSystem(AirLoopNum).Name); ErrorsFound = true; } } } else { ShowSevereError(cSetPointManagerType + "=\"" + MZAverageMinHumSetPtMgr(SetPtMgrNum).Name + "\", no AirLoopHVAC objects found:"); ShowContinueError("Setpoint Manager needs an AirLoopHVAC to operate."); ErrorsFound = true; } } // MultiZone Average Maximum Humidity Setpoint Managers cSetPointManagerType = cValidSPMTypes(iSPMType_MZMaxHumAverage); for (SetPtMgrNum = 1; SetPtMgrNum <= NumMZAverageMaxHumSetPtMgrs; ++SetPtMgrNum) { if (NumPrimaryAirSys > 0) { AirLoopNum = UtilityRoutines::FindItemInList( MZAverageMaxHumSetPtMgr(SetPtMgrNum).AirLoopName, AirToZoneNodeInfo, &AirLoopZoneEquipConnectData::AirLoopName); if (AirLoopNum == 0) { ShowSevereError(cSetPointManagerType + "=\"" + MZAverageMaxHumSetPtMgr(SetPtMgrNum).Name + "\", invalid Air Loop specified:"); ShowContinueError("Air Loop not found =\"" + MZAverageMaxHumSetPtMgr(SetPtMgrNum).AirLoopName + "\"."); ErrorsFound = true; } else { MZAverageMaxHumSetPtMgr(SetPtMgrNum).AirLoopNum = AirLoopNum; // make sure humidity controlled zone HstatZoneFound = false; for (HStatZoneNum = 1; HStatZoneNum <= NumHumidityControlZones; ++HStatZoneNum) { for (ZonesCooledIndex = 1; ZonesCooledIndex <= AirToZoneNodeInfo(MZAverageMaxHumSetPtMgr(SetPtMgrNum).AirLoopNum).NumZonesCooled; ++ZonesCooledIndex) { if (HumidityControlZone(HStatZoneNum).ActualZoneNum != AirToZoneNodeInfo(MZAverageMaxHumSetPtMgr(SetPtMgrNum).AirLoopNum).CoolCtrlZoneNums(ZonesCooledIndex)) continue; HstatZoneFound = true; break; } } if (!HstatZoneFound) { ShowSevereError(cSetPointManagerType + "=\"" + MZAverageMaxHumSetPtMgr(SetPtMgrNum).Name + "\", invalid humidistat specification"); ShowContinueError("could not locate Humidistat in any of the zones served by the Air loop=" + PrimaryAirSystem(AirLoopNum).Name); ErrorsFound = true; } } } else { ShowSevereError(cSetPointManagerType + "=\"" + MZAverageMaxHumSetPtMgr(SetPtMgrNum).Name + "\", no AirLoopHVAC objects found:"); ShowContinueError("Setpoint Manager needs an AirLoopHVAC to operate."); ErrorsFound = true; } } // Multizone Minimum Humidity Ratio Setpoint Managers cSetPointManagerType = cValidSPMTypes(iSPMType_MZMinHum); for (SetPtMgrNum = 1; SetPtMgrNum <= NumMZMinHumSetPtMgrs; ++SetPtMgrNum) { if (NumPrimaryAirSys > 0) { AirLoopNum = UtilityRoutines::FindItemInList( MZMinHumSetPtMgr(SetPtMgrNum).AirLoopName, AirToZoneNodeInfo, &AirLoopZoneEquipConnectData::AirLoopName); if (AirLoopNum == 0) { ShowSevereError(cSetPointManagerType + "=\"" + MZMinHumSetPtMgr(SetPtMgrNum).Name + "\", invalid Air Loop specified:"); ShowContinueError("Air Loop not found =\"" + MZMinHumSetPtMgr(SetPtMgrNum).AirLoopName + "\"."); ErrorsFound = true; } else { MZMinHumSetPtMgr(SetPtMgrNum).AirLoopNum = AirLoopNum; // make sure humidity controlled zone HstatZoneFound = false; for (HStatZoneNum = 1; HStatZoneNum <= NumHumidityControlZones; ++HStatZoneNum) { for (ZonesCooledIndex = 1; ZonesCooledIndex <= AirToZoneNodeInfo(MZMinHumSetPtMgr(SetPtMgrNum).AirLoopNum).NumZonesCooled; ++ZonesCooledIndex) { if (HumidityControlZone(HStatZoneNum).ActualZoneNum != AirToZoneNodeInfo(MZMinHumSetPtMgr(SetPtMgrNum).AirLoopNum).CoolCtrlZoneNums(ZonesCooledIndex)) continue; HstatZoneFound = true; break; } } if (!HstatZoneFound) { ShowSevereError(cSetPointManagerType + "=\"" + MZMinHumSetPtMgr(SetPtMgrNum).Name + "\", invalid humidistat specification"); ShowContinueError("could not locate Humidistat in any of the zones served by the Air loop=" + PrimaryAirSystem(AirLoopNum).Name); ErrorsFound = true; } } } else { ShowSevereError(cSetPointManagerType + "=\"" + MZMinHumSetPtMgr(SetPtMgrNum).Name + "\", no AirLoopHVAC objects found:"); ShowContinueError("Setpoint Manager needs an AirLoopHVAC to operate."); ErrorsFound = true; } } // Multizone Maximum Humidity Ratio Setpoint Managers cSetPointManagerType = cValidSPMTypes(iSPMType_MZMaxHum); for (SetPtMgrNum = 1; SetPtMgrNum <= NumMZMaxHumSetPtMgrs; ++SetPtMgrNum) { if (NumPrimaryAirSys > 0) { AirLoopNum = UtilityRoutines::FindItemInList( MZMaxHumSetPtMgr(SetPtMgrNum).AirLoopName, AirToZoneNodeInfo, &AirLoopZoneEquipConnectData::AirLoopName); if (AirLoopNum == 0) { ShowSevereError(cSetPointManagerType + "=\"" + MZMaxHumSetPtMgr(SetPtMgrNum).Name + "\", invalid Air Loop specified:"); ShowContinueError("Air Loop not found =\"" + MZMaxHumSetPtMgr(SetPtMgrNum).AirLoopName + "\"."); ErrorsFound = true; } else { MZMaxHumSetPtMgr(SetPtMgrNum).AirLoopNum = AirLoopNum; // make sure humidity controlled zone HstatZoneFound = false; for (HStatZoneNum = 1; HStatZoneNum <= NumHumidityControlZones; ++HStatZoneNum) { for (ZonesCooledIndex = 1; ZonesCooledIndex <= AirToZoneNodeInfo(MZMaxHumSetPtMgr(SetPtMgrNum).AirLoopNum).NumZonesCooled; ++ZonesCooledIndex) { if (HumidityControlZone(HStatZoneNum).ActualZoneNum != AirToZoneNodeInfo(MZMaxHumSetPtMgr(SetPtMgrNum).AirLoopNum).CoolCtrlZoneNums(ZonesCooledIndex)) continue; HstatZoneFound = true; break; } } if (!HstatZoneFound) { ShowSevereError(cSetPointManagerType + "=\"" + MZMaxHumSetPtMgr(SetPtMgrNum).Name + "\", invalid humidistat specification"); ShowContinueError("could not locate Humidistat in any of the zones served by the Air loop=" + PrimaryAirSystem(AirLoopNum).Name); ErrorsFound = true; } } } else { ShowSevereError(cSetPointManagerType + "=\"" + MZMaxHumSetPtMgr(SetPtMgrNum).Name + "\", no AirLoopHVAC objects found:"); ShowContinueError("Setpoint Manager needs an AirLoopHVAC to operate."); ErrorsFound = true; } } // condenser entering water temperature reset setpoint manager cSetPointManagerType = cValidSPMTypes(iSPMType_CondEntReset); for (SetPtMgrNum = 1; SetPtMgrNum <= NumCondEntSetPtMgrs; ++SetPtMgrNum) { // Scan loops and find the loop index that includes the condenser cooling tower node used as setpoint for (LoopNum = 1; LoopNum <= NumCondLoops + NumPlantLoops; ++LoopNum) { // Begin demand side loops ... When condenser is added becomes NumLoops for (CtrlNodeIndex = 1; CtrlNodeIndex <= CondEntSetPtMgr(SetPtMgrNum).NumCtrlNodes; ++CtrlNodeIndex) { if (PlantLoop(LoopNum).TempSetPointNodeNum == CondEntSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex)) { for (BranchNum = 1; BranchNum <= PlantLoop(LoopNum).LoopSide(SupplySide).TotalBranches; ++BranchNum) { for (CompNum = 1; CompNum <= PlantLoop(LoopNum).LoopSide(SupplySide).Branch(BranchNum).TotalComponents; ++CompNum) { // Check if cooling tower is single speed and generate and error TypeOf_Num = PlantLoop(LoopNum).LoopSide(SupplySide).Branch(BranchNum).Comp(CompNum).TypeOf_Num; if (TypeOf_Num == TypeOf_CoolingTower_SingleSpd) { ShowSevereError(cSetPointManagerType + "=\"" + CondEntSetPtMgr(SetPtMgrNum).Name + "\", invalid tower found"); ShowContinueError("Found SingleSpeed Cooling Tower, Cooling Tower=" + PlantLoop(LoopNum).LoopSide(SupplySide).Branch(BranchNum).Comp(CompNum).Name); ShowContinueError("SingleSpeed cooling towers cannot be used with this setpoint manager."); ErrorsFound = true; } } } // Scan all attached chillers in the condenser loop index found to find the chiller index for (BranchNum = 1; BranchNum <= PlantLoop(LoopNum).LoopSide(DemandSide).TotalBranches; ++BranchNum) { for (CompNum = 1; CompNum <= PlantLoop(LoopNum).LoopSide(DemandSide).Branch(BranchNum).TotalComponents; ++CompNum) { TypeOf_Num = PlantLoop(LoopNum).LoopSide(DemandSide).Branch(BranchNum).Comp(CompNum).TypeOf_Num; if (TypeOf_Num == TypeOf_Chiller_Absorption || TypeOf_Num == TypeOf_Chiller_Indirect_Absorption || TypeOf_Num == TypeOf_Chiller_CombTurbine || TypeOf_Num == TypeOf_Chiller_ConstCOP || TypeOf_Num == TypeOf_Chiller_Electric || TypeOf_Num == TypeOf_Chiller_ElectricEIR || TypeOf_Num == TypeOf_Chiller_DFAbsorption || TypeOf_Num == TypeOf_Chiller_ElectricReformEIR || TypeOf_Num == TypeOf_Chiller_EngineDriven) { // Scan the supply side to find the chiller index and branch index on plantloop TypeNum = PlantLoop(LoopNum).LoopSide(DemandSide).Branch(BranchNum).Comp(CompNum).TypeOf_Num; for (LoopNum2 = 1; LoopNum2 <= NumCondLoops + NumPlantLoops; ++LoopNum2) { for (BranchNumPlantSide = 1; BranchNumPlantSide <= PlantLoop(LoopNum2).LoopSide(SupplySide).TotalBranches; ++BranchNumPlantSide) { for (CompNumPlantSide = 1; CompNumPlantSide <= PlantLoop(LoopNum2).LoopSide(SupplySide).Branch(BranchNumPlantSide).TotalComponents; ++CompNumPlantSide) { if (PlantLoop(LoopNum2) .LoopSide(SupplySide) .Branch(BranchNumPlantSide) .Comp(CompNumPlantSide) .TypeOf_Num == TypeNum) { CondEntSetPtMgr(SetPtMgrNum).LoopIndexPlantSide = LoopNum2; CondEntSetPtMgr(SetPtMgrNum).ChillerIndexPlantSide = CompNumPlantSide; CondEntSetPtMgr(SetPtMgrNum).BranchIndexPlantSide = BranchNumPlantSide; } } } } CondEntSetPtMgr(SetPtMgrNum).TypeNum = TypeNum; CondEntSetPtMgr(SetPtMgrNum).LoopIndexDemandSide = LoopNum; CondEntSetPtMgr(SetPtMgrNum).ChillerIndexDemandSide = CompNum; CondEntSetPtMgr(SetPtMgrNum).BranchIndexDemandSide = BranchNum; } } } } } } } // Ideal condenser entering water temperature reset setpoint manager cSetPointManagerType = cValidSPMTypes(iSPMType_IdealCondEntReset); NumChiller = 0; for (SetPtMgrNum = 1; SetPtMgrNum <= NumIdealCondEntSetPtMgrs; ++SetPtMgrNum) { // Scan loops and find the loop index that includes the condenser cooling tower node used as setpoint for (LoopNum = 1; LoopNum <= NumCondLoops + NumPlantLoops; ++LoopNum) { // Begin demand side loops ... When condenser is added becomes NumLoops for (CtrlNodeIndex = 1; CtrlNodeIndex <= IdealCondEntSetPtMgr(SetPtMgrNum).NumCtrlNodes; ++CtrlNodeIndex) { if (PlantLoop(LoopNum).TempSetPointNodeNum == IdealCondEntSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex)) { for (BranchNum = 1; BranchNum <= PlantLoop(LoopNum).LoopSide(SupplySide).TotalBranches; ++BranchNum) { for (CompNum = 1; CompNum <= PlantLoop(LoopNum).LoopSide(SupplySide).Branch(BranchNum).TotalComponents; ++CompNum) { // Check if cooling tower is single speed and generate and error TypeOf_Num = PlantLoop(LoopNum).LoopSide(SupplySide).Branch(BranchNum).Comp(CompNum).TypeOf_Num; if (TypeOf_Num == TypeOf_CoolingTower_SingleSpd) { ShowSevereError(cSetPointManagerType + "=\"" + IdealCondEntSetPtMgr(SetPtMgrNum).Name + "\", invalid cooling tower found"); ShowContinueError("Found Single Speed Cooling Tower, Cooling Tower=" + PlantLoop(LoopNum).LoopSide(SupplySide).Branch(BranchNum).Comp(CompNum).Name); ShowContinueError("SingleSpeed cooling towers cannot be used with this setpoint manager on each loop"); ErrorsFound = true; } else if (TypeOf_Num == TypeOf_CoolingTower_TwoSpd || TypeOf_Num == TypeOf_CoolingTower_VarSpd) { IdealCondEntSetPtMgr(SetPtMgrNum).CondTowerBranchNum.push_back(BranchNum); IdealCondEntSetPtMgr(SetPtMgrNum).TowerNum.push_back(CompNum); IdealCondEntSetPtMgr(SetPtMgrNum).numTowers++; } // Scan the pump on the condenser water loop if (TypeOf_Num == TypeOf_PumpVariableSpeed || TypeOf_Num == TypeOf_PumpConstantSpeed) { IdealCondEntSetPtMgr(SetPtMgrNum).CondPumpNum = CompNum; IdealCondEntSetPtMgr(SetPtMgrNum).CondPumpBranchNum = BranchNum; } } } // Scan all attached chillers in the condenser loop index found to find the chiller index for (BranchNum = 1; BranchNum <= PlantLoop(LoopNum).LoopSide(DemandSide).TotalBranches; ++BranchNum) { for (CompNum = 1; CompNum <= PlantLoop(LoopNum).LoopSide(DemandSide).Branch(BranchNum).TotalComponents; ++CompNum) { TypeOf_Num = PlantLoop(LoopNum).LoopSide(DemandSide).Branch(BranchNum).Comp(CompNum).TypeOf_Num; if (TypeOf_Num == TypeOf_Chiller_Absorption || TypeOf_Num == TypeOf_Chiller_Indirect_Absorption || TypeOf_Num == TypeOf_Chiller_CombTurbine || TypeOf_Num == TypeOf_Chiller_ConstCOP || TypeOf_Num == TypeOf_Chiller_Electric || TypeOf_Num == TypeOf_Chiller_ElectricEIR || TypeOf_Num == TypeOf_Chiller_DFAbsorption || TypeOf_Num == TypeOf_Chiller_ElectricReformEIR || TypeOf_Num == TypeOf_Chiller_EngineDriven) { // Scan the supply side to find the chiller index and branch index on plantloop TypeNum = PlantLoop(LoopNum).LoopSide(DemandSide).Branch(BranchNum).Comp(CompNum).TypeOf_Num; for (LoopNum2 = 1; LoopNum2 <= NumCondLoops + NumPlantLoops; ++LoopNum2) { for (BranchNumPlantSide = 1; BranchNumPlantSide <= PlantLoop(LoopNum2).LoopSide(SupplySide).TotalBranches; ++BranchNumPlantSide) { for (CompNumPlantSide = 1; CompNumPlantSide <= PlantLoop(LoopNum2).LoopSide(SupplySide).Branch(BranchNumPlantSide).TotalComponents; ++CompNumPlantSide) { TypeOf_Num = PlantLoop(LoopNum2) .LoopSide(SupplySide) .Branch(BranchNumPlantSide) .Comp(CompNumPlantSide) .TypeOf_Num; if (TypeOf_Num == TypeNum) { ++NumChiller; IdealCondEntSetPtMgr(SetPtMgrNum).LoopIndexPlantSide = LoopNum2; IdealCondEntSetPtMgr(SetPtMgrNum).ChillerIndexPlantSide = CompNumPlantSide; IdealCondEntSetPtMgr(SetPtMgrNum).BranchIndexPlantSide = BranchNumPlantSide; // Scan the pump on the chilled water loop for (BranchNum2 = 1; BranchNum2 <= PlantLoop(LoopNum2).LoopSide(SupplySide).TotalBranches; ++BranchNum2) { for (CompNum2 = 1; CompNum2 <= PlantLoop(LoopNum2).LoopSide(SupplySide).Branch(BranchNum2).TotalComponents; ++CompNum2) { TypeOf_Num = PlantLoop(LoopNum2) .LoopSide(SupplySide) .Branch(BranchNum2) .Comp(CompNum2) .TypeOf_Num; if (TypeOf_Num == TypeOf_PumpVariableSpeed || TypeOf_Num == TypeOf_PumpConstantSpeed) { IdealCondEntSetPtMgr(SetPtMgrNum).ChilledPumpNum = CompNum2; IdealCondEntSetPtMgr(SetPtMgrNum).ChilledPumpBranchNum = BranchNum2; } } } } } } } if (NumChiller > 1) { ShowSevereError(cSetPointManagerType + "=\"" + IdealCondEntSetPtMgr(SetPtMgrNum).Name + "\", too many chillers found"); ShowContinueError("only one chiller can be used with this setpoint manager on each loop"); ShowContinueError("Found more than one chiller, chiller =" + PlantLoop(LoopNum).LoopSide(DemandSide).Branch(BranchNum).Comp(CompNum).Name); ErrorsFound = true; } IdealCondEntSetPtMgr(SetPtMgrNum).TypeNum = TypeNum; IdealCondEntSetPtMgr(SetPtMgrNum).CondLoopNum = LoopNum; } } } NumChiller = 0; } } } } VerifySetPointManagers(ErrorsFound); } InitSetPointManagersOneTimeFlag = false; if (ErrorsFound) { ErrorsFound = false; ShowFatalError("InitSetPointManagers: Errors found in getting SetPointManager input."); } } if ((BeginEnvrnFlag && MyEnvrnFlag) || InitSetPointManagersOneTimeFlag2) { ManagerOn = false; for (SetPtMgrNum = 1; SetPtMgrNum <= NumSchSetPtMgrs; ++SetPtMgrNum) { for (CtrlNodeIndex = 1; CtrlNodeIndex <= SchSetPtMgr(SetPtMgrNum).NumCtrlNodes; ++CtrlNodeIndex) { NodeNum = SchSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); // Get the node number // Initialize scheduled setpoints { auto const SELECT_CASE_var(SchSetPtMgr(SetPtMgrNum).CtrlTypeMode); if (SELECT_CASE_var == iCtrlVarType_Temp) { Node(NodeNum).TempSetPoint = GetCurrentScheduleValue(SchSetPtMgr(SetPtMgrNum).SchedPtr); } else if (SELECT_CASE_var == iCtrlVarType_MaxTemp) { Node(NodeNum).TempSetPointHi = GetCurrentScheduleValue(SchSetPtMgr(SetPtMgrNum).SchedPtr); } else if (SELECT_CASE_var == iCtrlVarType_MinTemp) { Node(NodeNum).TempSetPointLo = GetCurrentScheduleValue(SchSetPtMgr(SetPtMgrNum).SchedPtr); } else if (SELECT_CASE_var == iCtrlVarType_HumRat) { Node(NodeNum).HumRatSetPoint = GetCurrentScheduleValue(SchSetPtMgr(SetPtMgrNum).SchedPtr); } else if (SELECT_CASE_var == iCtrlVarType_MaxHumRat) { Node(NodeNum).HumRatMax = GetCurrentScheduleValue(SchSetPtMgr(SetPtMgrNum).SchedPtr); } else if (SELECT_CASE_var == iCtrlVarType_MinHumRat) { Node(NodeNum).HumRatMin = GetCurrentScheduleValue(SchSetPtMgr(SetPtMgrNum).SchedPtr); } else if (SELECT_CASE_var == iCtrlVarType_MassFlow) { Node(NodeNum).MassFlowRateSetPoint = GetCurrentScheduleValue(SchSetPtMgr(SetPtMgrNum).SchedPtr); } else if (SELECT_CASE_var == iCtrlVarType_MaxMassFlow) { Node(NodeNum).MassFlowRateMax = GetCurrentScheduleValue(SchSetPtMgr(SetPtMgrNum).SchedPtr); } else if (SELECT_CASE_var == iCtrlVarType_MinMassFlow) { Node(NodeNum).MassFlowRateMin = GetCurrentScheduleValue(SchSetPtMgr(SetPtMgrNum).SchedPtr); } } } } for (SetPtMgrNum = 1; SetPtMgrNum <= NumDualSchSetPtMgrs; ++SetPtMgrNum) { for (CtrlNodeIndex = 1; CtrlNodeIndex <= DualSchSetPtMgr(SetPtMgrNum).NumCtrlNodes; ++CtrlNodeIndex) { NodeNum = DualSchSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); // Get the node number if (DualSchSetPtMgr(SetPtMgrNum).CtrlTypeMode == iCtrlVarType_Temp) { Node(NodeNum).TempSetPointHi = GetCurrentScheduleValue(DualSchSetPtMgr(SetPtMgrNum).SchedPtrHi); Node(NodeNum).TempSetPointLo = GetCurrentScheduleValue(DualSchSetPtMgr(SetPtMgrNum).SchedPtrLo); Node(NodeNum).TempSetPoint = (Node(NodeNum).TempSetPointHi + Node(NodeNum).TempSetPointLo) / 2.0; } } } for (SetPtMgrNum = 1; SetPtMgrNum <= NumOutAirSetPtMgrs; ++SetPtMgrNum) { for (CtrlNodeIndex = 1; CtrlNodeIndex <= OutAirSetPtMgr(SetPtMgrNum).NumCtrlNodes; ++CtrlNodeIndex) { OutAirSetPtMgr(SetPtMgrNum).calculate(); NodeNum = OutAirSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); // Get the node number if (OutAirSetPtMgr(SetPtMgrNum).CtrlTypeMode == iCtrlVarType_Temp) { Node(NodeNum).TempSetPoint = OutAirSetPtMgr(SetPtMgrNum).SetPt; } else if (OutAirSetPtMgr(SetPtMgrNum).CtrlTypeMode == iCtrlVarType_MaxTemp) { Node(NodeNum).TempSetPointHi = OutAirSetPtMgr(SetPtMgrNum).SetPt; } else if (OutAirSetPtMgr(SetPtMgrNum).CtrlTypeMode == iCtrlVarType_MinTemp) { Node(NodeNum).TempSetPointLo = OutAirSetPtMgr(SetPtMgrNum).SetPt; } } } for (SetPtMgrNum = 1; SetPtMgrNum <= NumSZMinHumSetPtMgrs; ++SetPtMgrNum) { // Minimum humidity setpoint managers for (ZoneIndex = 1; ZoneIndex <= SZMinHumSetPtMgr(SetPtMgrNum).NumZones; ++ZoneIndex) { ZoneNode = SZMinHumSetPtMgr(SetPtMgrNum).ZoneNodes(ZoneIndex); Node(ZoneNode).MassFlowRate = 0.0; } for (CtrlNodeIndex = 1; CtrlNodeIndex <= SZMinHumSetPtMgr(SetPtMgrNum).NumCtrlNodes; ++CtrlNodeIndex) { NodeNum = SZMinHumSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); // Get the node number Node(NodeNum).HumRatMin = 0.007; // Set the setpoint } } for (SetPtMgrNum = 1; SetPtMgrNum <= NumSZMaxHumSetPtMgrs; ++SetPtMgrNum) { // Maximum humidity setpoint managers for (ZoneIndex = 1; ZoneIndex <= SZMaxHumSetPtMgr(SetPtMgrNum).NumZones; ++ZoneIndex) { ZoneNode = SZMaxHumSetPtMgr(SetPtMgrNum).ZoneNodes(ZoneIndex); Node(ZoneNode).MassFlowRate = 0.0; } for (CtrlNodeIndex = 1; CtrlNodeIndex <= SZMaxHumSetPtMgr(SetPtMgrNum).NumCtrlNodes; ++CtrlNodeIndex) { NodeNum = SZMaxHumSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); // Get the node number Node(NodeNum).HumRatMax = 0.011; // Set the setpoint } } for (SetPtMgrNum = 1; SetPtMgrNum <= NumSZRhSetPtMgrs; ++SetPtMgrNum) { // single zone reheat setpoint managers ZoneInletNode = SingZoneRhSetPtMgr(SetPtMgrNum).ZoneInletNodeNum; ZoneNode = SingZoneRhSetPtMgr(SetPtMgrNum).ZoneNodeNum; Node(ZoneInletNode).MassFlowRate = 0.0; Node(ZoneNode).MassFlowRate = 0.0; for (CtrlNodeIndex = 1; CtrlNodeIndex <= SingZoneRhSetPtMgr(SetPtMgrNum).NumCtrlNodes; ++CtrlNodeIndex) { NodeNum = SingZoneRhSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); // Get the node number if (SingZoneRhSetPtMgr(SetPtMgrNum).CtrlTypeMode == iCtrlVarType_Temp) { Node(NodeNum).TempSetPoint = 20.0; // Set the setpoint } } } for (SetPtMgrNum = 1; SetPtMgrNum <= NumSZHtSetPtMgrs; ++SetPtMgrNum) { // single zone heating setpoint managers ZoneInletNode = SingZoneHtSetPtMgr(SetPtMgrNum).ZoneInletNodeNum; ZoneNode = SingZoneHtSetPtMgr(SetPtMgrNum).ZoneNodeNum; Node(ZoneInletNode).MassFlowRate = 0.0; Node(ZoneNode).MassFlowRate = 0.0; for (CtrlNodeIndex = 1; CtrlNodeIndex <= SingZoneHtSetPtMgr(SetPtMgrNum).NumCtrlNodes; ++CtrlNodeIndex) { NodeNum = SingZoneHtSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); // Get the node number if (SingZoneHtSetPtMgr(SetPtMgrNum).CtrlTypeMode == iCtrlVarType_Temp) { Node(NodeNum).TempSetPoint = 20.0; // Set the setpoint } } } for (SetPtMgrNum = 1; SetPtMgrNum <= NumSZClSetPtMgrs; ++SetPtMgrNum) { // single zone cooling setpoint managers ZoneInletNode = SingZoneClSetPtMgr(SetPtMgrNum).ZoneInletNodeNum; ZoneNode = SingZoneClSetPtMgr(SetPtMgrNum).ZoneNodeNum; Node(ZoneInletNode).MassFlowRate = 0.0; Node(ZoneNode).MassFlowRate = 0.0; for (CtrlNodeIndex = 1; CtrlNodeIndex <= SingZoneClSetPtMgr(SetPtMgrNum).NumCtrlNodes; ++CtrlNodeIndex) { NodeNum = SingZoneClSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); // Get the node number if (SingZoneClSetPtMgr(SetPtMgrNum).CtrlTypeMode == iCtrlVarType_Temp) { Node(NodeNum).TempSetPoint = 20.0; // Set the setpoint } } } for (SetPtMgrNum = 1; SetPtMgrNum <= NumMixedAirSetPtMgrs; ++SetPtMgrNum) { // mixed air setpoint managers Node(MixedAirSetPtMgr(SetPtMgrNum).RefNode).MassFlowRate = 0.0; Node(MixedAirSetPtMgr(SetPtMgrNum).FanInNode).MassFlowRate = 0.0; Node(MixedAirSetPtMgr(SetPtMgrNum).FanOutNode).MassFlowRate = 0.0; Node(MixedAirSetPtMgr(SetPtMgrNum).RefNode).Temp = 20.0; Node(MixedAirSetPtMgr(SetPtMgrNum).FanInNode).Temp = 20.0; Node(MixedAirSetPtMgr(SetPtMgrNum).FanOutNode).Temp = 20.0; Node(MixedAirSetPtMgr(SetPtMgrNum).RefNode).HumRat = OutHumRat; Node(MixedAirSetPtMgr(SetPtMgrNum).FanInNode).HumRat = OutHumRat; Node(MixedAirSetPtMgr(SetPtMgrNum).FanOutNode).HumRat = OutHumRat; Node(MixedAirSetPtMgr(SetPtMgrNum).RefNode).Quality = 1.0; Node(MixedAirSetPtMgr(SetPtMgrNum).FanInNode).Quality = 1.0; Node(MixedAirSetPtMgr(SetPtMgrNum).FanOutNode).Quality = 1.0; Node(MixedAirSetPtMgr(SetPtMgrNum).RefNode).Press = OutBaroPress; Node(MixedAirSetPtMgr(SetPtMgrNum).FanInNode).Press = OutBaroPress; Node(MixedAirSetPtMgr(SetPtMgrNum).FanOutNode).Press = OutBaroPress; Node(MixedAirSetPtMgr(SetPtMgrNum).RefNode).Enthalpy = PsyHFnTdbW(constant_twenty, OutHumRat); Node(MixedAirSetPtMgr(SetPtMgrNum).FanInNode).Enthalpy = PsyHFnTdbW(constant_twenty, OutHumRat); Node(MixedAirSetPtMgr(SetPtMgrNum).FanOutNode).Enthalpy = PsyHFnTdbW(constant_twenty, OutHumRat); for (CtrlNodeIndex = 1; CtrlNodeIndex <= MixedAirSetPtMgr(SetPtMgrNum).NumCtrlNodes; ++CtrlNodeIndex) { NodeNum = MixedAirSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); // Get the node number if (MixedAirSetPtMgr(SetPtMgrNum).CtrlTypeMode == iCtrlVarType_Temp) { Node(NodeNum).TempSetPoint = 20.0; // Set the setpoint } } } for (SetPtMgrNum = 1; SetPtMgrNum <= NumOAPretreatSetPtMgrs; ++SetPtMgrNum) { // Outside Air Pretreat setpoint managers Node(OAPretreatSetPtMgr(SetPtMgrNum).RefNode).MassFlowRate = 0.0; Node(OAPretreatSetPtMgr(SetPtMgrNum).MixedOutNode).MassFlowRate = 0.0; Node(OAPretreatSetPtMgr(SetPtMgrNum).OAInNode).MassFlowRate = 0.0; Node(OAPretreatSetPtMgr(SetPtMgrNum).ReturnInNode).MassFlowRate = 0.0; Node(OAPretreatSetPtMgr(SetPtMgrNum).RefNode).Temp = 20.0; Node(OAPretreatSetPtMgr(SetPtMgrNum).MixedOutNode).Temp = 20.0; Node(OAPretreatSetPtMgr(SetPtMgrNum).OAInNode).Temp = 20.0; Node(OAPretreatSetPtMgr(SetPtMgrNum).ReturnInNode).Temp = 20.0; Node(OAPretreatSetPtMgr(SetPtMgrNum).RefNode).HumRat = OutHumRat; Node(OAPretreatSetPtMgr(SetPtMgrNum).MixedOutNode).HumRat = OutHumRat; Node(OAPretreatSetPtMgr(SetPtMgrNum).OAInNode).HumRat = OutHumRat; Node(OAPretreatSetPtMgr(SetPtMgrNum).ReturnInNode).HumRat = OutHumRat; Node(OAPretreatSetPtMgr(SetPtMgrNum).RefNode).Quality = 1.0; Node(OAPretreatSetPtMgr(SetPtMgrNum).MixedOutNode).Quality = 1.0; Node(OAPretreatSetPtMgr(SetPtMgrNum).OAInNode).Quality = 1.0; Node(OAPretreatSetPtMgr(SetPtMgrNum).ReturnInNode).Quality = 1.0; Node(OAPretreatSetPtMgr(SetPtMgrNum).RefNode).Press = OutBaroPress; Node(OAPretreatSetPtMgr(SetPtMgrNum).MixedOutNode).Press = OutBaroPress; Node(OAPretreatSetPtMgr(SetPtMgrNum).OAInNode).Press = OutBaroPress; Node(OAPretreatSetPtMgr(SetPtMgrNum).ReturnInNode).Press = OutBaroPress; Node(OAPretreatSetPtMgr(SetPtMgrNum).RefNode).Enthalpy = PsyHFnTdbW(constant_twenty, OutHumRat); Node(OAPretreatSetPtMgr(SetPtMgrNum).MixedOutNode).Enthalpy = PsyHFnTdbW(constant_twenty, OutHumRat); Node(OAPretreatSetPtMgr(SetPtMgrNum).OAInNode).Enthalpy = PsyHFnTdbW(constant_twenty, OutHumRat); Node(OAPretreatSetPtMgr(SetPtMgrNum).ReturnInNode).Enthalpy = PsyHFnTdbW(constant_twenty, OutHumRat); for (CtrlNodeIndex = 1; CtrlNodeIndex <= OAPretreatSetPtMgr(SetPtMgrNum).NumCtrlNodes; ++CtrlNodeIndex) { NodeNum = OAPretreatSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); // Get the node number if (OAPretreatSetPtMgr(SetPtMgrNum).CtrlTypeMode == iCtrlVarType_Temp) { Node(NodeNum).TempSetPoint = 20.0; // Set the setpoint } if (OAPretreatSetPtMgr(SetPtMgrNum).CtrlTypeMode == iCtrlVarType_MaxHumRat) { Node(NodeNum).HumRatMax = OutHumRat; // Set the setpoint } if (OAPretreatSetPtMgr(SetPtMgrNum).CtrlTypeMode == iCtrlVarType_MinHumRat) { Node(NodeNum).HumRatMin = OutHumRat; // Set the setpoint } if (OAPretreatSetPtMgr(SetPtMgrNum).CtrlTypeMode == iCtrlVarType_HumRat) { Node(NodeNum).HumRatSetPoint = OutHumRat; // Set the setpoint } } } for (SetPtMgrNum = 1; SetPtMgrNum <= NumWarmestSetPtMgrs; ++SetPtMgrNum) { for (CtrlNodeIndex = 1; CtrlNodeIndex <= WarmestSetPtMgr(SetPtMgrNum).NumCtrlNodes; ++CtrlNodeIndex) { NodeNum = WarmestSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); // Get the node number if (WarmestSetPtMgr(SetPtMgrNum).CtrlTypeMode == iCtrlVarType_Temp) { Node(NodeNum).TempSetPoint = 20.0; // Set the setpoint } } } for (SetPtMgrNum = 1; SetPtMgrNum <= NumColdestSetPtMgrs; ++SetPtMgrNum) { for (CtrlNodeIndex = 1; CtrlNodeIndex <= ColdestSetPtMgr(SetPtMgrNum).NumCtrlNodes; ++CtrlNodeIndex) { NodeNum = ColdestSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); // Get the node number if (ColdestSetPtMgr(SetPtMgrNum).CtrlTypeMode == iCtrlVarType_Temp) { Node(NodeNum).TempSetPoint = 20.0; // Set the setpoint } } } for (SetPtMgrNum = 1; SetPtMgrNum <= NumWarmestSetPtMgrsTempFlow; ++SetPtMgrNum) { for (CtrlNodeIndex = 1; CtrlNodeIndex <= WarmestSetPtMgrTempFlow(SetPtMgrNum).NumCtrlNodes; ++CtrlNodeIndex) { NodeNum = WarmestSetPtMgrTempFlow(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); // Get the node number if (WarmestSetPtMgrTempFlow(SetPtMgrNum).CtrlTypeMode == iCtrlVarType_Temp) { Node(NodeNum).TempSetPoint = 20.0; // Set the temperature setpoint if (WarmestSetPtMgrTempFlow(SetPtMgrNum).AirLoopNum != 0) { AirLoopFlow(WarmestSetPtMgrTempFlow(SetPtMgrNum).AirLoopNum).ReqSupplyFrac = 1.0; // PH 10/09/04 Set the flow AirLoopControlInfo(WarmestSetPtMgrTempFlow(SetPtMgrNum).AirLoopNum).LoopFlowRateSet = true; // PH 10/09/04 Set the flag } } } } if (ZoneEquipInputsFilled && AirLoopInputsFilled) { for (SetPtMgrNum = 1; SetPtMgrNum <= NumRABFlowSetPtMgrs; ++SetPtMgrNum) { NodeNum = RABFlowSetPtMgr(SetPtMgrNum).RABSplitOutNode; if (RABFlowSetPtMgr(SetPtMgrNum).CtrlTypeMode == iCtrlVarType_MassFlow) { Node(NodeNum).MassFlowRateSetPoint = 0.0; } } } for (SetPtMgrNum = 1; SetPtMgrNum <= NumMZClgAverageSetPtMgrs; ++SetPtMgrNum) { for (CtrlNodeIndex = 1; CtrlNodeIndex <= MZAverageCoolingSetPtMgr(SetPtMgrNum).NumCtrlNodes; ++CtrlNodeIndex) { NodeNum = MZAverageCoolingSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); // Get the node number if (MZAverageCoolingSetPtMgr(SetPtMgrNum).CtrlTypeMode == iCtrlVarType_Temp) { Node(NodeNum).TempSetPoint = 20.0; // Set the setpoint } } } for (SetPtMgrNum = 1; SetPtMgrNum <= NumMZHtgAverageSetPtMgrs; ++SetPtMgrNum) { for (CtrlNodeIndex = 1; CtrlNodeIndex <= MZAverageHeatingSetPtMgr(SetPtMgrNum).NumCtrlNodes; ++CtrlNodeIndex) { NodeNum = MZAverageHeatingSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); // Get the node number if (MZAverageHeatingSetPtMgr(SetPtMgrNum).CtrlTypeMode == iCtrlVarType_Temp) { Node(NodeNum).TempSetPoint = 20.0; // Set the setpoint } } } for (SetPtMgrNum = 1; SetPtMgrNum <= NumMZAverageMinHumSetPtMgrs; ++SetPtMgrNum) { for (CtrlNodeIndex = 1; CtrlNodeIndex <= MZAverageMinHumSetPtMgr(SetPtMgrNum).NumCtrlNodes; ++CtrlNodeIndex) { NodeNum = MZAverageMinHumSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); // Get the node number Node(NodeNum).HumRatMin = 0.007; // Set the setpoint } } for (SetPtMgrNum = 1; SetPtMgrNum <= NumMZAverageMaxHumSetPtMgrs; ++SetPtMgrNum) { for (CtrlNodeIndex = 1; CtrlNodeIndex <= MZAverageMaxHumSetPtMgr(SetPtMgrNum).NumCtrlNodes; ++CtrlNodeIndex) { NodeNum = MZAverageMaxHumSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); // Get the node number Node(NodeNum).HumRatMax = 0.011; // Set the setpoint } } for (SetPtMgrNum = 1; SetPtMgrNum <= NumMZMinHumSetPtMgrs; ++SetPtMgrNum) { for (CtrlNodeIndex = 1; CtrlNodeIndex <= MZMinHumSetPtMgr(SetPtMgrNum).NumCtrlNodes; ++CtrlNodeIndex) { NodeNum = MZMinHumSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); // Get the node number Node(NodeNum).HumRatMin = 0.007; // Set the setpoint } } for (SetPtMgrNum = 1; SetPtMgrNum <= NumMZMaxHumSetPtMgrs; ++SetPtMgrNum) { for (CtrlNodeIndex = 1; CtrlNodeIndex <= MZMaxHumSetPtMgr(SetPtMgrNum).NumCtrlNodes; ++CtrlNodeIndex) { NodeNum = MZMaxHumSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); // Get the node number Node(NodeNum).HumRatMax = 0.011; // Set the setpoint } } for (SetPtMgrNum = 1; SetPtMgrNum <= NumFollowOATempSetPtMgrs; ++SetPtMgrNum) { for (CtrlNodeIndex = 1; CtrlNodeIndex <= FollowOATempSetPtMgr(SetPtMgrNum).NumCtrlNodes; ++CtrlNodeIndex) { NodeNum = FollowOATempSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); // Get the node number if (FollowOATempSetPtMgr(SetPtMgrNum).RefTypeMode == iRefTempType_WetBulb) { if (FollowOATempSetPtMgr(SetPtMgrNum).CtrlTypeMode == iCtrlVarType_Temp) { Node(NodeNum).TempSetPoint = OutWetBulbTemp; // Set the setpoint } else if (FollowOATempSetPtMgr(SetPtMgrNum).CtrlTypeMode == iCtrlVarType_MaxTemp) { Node(NodeNum).TempSetPointHi = OutWetBulbTemp; // Set the setpoint } else if (FollowOATempSetPtMgr(SetPtMgrNum).CtrlTypeMode == iCtrlVarType_MinTemp) { Node(NodeNum).TempSetPointLo = OutWetBulbTemp; // Set the setpoint } } else if (FollowOATempSetPtMgr(SetPtMgrNum).RefTypeMode == iRefTempType_DryBulb) { if (FollowOATempSetPtMgr(SetPtMgrNum).CtrlTypeMode == iCtrlVarType_Temp) { Node(NodeNum).TempSetPoint = OutDryBulbTemp; // Set the setpoint } else if (FollowOATempSetPtMgr(SetPtMgrNum).CtrlTypeMode == iCtrlVarType_MaxTemp) { Node(NodeNum).TempSetPointHi = OutDryBulbTemp; // Set the setpoint } else if (FollowOATempSetPtMgr(SetPtMgrNum).CtrlTypeMode == iCtrlVarType_MinTemp) { Node(NodeNum).TempSetPointLo = OutDryBulbTemp; // Set the setpoint } } } } for (SetPtMgrNum = 1; SetPtMgrNum <= NumFollowSysNodeTempSetPtMgrs; ++SetPtMgrNum) { for (CtrlNodeIndex = 1; CtrlNodeIndex <= FollowSysNodeTempSetPtMgr(SetPtMgrNum).NumCtrlNodes; ++CtrlNodeIndex) { NodeNum = FollowSysNodeTempSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); // Get the node number if (CheckOutAirNodeNumber(FollowSysNodeTempSetPtMgr(SetPtMgrNum).RefNodeNum)) { if (FollowSysNodeTempSetPtMgr(SetPtMgrNum).RefTypeMode == iRefTempType_WetBulb) { Node(FollowSysNodeTempSetPtMgr(SetPtMgrNum).RefNodeNum).SPMNodeWetBulbRepReq = true; if (FollowSysNodeTempSetPtMgr(SetPtMgrNum).CtrlTypeMode == iCtrlVarType_Temp) { Node(NodeNum).TempSetPoint = OutWetBulbTemp; // Set the setpoint } else if (FollowSysNodeTempSetPtMgr(SetPtMgrNum).CtrlTypeMode == iCtrlVarType_MaxTemp) { Node(NodeNum).TempSetPointHi = OutWetBulbTemp; // Set the setpoint } else if (FollowSysNodeTempSetPtMgr(SetPtMgrNum).CtrlTypeMode == iCtrlVarType_MinTemp) { Node(NodeNum).TempSetPointLo = OutWetBulbTemp; // Set the setpoint } } else if (FollowSysNodeTempSetPtMgr(SetPtMgrNum).RefTypeMode == iRefTempType_DryBulb) { if (FollowSysNodeTempSetPtMgr(SetPtMgrNum).CtrlTypeMode == iCtrlVarType_Temp) { Node(NodeNum).TempSetPoint = OutDryBulbTemp; // Set the setpoint } else if (FollowSysNodeTempSetPtMgr(SetPtMgrNum).CtrlTypeMode == iCtrlVarType_MaxTemp) { Node(NodeNum).TempSetPointHi = OutDryBulbTemp; // Set the setpoint } else if (FollowSysNodeTempSetPtMgr(SetPtMgrNum).CtrlTypeMode == iCtrlVarType_MinTemp) { Node(NodeNum).TempSetPointLo = OutDryBulbTemp; // Set the setpoint } } } else { // If reference node is a water node, then set RefTypeMode to NodeDryBulb if (Node(FollowSysNodeTempSetPtMgr(SetPtMgrNum).RefNodeNum).FluidType == NodeType_Water) { FollowSysNodeTempSetPtMgr(SetPtMgrNum).RefTypeMode = iRefTempType_DryBulb; } else if (Node(FollowSysNodeTempSetPtMgr(SetPtMgrNum).RefNodeNum).FluidType == NodeType_Air) { if (FollowSysNodeTempSetPtMgr(SetPtMgrNum).RefTypeMode == iRefTempType_WetBulb) { Node(FollowSysNodeTempSetPtMgr(SetPtMgrNum).RefNodeNum).SPMNodeWetBulbRepReq = true; } } if (FollowSysNodeTempSetPtMgr(SetPtMgrNum).CtrlTypeMode == iCtrlVarType_Temp) { Node(NodeNum).TempSetPoint = 20.0; // Set the setpoint } else if (FollowSysNodeTempSetPtMgr(SetPtMgrNum).CtrlTypeMode == iCtrlVarType_MaxTemp) { Node(NodeNum).TempSetPointHi = 20.0; // Set the setpoint } else if (FollowSysNodeTempSetPtMgr(SetPtMgrNum).CtrlTypeMode == iCtrlVarType_MinTemp) { Node(NodeNum).TempSetPointLo = 20.0; // Set the setpoint } } } } for (SetPtMgrNum = 1; SetPtMgrNum <= NumGroundTempSetPtMgrs; ++SetPtMgrNum) { for (CtrlNodeIndex = 1; CtrlNodeIndex <= GroundTempSetPtMgr(SetPtMgrNum).NumCtrlNodes; ++CtrlNodeIndex) { NodeNum = GroundTempSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); // Get the node number if (GroundTempSetPtMgr(SetPtMgrNum).RefTypeMode == iRefGroundTempObjType_BuildingSurface) { if (GroundTempSetPtMgr(SetPtMgrNum).CtrlTypeMode == iCtrlVarType_Temp) { Node(NodeNum).TempSetPoint = GroundTemp; // Set the setpoint } else if (GroundTempSetPtMgr(SetPtMgrNum).CtrlTypeMode == iCtrlVarType_MaxTemp) { Node(NodeNum).TempSetPointHi = GroundTemp; // Set the setpoint } else if (GroundTempSetPtMgr(SetPtMgrNum).CtrlTypeMode == iCtrlVarType_MinTemp) { Node(NodeNum).TempSetPointLo = GroundTemp; // Set the setpoint } } else if (GroundTempSetPtMgr(SetPtMgrNum).RefTypeMode == iRefGroundTempObjType_Shallow) { if (GroundTempSetPtMgr(SetPtMgrNum).CtrlTypeMode == iCtrlVarType_Temp) { Node(NodeNum).TempSetPoint = GroundTemp_Surface; // Set the setpoint } else if (GroundTempSetPtMgr(SetPtMgrNum).CtrlTypeMode == iCtrlVarType_MaxTemp) { Node(NodeNum).TempSetPointHi = GroundTemp_Surface; // Set the setpoint } else if (GroundTempSetPtMgr(SetPtMgrNum).CtrlTypeMode == iCtrlVarType_MinTemp) { Node(NodeNum).TempSetPointLo = GroundTemp_Surface; // Set the setpoint } } else if (GroundTempSetPtMgr(SetPtMgrNum).RefTypeMode == iRefGroundTempObjType_Deep) { if (GroundTempSetPtMgr(SetPtMgrNum).CtrlTypeMode == iCtrlVarType_Temp) { Node(NodeNum).TempSetPoint = GroundTemp_Deep; // Set the setpoint } else if (GroundTempSetPtMgr(SetPtMgrNum).CtrlTypeMode == iCtrlVarType_MaxTemp) { Node(NodeNum).TempSetPointHi = GroundTemp_Deep; // Set the setpoint } else if (GroundTempSetPtMgr(SetPtMgrNum).CtrlTypeMode == iCtrlVarType_MinTemp) { Node(NodeNum).TempSetPointLo = GroundTemp_Deep; // Set the setpoint } } else if (GroundTempSetPtMgr(SetPtMgrNum).RefTypeMode == iRefGroundTempObjType_FCfactorMethod) { if (GroundTempSetPtMgr(SetPtMgrNum).CtrlTypeMode == iCtrlVarType_Temp) { Node(NodeNum).TempSetPoint = GroundTempFC; // Set the setpoint } else if (GroundTempSetPtMgr(SetPtMgrNum).CtrlTypeMode == iCtrlVarType_MaxTemp) { Node(NodeNum).TempSetPointHi = GroundTempFC; // Set the setpoint } else if (GroundTempSetPtMgr(SetPtMgrNum).CtrlTypeMode == iCtrlVarType_MinTemp) { Node(NodeNum).TempSetPointLo = GroundTempFC; // Set the setpoint } } } } for (SetPtMgrNum = 1; SetPtMgrNum <= NumCondEntSetPtMgrs; ++SetPtMgrNum) { // Condenser entering water Set point managers for (CtrlNodeIndex = 1; CtrlNodeIndex <= CondEntSetPtMgr(SetPtMgrNum).NumCtrlNodes; ++CtrlNodeIndex) { NodeNum = CondEntSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); // Get the node number if (CondEntSetPtMgr(SetPtMgrNum).CtrlTypeMode == iCtrlVarType_Temp) { Node(NodeNum).TempSetPoint = GetCurrentScheduleValue(CondEntSetPtMgr(SetPtMgrNum).CondEntTempSchedPtr); } } } for (SetPtMgrNum = 1; SetPtMgrNum <= NumIdealCondEntSetPtMgrs; ++SetPtMgrNum) { // Ideal Condenser entering water Set point managers for (CtrlNodeIndex = 1; CtrlNodeIndex <= IdealCondEntSetPtMgr(SetPtMgrNum).NumCtrlNodes; ++CtrlNodeIndex) { NodeNum = IdealCondEntSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); // Get the node number if (IdealCondEntSetPtMgr(SetPtMgrNum).CtrlTypeMode == iCtrlVarType_Temp) { Node(NodeNum).TempSetPoint = IdealCondEntSetPtMgr(SetPtMgrNum).MaxCondEntTemp; } } } for (SetPtMgrNum = 1; SetPtMgrNum <= NumSZOneStageCoolingSetPtMgrs; ++SetPtMgrNum) { for (CtrlNodeIndex = 1; CtrlNodeIndex <= SZOneStageCoolingSetPtMgr(SetPtMgrNum).NumCtrlNodes; ++CtrlNodeIndex) { NodeNum = SZOneStageCoolingSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); // Get the node number if (SZOneStageCoolingSetPtMgr(SetPtMgrNum).CtrlTypeMode == iCtrlVarType_Temp) { Node(NodeNum).TempSetPoint = SZOneStageCoolingSetPtMgr(SetPtMgrNum).CoolingOffTemp; } } } for (SetPtMgrNum = 1; SetPtMgrNum <= NumSZOneStageHeatingSetPtMgrs; ++SetPtMgrNum) { for (CtrlNodeIndex = 1; CtrlNodeIndex <= SZOneStageHeatingSetPtMgr(SetPtMgrNum).NumCtrlNodes; ++CtrlNodeIndex) { NodeNum = SZOneStageHeatingSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); // Get the node number if (SZOneStageHeatingSetPtMgr(SetPtMgrNum).CtrlTypeMode == iCtrlVarType_Temp) { Node(NodeNum).TempSetPoint = SZOneStageHeatingSetPtMgr(SetPtMgrNum).HeatingOffTemp; } } } for (SetPtMgrNum = 1; SetPtMgrNum <= NumReturnWaterResetChWSetPtMgrs; ++SetPtMgrNum) { Node(ReturnWaterResetChWSetPtMgr(SetPtMgrNum).supplyNodeIndex).TempSetPoint = ReturnWaterResetChWSetPtMgr(SetPtMgrNum).minimumChilledWaterSetpoint; } for (SetPtMgrNum = 1; SetPtMgrNum <= NumReturnWaterResetHWSetPtMgrs; ++SetPtMgrNum) { Node(ReturnWaterResetHWSetPtMgr(SetPtMgrNum).supplyNodeIndex).TempSetPoint = ReturnWaterResetHWSetPtMgr(SetPtMgrNum).maximumHotWaterSetpoint; } MyEnvrnFlag = false; if (!InitSetPointManagersOneTimeFlag) InitSetPointManagersOneTimeFlag2 = false; if (ErrorsFound) { ShowFatalError("InitSetPointManagers: Errors found. Program Terminates."); } } // end begin environment inits if (!BeginEnvrnFlag) { MyEnvrnFlag = true; } } void SimSetPointManagers() { // SUBROUTINE INFORMATION: // AUTHOR Fred Buhl // DATE WRITTEN July 1998 // MODIFIED Shirey/Raustad (FSEC), Jan 2004 // Nov 2004 M. J. Witte, GARD Analytics, Inc. // Add new setpoint managers: // SET POINT MANAGER:SINGLE ZONE HEATING and // SET POINT MANAGER:SINGLE ZONE COOLING // Work supported by ASHRAE research project 1254-RP // Haves Oct 2004 // July 2010 B.A. Nigusse, FSEC/UCF // Added new setpoint managers // SetpointManager:MultiZone:Heating:Average // SetpointManager:MultiZone:Cooling:Average // SetpointManager:MultiZone:MinimumHumidity:Average // SetpointManager:MultiZone:MaximumHumidity:Average // Aug 2010 B.A. Nigusse, FSEC/UCF // Added new setpoint managers: // SetpointManager:MultiZone:Humidity:Minimum // SetpointManager:MultiZone:Humidity:Maximum // Aug 2014 Rick Strand, UIUC // SetpointManager:ScheduleTES (internally defined) // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE // Loop over all the Setpoint Managers and invoke the correct // Setpoint Manager algorithm. // METHODOLOGY EMPLOYED: // REFERENCES: // na // USE STATEMENTS: // Locals // SUBROUTINE PARAMETER DEFINITIONS: // na // INTERFACE BLOCK SPECIFICATIONS // na // DERIVED TYPE DEFINITIONS // na // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int SetPtMgrNum; // Execute all the Setpoint Managers // The Scheduled Setpoint Managers for (SetPtMgrNum = 1; SetPtMgrNum <= NumSchSetPtMgrs; ++SetPtMgrNum) { SchSetPtMgr(SetPtMgrNum).calculate(); } // The Scheduled TES Setpoint Managers for (SetPtMgrNum = 1; SetPtMgrNum <= NumSchTESSetPtMgrs; ++SetPtMgrNum) { SchTESSetPtMgr(SetPtMgrNum).calculate(); } // The Scheduled Dual Setpoint Managers for (SetPtMgrNum = 1; SetPtMgrNum <= NumDualSchSetPtMgrs; ++SetPtMgrNum) { DualSchSetPtMgr(SetPtMgrNum).calculate(); } // The Outside Air Setpoint Managers for (SetPtMgrNum = 1; SetPtMgrNum <= NumOutAirSetPtMgrs; ++SetPtMgrNum) { OutAirSetPtMgr(SetPtMgrNum).calculate(); } // The Single Zone Reheat Setpoint Managers for (SetPtMgrNum = 1; SetPtMgrNum <= NumSZRhSetPtMgrs; ++SetPtMgrNum) { SingZoneRhSetPtMgr(SetPtMgrNum).calculate(); } // The Single Zone Heating Setpoint Managers for (SetPtMgrNum = 1; SetPtMgrNum <= NumSZHtSetPtMgrs; ++SetPtMgrNum) { SingZoneHtSetPtMgr(SetPtMgrNum).calculate(); } // The Single Zone Cooling Setpoint Managers for (SetPtMgrNum = 1; SetPtMgrNum <= NumSZClSetPtMgrs; ++SetPtMgrNum) { SingZoneClSetPtMgr(SetPtMgrNum).calculate(); } // The Single Zone Minimum Humidity Setpoint Managers for (SetPtMgrNum = 1; SetPtMgrNum <= NumSZMinHumSetPtMgrs; ++SetPtMgrNum) { SZMinHumSetPtMgr(SetPtMgrNum).calculate(); } // The Single Zone Maximum Humidity Setpoint Managers for (SetPtMgrNum = 1; SetPtMgrNum <= NumSZMaxHumSetPtMgrs; ++SetPtMgrNum) { SZMaxHumSetPtMgr(SetPtMgrNum).calculate(); } // The Warmest Setpoint Managers for (SetPtMgrNum = 1; SetPtMgrNum <= NumWarmestSetPtMgrs; ++SetPtMgrNum) { WarmestSetPtMgr(SetPtMgrNum).calculate(); } // The Coldest Setpoint Managers for (SetPtMgrNum = 1; SetPtMgrNum <= NumColdestSetPtMgrs; ++SetPtMgrNum) { ColdestSetPtMgr(SetPtMgrNum).calculate(); } // The Warmest Temp Flow Setpoint Managers for (SetPtMgrNum = 1; SetPtMgrNum <= NumWarmestSetPtMgrsTempFlow; ++SetPtMgrNum) { WarmestSetPtMgrTempFlow(SetPtMgrNum).calculate(); } // The RAB Temp Flow Setpoint Managers for (SetPtMgrNum = 1; SetPtMgrNum <= NumRABFlowSetPtMgrs; ++SetPtMgrNum) { RABFlowSetPtMgr(SetPtMgrNum).calculate(); } // The Multizone Average Cooling Setpoint Managers for (SetPtMgrNum = 1; SetPtMgrNum <= NumMZClgAverageSetPtMgrs; ++SetPtMgrNum) { MZAverageCoolingSetPtMgr(SetPtMgrNum).calculate(); } // The Multizone Average Heating Setpoint Managers for (SetPtMgrNum = 1; SetPtMgrNum <= NumMZHtgAverageSetPtMgrs; ++SetPtMgrNum) { MZAverageHeatingSetPtMgr(SetPtMgrNum).calculate(); } // The Multizone Average Minimum Humidity Setpoint Managers for (SetPtMgrNum = 1; SetPtMgrNum <= NumMZAverageMinHumSetPtMgrs; ++SetPtMgrNum) { MZAverageMinHumSetPtMgr(SetPtMgrNum).calculate(); } // The Multizone Average Maximum Humidity Setpoint Managers for (SetPtMgrNum = 1; SetPtMgrNum <= NumMZAverageMaxHumSetPtMgrs; ++SetPtMgrNum) { MZAverageMaxHumSetPtMgr(SetPtMgrNum).calculate(); } // The Multizone Minimum Humidity Ratio Setpoint Managers for (SetPtMgrNum = 1; SetPtMgrNum <= NumMZMinHumSetPtMgrs; ++SetPtMgrNum) { MZMinHumSetPtMgr(SetPtMgrNum).calculate(); } // The Multizone Maximum Humidity Ratio Setpoint Managers for (SetPtMgrNum = 1; SetPtMgrNum <= NumMZMaxHumSetPtMgrs; ++SetPtMgrNum) { MZMaxHumSetPtMgr(SetPtMgrNum).calculate(); } // The Follow Outdoor Air Temperature Setpoint Managers for (SetPtMgrNum = 1; SetPtMgrNum <= NumFollowOATempSetPtMgrs; ++SetPtMgrNum) { FollowOATempSetPtMgr(SetPtMgrNum).calculate(); } // The Follow System Node Temp Setpoint Managers for (SetPtMgrNum = 1; SetPtMgrNum <= NumFollowSysNodeTempSetPtMgrs; ++SetPtMgrNum) { FollowSysNodeTempSetPtMgr(SetPtMgrNum).calculate(); } // The Ground Temp Setpoint Managers for (SetPtMgrNum = 1; SetPtMgrNum <= NumGroundTempSetPtMgrs; ++SetPtMgrNum) { GroundTempSetPtMgr(SetPtMgrNum).calculate(); } // The Condenser Entering Water Temperature Set Point Managers for (SetPtMgrNum = 1; SetPtMgrNum <= NumCondEntSetPtMgrs; ++SetPtMgrNum) { CondEntSetPtMgr(SetPtMgrNum).calculate(); } // The Ideal Condenser Entering Water Temperature Set Point Managers for (SetPtMgrNum = 1; SetPtMgrNum <= NumIdealCondEntSetPtMgrs; ++SetPtMgrNum) { IdealCondEntSetPtMgr(SetPtMgrNum).calculate(); } // the single zone cooling on/off staged control setpoint managers for (SetPtMgrNum = 1; SetPtMgrNum <= NumSZOneStageCoolingSetPtMgrs; ++SetPtMgrNum) { SZOneStageCoolingSetPtMgr(SetPtMgrNum).calculate(); } // the single zone heating on/off staged control setpoint managers for (SetPtMgrNum = 1; SetPtMgrNum <= NumSZOneStageHeatingSetPtMgrs; ++SetPtMgrNum) { SZOneStageHeatingSetPtMgr(SetPtMgrNum).calculate(); } // return water reset for (SetPtMgrNum = 1; SetPtMgrNum <= NumReturnWaterResetChWSetPtMgrs; ++SetPtMgrNum) { auto &returnWaterSPM(ReturnWaterResetChWSetPtMgr(SetPtMgrNum)); returnWaterSPM.calculate(Node(returnWaterSPM.returnNodeIndex), Node(returnWaterSPM.supplyNodeIndex)); } // hot-water return water reset for (SetPtMgrNum = 1; SetPtMgrNum <= NumReturnWaterResetHWSetPtMgrs; ++SetPtMgrNum) { auto &returnWaterSPM(ReturnWaterResetHWSetPtMgr(SetPtMgrNum)); returnWaterSPM.calculate(Node(returnWaterSPM.returnNodeIndex), Node(returnWaterSPM.supplyNodeIndex)); } } void DefineScheduledSetPointManager::calculate() { // SUBROUTINE INFORMATION: // AUTHOR Fred Buhl // DATE WRITTEN July 1998 // MODIFIED na // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Set the setpoint using a simple schedule. // METHODOLOGY EMPLOYED: // REFERENCES: // na // USE STATEMENTS: // Locals // SUBROUTINE ARGUMENTS: this->SetPt = GetCurrentScheduleValue(this->SchedPtr); } void DefineScheduledTESSetPointManager::calculate() { // SUBROUTINE INFORMATION: // AUTHOR Rick Strand // DATE WRITTEN Aug 2014 // MODIFIED na // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Set the setpoint using a simple schedule, then modify the value based on TES simple controls logic // METHODOLOGY EMPLOYED: // Modified schedule setpoint manager logic // Locals Real64 CurSchValOnPeak; Real64 CurSchValCharge; Real64 const OnVal(0.5); int const CoolOpComp(1); // a component that cools only (chillers) int const DualOpComp(2); // a component that heats or cools (ice storage tank) CurSchValOnPeak = GetCurrentScheduleValue(this->SchedPtr); CurSchValCharge = GetCurrentScheduleValue(this->SchedPtrCharge); if (this->CompOpType == CoolOpComp) { // this is some sort of chiller if (CurSchValOnPeak >= OnVal) { this->SetPt = this->NonChargeCHWTemp; } else if (CurSchValCharge < OnVal) { this->SetPt = this->NonChargeCHWTemp; } else { this->SetPt = this->ChargeCHWTemp; } } else if (this->CompOpType == DualOpComp) { // this is some sort of ice storage system this->SetPt = this->NonChargeCHWTemp; } } void DefineSchedDualSetPointManager::calculate() { // SUBROUTINE INFORMATION: // AUTHOR Richard Liesen // DATE WRITTEN May 2004 // MODIFIED na // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Set the both setpoint using a simple schedule. // METHODOLOGY EMPLOYED: // REFERENCES: // na // USE STATEMENTS: // Locals // SUBROUTINE ARGUMENTS: this->SetPtHi = GetCurrentScheduleValue(this->SchedPtrHi); this->SetPtLo = GetCurrentScheduleValue(this->SchedPtrLo); } void DefineOutsideAirSetPointManager::calculate() { // SUBROUTINE ARGUMENTS: // Locals // SUBROUTINE PARAMETER DEFINITIONS: // na // INTERFACE BLOCK SPECIFICATIONS // na // DERIVED TYPE DEFINITIONS // na // SUBROUTINE LOCAL VARIABLE DECLARATIONS: Real64 SchedVal; Real64 OutLowTemp; Real64 OutHighTemp; Real64 SetTempAtOutLow; Real64 SetTempAtOutHigh; if (this->SchedPtr > 0) { SchedVal = GetCurrentScheduleValue(this->SchedPtr); } else { SchedVal = 0.0; } if (SchedVal == 2.0) { OutLowTemp = this->OutLow2; OutHighTemp = this->OutHigh2; SetTempAtOutLow = this->OutLowSetPt2; SetTempAtOutHigh = this->OutHighSetPt2; } else { OutLowTemp = this->OutLow1; OutHighTemp = this->OutHigh1; SetTempAtOutLow = this->OutLowSetPt1; SetTempAtOutHigh = this->OutHighSetPt1; } this->SetPt = CalcSetPoint(OutLowTemp, OutHighTemp, OutDryBulbTemp, SetTempAtOutLow, SetTempAtOutHigh); } Real64 DefineOutsideAirSetPointManager::CalcSetPoint( Real64 OutLowTemp, Real64 OutHighTemp, Real64 OutDryBulbTemp, Real64 SetTempAtOutLow, Real64 SetTempAtOutHigh) { Real64 SetPt; if (OutLowTemp < OutHighTemp) { // && SetTempAtOutLow > SetTempAtOutHigh if (OutDryBulbTemp <= OutLowTemp) { SetPt = SetTempAtOutLow; } else if (OutDryBulbTemp >= OutHighTemp) { SetPt = SetTempAtOutHigh; } else { SetPt = SetTempAtOutLow - ((OutDryBulbTemp - OutLowTemp) / (OutHighTemp - OutLowTemp)) * (SetTempAtOutLow - SetTempAtOutHigh); } } else { SetPt = 0.5 * (SetTempAtOutLow + SetTempAtOutHigh); } return SetPt; } void DefineSZReheatSetPointManager::calculate() { // SUBROUTINE INFORMATION: // AUTHOR Fred Buhl // DATE WRITTEN May 2000 // MODIFIED na // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // From the heating or cooling load of the control zone, calculate the supply air setpoint // needed to meet that zone load // METHODOLOGY EMPLOYED: // na // REFERENCES: // na // Using/Aliasing using namespace DataZoneEnergyDemands; using DataHVACGlobals::SmallLoad; using DataHVACGlobals::SmallMassFlow; using Psychrometrics::PsyTdbFnHW; // Locals // SUBROUTINE ARGUMENT DEFINITIONS: // SUBROUTINE PARAMETER DEFINITIONS: // INTERFACE BLOCK SPECIFICATIONS // DERIVED TYPE DEFINITIONS // na // SUBROUTINE LOCAL VARIABLE DECLARATIONS: Real64 ZoneLoad; // required zone load [W] Real64 ZoneMassFlow; // zone inlet mass flow rate [kg/s] Real64 CpAir; // inlet air specific heat [J/kg-C] int ZoneInletNode; int ZoneNode; int ZoneNum; Real64 ZoneTemp; Real64 ZoneLoadToCoolSetPt; Real64 ZoneLoadToHeatSetPt; Real64 TSetPt; Real64 TSetPt1; Real64 TSetPt2; bool DeadBand; int FanNodeIn; int FanNodeOut; int RetNode; int OAMixOAInNode; Real64 FanDeltaT; static Real64 TSupNoHC(0.0); // supply temperature with no heating or cooling Real64 TMixAtMinOA; Real64 EnthMixAtMinOA; Real64 HumRatMixAtMinOA; int AirLoopNum; Real64 OAFrac; int LoopInNode; static Real64 ExtrRateNoHC(0.0); // the heating (>0) or cooling (<0) that can be done by supply air at TSupNoHC [W] ZoneInletNode = this->ZoneInletNodeNum; ZoneNum = this->ControlZoneNum; ZoneNode = this->ZoneNodeNum; FanNodeIn = this->FanNodeIn; FanNodeOut = this->FanNodeOut; RetNode = this->RetNode; OAMixOAInNode = this->OAInNode; AirLoopNum = this->AirLoopNum; OAFrac = AirLoopFlow(AirLoopNum).OAFrac; // changed from MinOAFrac, now updates to current oa fraction for improve deadband control ZoneMassFlow = Node(ZoneInletNode).MassFlowRate; ZoneLoad = ZoneSysEnergyDemand(ZoneNum).TotalOutputRequired; ZoneLoadToCoolSetPt = ZoneSysEnergyDemand(ZoneNum).OutputRequiredToCoolingSP; ZoneLoadToHeatSetPt = ZoneSysEnergyDemand(ZoneNum).OutputRequiredToHeatingSP; DeadBand = DeadBandOrSetback(ZoneNum); ZoneTemp = Node(ZoneNode).Temp; LoopInNode = this->LoopInNode; if (OAMixOAInNode > 0) { HumRatMixAtMinOA = (1.0 - OAFrac) * Node(RetNode).HumRat + OAFrac * Node(OAMixOAInNode).HumRat; EnthMixAtMinOA = (1.0 - OAFrac) * Node(RetNode).Enthalpy + OAFrac * Node(OAMixOAInNode).Enthalpy; TMixAtMinOA = PsyTdbFnHW(EnthMixAtMinOA, HumRatMixAtMinOA); } else { TMixAtMinOA = Node(LoopInNode).Temp; } if (FanNodeOut > 0 && FanNodeIn > 0) { FanDeltaT = Node(FanNodeOut).Temp - Node(FanNodeIn).Temp; } else { FanDeltaT = 0.0; } TSupNoHC = TMixAtMinOA + FanDeltaT; CpAir = PsyCpAirFnWTdb(Node(ZoneInletNode).HumRat, Node(ZoneInletNode).Temp); ExtrRateNoHC = CpAir * ZoneMassFlow * (TSupNoHC - ZoneTemp); if (ZoneMassFlow <= SmallMassFlow) { TSetPt = TSupNoHC; } else if (DeadBand || std::abs(ZoneLoad) < SmallLoad) { // if air with no active heating or cooling provides cooling if (ExtrRateNoHC < 0.0) { // if still in deadband, do no active heating or cooling; // if below heating setpoint, set a supply temp that will cool to the heating setpoint if (ExtrRateNoHC >= ZoneLoadToHeatSetPt) { TSetPt = TSupNoHC; } else { TSetPt = ZoneTemp + ZoneLoadToHeatSetPt / (CpAir * ZoneMassFlow); } // if air with no active heating or cooling provides heating } else if (ExtrRateNoHC > 0.0) { // if still in deadband, do no active heating or cooling; // if above cooling setpoint, set a supply temp that will heat to the cooling setpoint if (ExtrRateNoHC <= ZoneLoadToCoolSetPt) { TSetPt = TSupNoHC; } else { TSetPt = ZoneTemp + ZoneLoadToCoolSetPt / (CpAir * ZoneMassFlow); } } else { TSetPt = TSupNoHC; } } else if (ZoneLoad < (-1.0 * SmallLoad)) { TSetPt1 = ZoneTemp + ZoneLoad / (CpAir * ZoneMassFlow); TSetPt2 = ZoneTemp + ZoneLoadToHeatSetPt / (CpAir * ZoneMassFlow); if (TSetPt1 > TSupNoHC) { if (TSetPt2 > TSupNoHC) { TSetPt = TSetPt2; } else { TSetPt = TSupNoHC; } } else { TSetPt = TSetPt1; } } else if (ZoneLoad > SmallLoad) { TSetPt1 = ZoneTemp + ZoneLoad / (CpAir * ZoneMassFlow); TSetPt2 = ZoneTemp + ZoneLoadToCoolSetPt / (CpAir * ZoneMassFlow); if (TSetPt1 < TSupNoHC) { if (TSetPt2 < TSupNoHC) { TSetPt = TSetPt2; } else { TSetPt = TSupNoHC; } } else { TSetPt = TSetPt1; } } else { TSetPt = TSupNoHC; } TSetPt = max(min(TSetPt, this->MaxSetTemp), this->MinSetTemp); this->SetPt = TSetPt; } void DefineSZHeatingSetPointManager::calculate() { // SUBROUTINE INFORMATION: // AUTHOR M. J. Witte based on CalcSingZoneRhSetPoint by Fred Buhl, // Work supported by ASHRAE research project 1254-RP // DATE WRITTEN November 2004 // MODIFIED na // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // From the heating load of the control zone, calculate the supply air setpoint // needed to meet that zone load (based on CalcSingZoneRhSetPoint) // METHODOLOGY EMPLOYED: // na // REFERENCES: // na // Using/Aliasing using DataHVACGlobals::SmallLoad; using DataHVACGlobals::SmallMassFlow; using DataZoneEnergyDemands::ZoneSysEnergyDemand; // Locals // SUBROUTINE ARGUMENT DEFINITIONS: // SUBROUTINE PARAMETER DEFINITIONS: // INTERFACE BLOCK SPECIFICATIONS // DERIVED TYPE DEFINITIONS // na // SUBROUTINE LOCAL VARIABLE DECLARATIONS: Real64 ZoneLoadtoHeatSP; // required zone load to zone heating setpoint [W] Real64 ZoneMassFlow; // zone inlet mass flow rate [kg/s] Real64 CpAir; // inlet air specific heat [J/kg-C] int ZoneInletNode; int ZoneNode; int ZoneNum; Real64 ZoneTemp; ZoneInletNode = this->ZoneInletNodeNum; ZoneNum = this->ControlZoneNum; ZoneNode = this->ZoneNodeNum; ZoneMassFlow = Node(ZoneInletNode).MassFlowRate; ZoneLoadtoHeatSP = ZoneSysEnergyDemand(ZoneNum).OutputRequiredToHeatingSP; ZoneTemp = Node(ZoneNode).Temp; // CR7654 IF (ZoneLoadtoHeatSP.GT.0.0) THEN if (ZoneMassFlow <= SmallMassFlow) { this->SetPt = this->MaxSetTemp; } else { CpAir = PsyCpAirFnWTdb(Node(ZoneInletNode).HumRat, Node(ZoneInletNode).Temp); this->SetPt = ZoneTemp + ZoneLoadtoHeatSP / (CpAir * ZoneMassFlow); this->SetPt = max(this->SetPt, this->MinSetTemp); this->SetPt = min(this->SetPt, this->MaxSetTemp); } // CR7654 ELSE // CR7654 SingZoneHtSetPtMgr(SetPtMgrNum)%SetPt = SingZoneHtSetPtMgr(SetPtMgrNum)%MinSetTemp // CR7654 END IF } void DefineSZCoolingSetPointManager::calculate() { // SUBROUTINE INFORMATION: // AUTHOR M. J. Witte based on CalcSingZoneRhSetPoint by Fred Buhl, // Work supported by ASHRAE research project 1254-RP // DATE WRITTEN November 2004 // MODIFIED na // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // From the Cooling load of the control zone, calculate the supply air setpoint // needed to meet that zone load (based on CalcSingZoneRhSetPoint) // METHODOLOGY EMPLOYED: // na // REFERENCES: // na // Using/Aliasing using DataHVACGlobals::SmallLoad; using DataHVACGlobals::SmallMassFlow; using DataZoneEnergyDemands::ZoneSysEnergyDemand; // Locals // SUBROUTINE ARGUMENT DEFINITIONS: // SUBROUTINE PARAMETER DEFINITIONS: // INTERFACE BLOCK SPECIFICATIONS // DERIVED TYPE DEFINITIONS // na // SUBROUTINE LOCAL VARIABLE DECLARATIONS: Real64 ZoneLoadtoCoolSP; // required zone load to zone Cooling setpoint [W] Real64 ZoneMassFlow; // zone inlet mass flow rate [kg/s] Real64 CpAir; // inlet air specific Cool [J/kg-C] int ZoneInletNode; int ZoneNode; int ZoneNum; Real64 ZoneTemp; ZoneInletNode = this->ZoneInletNodeNum; ZoneNum = this->ControlZoneNum; ZoneNode = this->ZoneNodeNum; ZoneMassFlow = Node(ZoneInletNode).MassFlowRate; ZoneLoadtoCoolSP = ZoneSysEnergyDemand(ZoneNum).OutputRequiredToCoolingSP; ZoneTemp = Node(ZoneNode).Temp; // CR7654 IF (ZoneLoadtoCoolSP.LT.0.0) THEN if (ZoneMassFlow <= SmallMassFlow) { this->SetPt = this->MinSetTemp; } else { CpAir = PsyCpAirFnWTdb(Node(ZoneInletNode).HumRat, Node(ZoneInletNode).Temp); this->SetPt = ZoneTemp + ZoneLoadtoCoolSP / (CpAir * ZoneMassFlow); this->SetPt = max(this->SetPt, this->MinSetTemp); this->SetPt = min(this->SetPt, this->MaxSetTemp); } // CR7654 ELSE // CR7654 SingZoneClSetPtMgr(SetPtMgrNum)%SetPt = SingZoneClSetPtMgr(SetPtMgrNum)%MaxSetTemp // CR7654 END IF } void DefineSZOneStageCoolinggSetPointManager::calculate() { // SUBROUTINE INFORMATION: // AUTHOR B. Griffith // DATE WRITTEN August 2013 // MODIFIED na // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // calculate the setpoint for staged on/off cooling // METHODOLOGY EMPLOYED: // Evaluate stage in zone energy demand structure and choose setpoint accordingly // REFERENCES: // na // Using/Aliasing using DataZoneEnergyDemands::ZoneSysEnergyDemand; // Locals // SUBROUTINE ARGUMENT DEFINITIONS: // SUBROUTINE PARAMETER DEFINITIONS: // na // INTERFACE BLOCK SPECIFICATIONS: // na // DERIVED TYPE DEFINITIONS: // na // SUBROUTINE LOCAL VARIABLE DECLARATIONS: // na if (ZoneSysEnergyDemand(this->ControlZoneNum).StageNum >= 0) { this->SetPt = this->CoolingOffTemp; } else { // negative so a cooling stage is set this->SetPt = this->CoolingOnTemp; } } void DefineSZOneStageHeatingSetPointManager::calculate() { // SUBROUTINE INFORMATION: // AUTHOR B. Griffith // DATE WRITTEN August 2013 // MODIFIED na // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // calculate the setpoint for staged on/off control // METHODOLOGY EMPLOYED: // Evaluate stage in zone energy demand structure and choose setpoint accordingly // REFERENCES: // na // Using/Aliasing using DataZoneEnergyDemands::ZoneSysEnergyDemand; // Locals // SUBROUTINE ARGUMENT DEFINITIONS: // SUBROUTINE PARAMETER DEFINITIONS: // na // INTERFACE BLOCK SPECIFICATIONS: // na // DERIVED TYPE DEFINITIONS: // na // SUBROUTINE LOCAL VARIABLE DECLARATIONS: // na if (ZoneSysEnergyDemand(this->ControlZoneNum).StageNum <= 0) { this->SetPt = this->HeatingOffTemp; } else { // positive so a heating stage is set this->SetPt = this->HeatingOnTemp; } } void DefineSZMinHumSetPointManager::calculate() { // SUBROUTINE INFORMATION: // AUTHOR Fred Buhl // DATE WRITTEN October 2000 // MODIFIED Shirey/Raustad Jan 2002 // Gu, Dec 2007 // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // From humidity load of the control zone, calculate the supply air humidity // needed to meet the minimum humidity setpoint // METHODOLOGY EMPLOYED: // Zone moisture load from ZoneTempPredictorCorrector (via DataZoneEnergyDemands) // is used to calculate the minimum supply air humidity ratio // needed to meet minimum zone relative humidity requirement // REFERENCES: // na // Using/Aliasing using DataHVACGlobals::SmallMassFlow; using DataZoneEnergyDemands::ZoneSysMoistureDemand; using Psychrometrics::PsyWFnTdbRhPb; // Locals // SUBROUTINE ARGUMENT DEFINITIONS: // SUBROUTINE PARAMETER DEFINITIONS: // INTERFACE BLOCK SPECIFICATIONS // DERIVED TYPE DEFINITIONS // na // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int ZoneNode; Real64 ZoneMassFlow; int ZoneNum; Real64 MoistureLoad; // Zone moisture load (kg moisture/second) required to meet the relative humidity setpoint // Value obtained from ZoneTempPredictorCorrector (via ZoneSysMoistureDemand in DataZoneEnergyDemands) Real64 SupplyAirHumRat; // Desired air humidity ratio this->SetPt = 0.0; // Only use one zone for now ZoneNode = this->ZoneNodes(1); ZoneMassFlow = Node(ZoneNode).MassFlowRate; ZoneNum = this->ZoneNum(1); if (ZoneMassFlow > SmallMassFlow) { MoistureLoad = ZoneSysMoistureDemand(this->ZoneNum(1)).OutputRequiredToHumidifyingSP; SupplyAirHumRat = max(0.0, Node(ZoneNode).HumRat + MoistureLoad / ZoneMassFlow); // Positive Humidity Ratio MoistureLoad means a humidification load and only humidifying can raise up to a minimum // IF(MoistureLoad .GT. 0.0) SZMinHumSetPtMgr(SetPtMgrNum)%SetPt = SupplyAirHumRat this->SetPt = SupplyAirHumRat; } } void DefineSZMaxHumSetPointManager::calculate() { // SUBROUTINE INFORMATION: // AUTHOR Raustad/Shirey, FSEC // DATE WRITTEN January 2004 // MODIFIED Gu, Dec. 2007 // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // From humidity load of the control zone, calculate the supply air humidity // needed to meet the maximum humidity setpoint // METHODOLOGY EMPLOYED: // Zone moisture load from ZoneTempPredictorCorrector (via DataZoneEnergyDemands) // is used to calculate the maximum supply air humidity ratio // needed to meet maximum zone relative humidity requirement // REFERENCES: // na // Using/Aliasing using DataHVACGlobals::SmallMassFlow; using DataZoneEnergyDemands::ZoneSysMoistureDemand; using Psychrometrics::PsyWFnTdbRhPb; // Locals // SUBROUTINE ARGUMENT DEFINITIONS: // SUBROUTINE PARAMETER DEFINITIONS: // INTERFACE BLOCK SPECIFICATIONS // DERIVED TYPE DEFINITIONS // na // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int ZoneNode; // Control zone air node number Real64 ZoneMassFlow; // Zone air mass flow rate (kg/s) Real64 MoistureLoad; // Zone moisture load (kg moisture/sec) required to meet the relative humidity setpoint // Value obtained from ZoneTempPredictorCorrector (via ZoneSysMoistureDemand in DataZoneEnergyDemands) Real64 SupplyAirHumRat; // Desired air humidity ratio Real64 SystemMassFlow; this->SetPt = 0.0; // Only use one zone for now ZoneNode = this->ZoneNodes(1); ZoneMassFlow = Node(ZoneNode).MassFlowRate; if (ZoneMassFlow > SmallMassFlow) { MoistureLoad = ZoneSysMoistureDemand(this->ZoneNum(1)).OutputRequiredToDehumidifyingSP; SystemMassFlow = Node(this->CtrlNodes(1)).MassFlowRate; // MoistureLoad (negative for dehumidification) may be so large that a negative humrat results, cap at 0.00001 SupplyAirHumRat = max(0.00001, Node(ZoneNode).HumRat + MoistureLoad / ZoneMassFlow); // This hum rat is currently used in Controller:Simple, control variable "TEMPandHUMRAT" (Jan 2004) // Negative MoistureLoad means a dehumidification load this->SetPt = SupplyAirHumRat; } } void DefineMixedAirSetPointManager::calculate() { // SUBROUTINE INFORMATION: // AUTHOR Fred Buhl // DATE WRITTEN May 2001 // MODIFIED na // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Starting with the setpoint at the reference node, subtract the supply fan // temperature rise and set the resulting temperature at the mixed air node. // METHODOLOGY EMPLOYED: // na // REFERENCES: // na // Using/Aliasing using DataGlobals::AnyEnergyManagementSystemInModel; using DataGlobals::SysSizingCalc; using DataHVACGlobals::SetPointErrorFlag; using EMSManager::CheckIfNodeSetPointManagedByEMS; using EMSManager::iTemperatureSetPoint; // Locals // SUBROUTINE ARGUMENT DEFINITIONS: // SUBROUTINE PARAMETER DEFINITIONS: // INTERFACE BLOCK SPECIFICATIONS // DERIVED TYPE DEFINITIONS // na // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int FanInNode; // supply fan inlet node number int FanOutNode; // supply fan outlet node number int RefNode; // setpoint reference node number int CoolCoilInNode; // Cooling coil inlet node number int CoolCoilOutNode; // Cooling coil outlet node number Real64 MinTemp; // Minimum temperature at cooling coil outlet node Real64 dtFan; // Temperature difference across a fan Real64 dtCoolCoil; // Temperature difference across a coolig coil FanInNode = this->FanInNode; FanOutNode = this->FanOutNode; RefNode = this->RefNode; CoolCoilInNode = this->CoolCoilInNode; CoolCoilOutNode = this->CoolCoilOutNode; MinTemp = this->MinCoolCoilOutTemp; this->FreezeCheckEnable = false; if (!SysSizingCalc && this->MySetPointCheckFlag) { RefNode = this->RefNode; if (Node(RefNode).TempSetPoint == SensedNodeFlagValue) { if (!AnyEnergyManagementSystemInModel) { ShowSevereError("CalcMixedAirSetPoint: Missing reference temperature setpoint for Mixed Air Setpoint Manager " + this->Name); ShowContinueError("Node Referenced =" + NodeID(RefNode)); ShowContinueError( " use an additional Setpoint Manager with Control Variable = \"Temperature\" to establish a setpoint at this node."); SetPointErrorFlag = true; } else { // need call to check if this is the target of an EnergyManagementSystem:Actuator object CheckIfNodeSetPointManagedByEMS(RefNode, iTemperatureSetPoint, SetPointErrorFlag); if (SetPointErrorFlag) { ShowSevereError("CalcMixedAirSetPoint: Missing reference temperature setpoint for Mixed Air Setpoint Manager " + this->Name); ShowContinueError("Node Referenced =" + NodeID(RefNode)); ShowContinueError( " use an additional Setpoint Manager with Control Variable = \"Temperature\" to establish a setpoint at this node."); ShowContinueError("Or add EMS Actuator to provide temperature setpoint at this node"); } } } this->MySetPointCheckFlag = false; } this->SetPt = Node(RefNode).TempSetPoint - (Node(FanOutNode).Temp - Node(FanInNode).Temp); if (CoolCoilInNode > 0 && CoolCoilOutNode > 0) { dtFan = Node(FanOutNode).Temp - Node(FanInNode).Temp; dtCoolCoil = Node(CoolCoilInNode).Temp - Node(CoolCoilOutNode).Temp; if (dtCoolCoil > 0.0 && MinTemp > OutDryBulbTemp) { this->FreezeCheckEnable = true; if (Node(RefNode).Temp == Node(CoolCoilOutNode).Temp) { // blow through this->SetPt = max(Node(RefNode).TempSetPoint, MinTemp) - dtFan + dtCoolCoil; } else { // draw through if (RefNode != CoolCoilOutNode) { // Ref node is outlet node this->SetPt = max(Node(RefNode).TempSetPoint - dtFan, MinTemp) + dtCoolCoil; } else { this->SetPt = max(Node(RefNode).TempSetPoint, MinTemp) + dtCoolCoil; } } } } } void DefineOAPretreatSetPointManager::calculate() { // SUBROUTINE INFORMATION: // AUTHOR M. J. Witte based on CalcMixedAirSetPoint by Fred Buhl, // Work supported by ASHRAE research project 1254-RP // DATE WRITTEN January 2005 // MODIFIED Witte (GARD), Sep 2006 // Griffith( NREL), May 2009, added EMS setpoint checks // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Starting with the setpoint at the reference node, determine the required // outside air inlet conditions which when mixed with return air result in // the reference setpoint at the mixed air node. // (based on CalcMixedAirSetPoint) // METHODOLOGY EMPLOYED: // na // REFERENCES: // na // Using/Aliasing using DataGlobals::AnyEnergyManagementSystemInModel; using DataGlobals::SysSizingCalc; using EMSManager::CheckIfNodeSetPointManagedByEMS; using EMSManager::iHumidityRatioMaxSetPoint; using EMSManager::iHumidityRatioMinSetPoint; using EMSManager::iHumidityRatioSetPoint; using EMSManager::iTemperatureSetPoint; // Locals // SUBROUTINE ARGUMENT DEFINITIONS: // SUBROUTINE PARAMETER DEFINITIONS: // INTERFACE BLOCK SPECIFICATIONS // DERIVED TYPE DEFINITIONS // na // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int RefNode; // setpoint reference node number int MixedOutNode; // mixed air outlet node number int OAInNode; // outside air inlet node number int ReturnInNode; // return air inlet node number Real64 OAFraction; // outside air fraction of mixed flow rate Real64 ReturnInValue; // return air inlet node mass flow rate Real64 RefNodeSetPoint; // setpoint at reference node Real64 MinSetPoint; // minimum allowed setpoint Real64 MaxSetPoint; // maximum allowed setpoint bool HumiditySetPoint; // logical to indicate if this is a humidity setpoint static bool LocalSetPointCheckFailed(false); RefNode = this->RefNode; MixedOutNode = this->MixedOutNode; OAInNode = this->OAInNode; ReturnInNode = this->ReturnInNode; HumiditySetPoint = false; { auto const SELECT_CASE_var(this->CtrlTypeMode); if (SELECT_CASE_var == iCtrlVarType_Temp) { // 'Temperature' RefNodeSetPoint = Node(RefNode).TempSetPoint; ReturnInValue = Node(ReturnInNode).Temp; MinSetPoint = this->MinSetTemp; MaxSetPoint = this->MaxSetTemp; } else if (SELECT_CASE_var == iCtrlVarType_MaxHumRat) { // 'HUMRATMAX' RefNodeSetPoint = Node(RefNode).HumRatMax; ReturnInValue = Node(ReturnInNode).HumRat; MinSetPoint = this->MinSetHumRat; MaxSetPoint = this->MaxSetHumRat; HumiditySetPoint = true; } else if (SELECT_CASE_var == iCtrlVarType_MinHumRat) { // 'HUMRATMIN' RefNodeSetPoint = Node(RefNode).HumRatMin; ReturnInValue = Node(ReturnInNode).HumRat; MinSetPoint = this->MinSetHumRat; MaxSetPoint = this->MaxSetHumRat; HumiditySetPoint = true; } else if (SELECT_CASE_var == iCtrlVarType_HumRat) { // 'HumidityRatio' RefNodeSetPoint = Node(RefNode).HumRatSetPoint; ReturnInValue = Node(ReturnInNode).HumRat; MinSetPoint = this->MinSetHumRat; MaxSetPoint = this->MaxSetHumRat; HumiditySetPoint = true; } } if (!SysSizingCalc && this->MySetPointCheckFlag) { this->MySetPointCheckFlag = false; if (RefNodeSetPoint == SensedNodeFlagValue) { if (!AnyEnergyManagementSystemInModel) { ShowSevereError("CalcOAPretreatSetPoint: Missing reference setpoint for Outdoor Air Pretreat Setpoint Manager " + this->Name); ShowContinueError("Node Referenced =" + NodeID(RefNode)); ShowContinueError("use a Setpoint Manager to establish a setpoint at this node."); ShowFatalError("Missing reference setpoint."); } else { LocalSetPointCheckFailed = false; { auto const SELECT_CASE_var(this->CtrlTypeMode); if (SELECT_CASE_var == iCtrlVarType_Temp) { // 'Temperature' CheckIfNodeSetPointManagedByEMS(RefNode, iTemperatureSetPoint, LocalSetPointCheckFailed); } else if (SELECT_CASE_var == iCtrlVarType_MaxHumRat) { // 'HUMRATMAX' CheckIfNodeSetPointManagedByEMS(RefNode, iHumidityRatioMaxSetPoint, LocalSetPointCheckFailed); } else if (SELECT_CASE_var == iCtrlVarType_MinHumRat) { // 'HUMRATMIN' CheckIfNodeSetPointManagedByEMS(RefNode, iHumidityRatioMinSetPoint, LocalSetPointCheckFailed); } else if (SELECT_CASE_var == iCtrlVarType_HumRat) { // 'HumidityRatio' CheckIfNodeSetPointManagedByEMS(RefNode, iHumidityRatioSetPoint, LocalSetPointCheckFailed); } } if (LocalSetPointCheckFailed) { ShowSevereError("CalcOAPretreatSetPoint: Missing reference setpoint for Outdoor Air Pretreat Setpoint Manager " + this->Name); ShowContinueError("Node Referenced =" + NodeID(RefNode)); ShowContinueError("use a Setpoint Manager to establish a setpoint at this node."); ShowContinueError("Or use an EMS actuator to control a setpoint at this node."); ShowFatalError("Missing reference setpoint."); } } } } if ((Node(MixedOutNode).MassFlowRate <= 0.0) || (Node(OAInNode).MassFlowRate <= 0.0)) { this->SetPt = RefNodeSetPoint; } else if (HumiditySetPoint && (RefNodeSetPoint == 0.0)) { // For humidity setpoints, zero is special meaning "off" or "no load" // so pass through zero setpoints without enforcing the max/min setpoint limits this->SetPt = 0.0; } else { OAFraction = Node(OAInNode).MassFlowRate / Node(MixedOutNode).MassFlowRate; this->SetPt = ReturnInValue + (RefNodeSetPoint - ReturnInValue) / OAFraction; // Apply maximum and minimum values this->SetPt = max(this->SetPt, MinSetPoint); this->SetPt = min(this->SetPt, MaxSetPoint); } } void DefineWarmestSetPointManager::calculate() { // SUBROUTINE INFORMATION: // AUTHOR Fred Buhl // DATE WRITTEN May 2002 // MODIFIED na // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Calculate the "warmest" supply air setpoint temperature that will satisfy the cooling // requirements of all the zones served by a central air system. // METHODOLOGY EMPLOYED: // Zone sensible heat balance // REFERENCES: // na // Using/Aliasing using DataHVACGlobals::SmallLoad; using DataHVACGlobals::SmallMassFlow; using DataZoneEnergyDemands::ZoneSysEnergyDemand; using DataZoneEquipment::ZoneEquipConfig; // Locals // SUBROUTINE ARGUMENT DEFINITIONS: // SUBROUTINE PARAMETER DEFINITIONS: // INTERFACE BLOCK SPECIFICATIONS // DERIVED TYPE DEFINITIONS // na // SUBROUTINE LOCAL VARIABLE DECLARATIONS: Real64 ZoneLoad; // required zone load [W] Real64 ZoneMassFlowMax; // zone inlet maximum mass flow rate [kg/s] Real64 CpAir; // inlet air specific heat [J/kg-C] int AirLoopNum; // the index of the air loop served by this setpoint manager Real64 TotCoolLoad; // sum of the zone cooling loads for this air loop [W] int ZonesCooledIndex; // DO loop index for zones cooled by the air loop int CtrlZoneNum; // the controlled zone index int ZoneInletNode; // the zone inlet node number Real64 ZoneTemp; // zone temperature [C] Real64 ZoneSetPointTemp; // zone supply air temperature [C] Real64 SetPointTemp; // the system setpoint temperature [C] int ZoneNode; // the zone node number of the current zone int ZoneNum; // the actual zone number AirLoopNum = this->AirLoopNum; TotCoolLoad = 0.0; SetPointTemp = this->MaxSetTemp; for (ZonesCooledIndex = 1; ZonesCooledIndex <= AirToZoneNodeInfo(AirLoopNum).NumZonesCooled; ++ZonesCooledIndex) { CtrlZoneNum = AirToZoneNodeInfo(AirLoopNum).CoolCtrlZoneNums(ZonesCooledIndex); ZoneInletNode = AirToZoneNodeInfo(AirLoopNum).CoolZoneInletNodes(ZonesCooledIndex); ZoneNode = ZoneEquipConfig(CtrlZoneNum).ZoneNode; ZoneNum = ZoneEquipConfig(CtrlZoneNum).ActualZoneNum; ZoneMassFlowMax = Node(ZoneInletNode).MassFlowRateMax; ZoneLoad = ZoneSysEnergyDemand(ZoneNum).TotalOutputRequired; ZoneTemp = Node(ZoneNode).Temp; ZoneSetPointTemp = this->MaxSetTemp; if (ZoneLoad < 0.0) { TotCoolLoad += std::abs(ZoneLoad); CpAir = PsyCpAirFnWTdb(Node(ZoneInletNode).HumRat, Node(ZoneInletNode).Temp); if (ZoneMassFlowMax > SmallMassFlow) { ZoneSetPointTemp = ZoneTemp + ZoneLoad / (CpAir * ZoneMassFlowMax); } } SetPointTemp = min(SetPointTemp, ZoneSetPointTemp); } SetPointTemp = max(this->MinSetTemp, min(SetPointTemp, this->MaxSetTemp)); if (TotCoolLoad < SmallLoad) { SetPointTemp = this->MaxSetTemp; } this->SetPt = SetPointTemp; } void DefineColdestSetPointManager::calculate() { // SUBROUTINE INFORMATION: // AUTHOR Fred Buhl // DATE WRITTEN May 2002 // MODIFIED na // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Calculate the "coldest" supply air setpoint temperature that will satisfy the heating // requirements of all the zones served by a central air system. // METHODOLOGY EMPLOYED: // Zone sensible heat balance // REFERENCES: // na // Using/Aliasing using DataHVACGlobals::SmallLoad; using DataHVACGlobals::SmallMassFlow; using DataZoneEnergyDemands::ZoneSysEnergyDemand; using DataZoneEquipment::ZoneEquipConfig; // Locals // SUBROUTINE ARGUMENT DEFINITIONS: // SUBROUTINE PARAMETER DEFINITIONS: // INTERFACE BLOCK SPECIFICATIONS // DERIVED TYPE DEFINITIONS // na // SUBROUTINE LOCAL VARIABLE DECLARATIONS: Real64 ZoneLoad; // required zone load [W] Real64 ZoneMassFlowMax; // zone inlet maximum mass flow rate [kg/s] Real64 CpAir; // inlet air specific heat [J/kg-C] int AirLoopNum; // the index of the air loop served by this setpoint manager Real64 TotHeatLoad; // sum of the zone heating loads for this air loop [W] int ZonesHeatedIndex; // DO loop index for zones heated by the air loop int CtrlZoneNum; // the controlled zone index int ZoneInletNode; // the zone inlet node number Real64 ZoneTemp; // zone temperature [C] Real64 ZoneSetPointTemp; // zone supply air temperature [C] Real64 SetPointTemp; // the system setpoint temperature [C] int ZoneNode; // the zone node number of the current zone int ZoneNum; // the actual zone number AirLoopNum = this->AirLoopNum; TotHeatLoad = 0.0; SetPointTemp = this->MinSetTemp; if (AirToZoneNodeInfo(AirLoopNum).NumZonesHeated > 0) { // dual-duct heated only zones for (ZonesHeatedIndex = 1; ZonesHeatedIndex <= AirToZoneNodeInfo(AirLoopNum).NumZonesHeated; ++ZonesHeatedIndex) { CtrlZoneNum = AirToZoneNodeInfo(AirLoopNum).HeatCtrlZoneNums(ZonesHeatedIndex); ZoneInletNode = AirToZoneNodeInfo(AirLoopNum).HeatZoneInletNodes(ZonesHeatedIndex); ZoneNode = ZoneEquipConfig(CtrlZoneNum).ZoneNode; ZoneNum = ZoneEquipConfig(CtrlZoneNum).ActualZoneNum; ZoneMassFlowMax = Node(ZoneInletNode).MassFlowRateMax; ZoneLoad = ZoneSysEnergyDemand(ZoneNum).TotalOutputRequired; ZoneTemp = Node(ZoneNode).Temp; ZoneSetPointTemp = this->MinSetTemp; if (ZoneLoad > 0.0) { TotHeatLoad += ZoneLoad; CpAir = PsyCpAirFnWTdb(Node(ZoneInletNode).HumRat, Node(ZoneInletNode).Temp); if (ZoneMassFlowMax > SmallMassFlow) { ZoneSetPointTemp = ZoneTemp + ZoneLoad / (CpAir * ZoneMassFlowMax); } } SetPointTemp = max(SetPointTemp, ZoneSetPointTemp); } } else { // single-duct or central heated and cooled zones for (ZonesHeatedIndex = 1; ZonesHeatedIndex <= AirToZoneNodeInfo(AirLoopNum).NumZonesCooled; ++ZonesHeatedIndex) { CtrlZoneNum = AirToZoneNodeInfo(AirLoopNum).CoolCtrlZoneNums(ZonesHeatedIndex); ZoneInletNode = AirToZoneNodeInfo(AirLoopNum).CoolZoneInletNodes(ZonesHeatedIndex); ZoneNode = ZoneEquipConfig(CtrlZoneNum).ZoneNode; ZoneNum = ZoneEquipConfig(CtrlZoneNum).ActualZoneNum; ZoneMassFlowMax = Node(ZoneInletNode).MassFlowRateMax; ZoneLoad = ZoneSysEnergyDemand(ZoneNum).TotalOutputRequired; ZoneTemp = Node(ZoneNode).Temp; ZoneSetPointTemp = this->MinSetTemp; if (ZoneLoad > 0.0) { TotHeatLoad += ZoneLoad; CpAir = PsyCpAirFnWTdb(Node(ZoneInletNode).HumRat, Node(ZoneInletNode).Temp); if (ZoneMassFlowMax > SmallMassFlow) { ZoneSetPointTemp = ZoneTemp + ZoneLoad / (CpAir * ZoneMassFlowMax); } } SetPointTemp = max(SetPointTemp, ZoneSetPointTemp); } } SetPointTemp = min(this->MaxSetTemp, max(SetPointTemp, this->MinSetTemp)); if (TotHeatLoad < SmallLoad) { SetPointTemp = this->MinSetTemp; } this->SetPt = SetPointTemp; } void DefWarmestSetPtManagerTempFlow::calculate() { // SUBROUTINE INFORMATION: // AUTHOR Fred Buhl // DATE WRITTEN May 2002 // MODIFIED Haves, Oct 2004 // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Calculate the "warmest" supply air setpoint temperature that will satisfy the cooling // requirements of all the zones served by a central air system. // METHODOLOGY EMPLOYED: // Zone sensible heat balance // REFERENCES: // na // Using/Aliasing using DataAirLoop::AirLoopControlInfo; using DataAirLoop::AirLoopFlow; using DataHVACGlobals::SmallLoad; using DataHVACGlobals::SmallMassFlow; using DataZoneEnergyDemands::ZoneSysEnergyDemand; using DataZoneEquipment::ZoneEquipConfig; // Locals // SUBROUTINE ARGUMENT DEFINITIONS: // SUBROUTINE PARAMETER DEFINITIONS: // INTERFACE BLOCK SPECIFICATIONS // DERIVED TYPE DEFINITIONS // na // SUBROUTINE LOCAL VARIABLE DECLARATIONS: Real64 ZoneLoad; // required zone load [W] Real64 ZoneMassFlowMax; // zone inlet maximum mass flow rate [kg/s] Real64 CpAir; // inlet air specific heat [J/kg-C] int AirLoopNum; // the index of the air loop served by this setpoint manager Real64 TotCoolLoad; // sum of the zone cooling loads for this air loop [W] int ZonesCooledIndex; // DO loop index for zones cooled by the air loop int CtrlZoneNum; // the controlled zone index int ZoneInletNode; // the zone inlet node number Real64 ZoneTemp; // zone temperature [C] Real64 ZoneSetPointTemp; // zone supply air temperature [C] Real64 SetPointTemp; // the system setpoint temperature [C] int ZoneNode; // the zone node number of the current zone int ZoneNum; // the actual zone number Real64 MinFracFlow; Real64 ZoneFracFlow; Real64 FracFlow; Real64 MaxSetPointTemp; Real64 MinSetPointTemp; int CritZoneNumTemp; int CritZoneNumFlow; int ControlStrategy; if (!this->SimReady) return; AirLoopNum = this->AirLoopNum; TotCoolLoad = 0.0; MaxSetPointTemp = this->MaxSetTemp; SetPointTemp = MaxSetPointTemp; MinSetPointTemp = this->MinSetTemp; MinFracFlow = this->MinTurndown; FracFlow = MinFracFlow; CritZoneNumTemp = 0; CritZoneNumFlow = 0; ControlStrategy = this->Strategy; for (ZonesCooledIndex = 1; ZonesCooledIndex <= AirToZoneNodeInfo(AirLoopNum).NumZonesCooled; ++ZonesCooledIndex) { CtrlZoneNum = AirToZoneNodeInfo(AirLoopNum).CoolCtrlZoneNums(ZonesCooledIndex); ZoneInletNode = AirToZoneNodeInfo(AirLoopNum).CoolZoneInletNodes(ZonesCooledIndex); ZoneNode = ZoneEquipConfig(CtrlZoneNum).ZoneNode; ZoneNum = ZoneEquipConfig(CtrlZoneNum).ActualZoneNum; ZoneMassFlowMax = Node(ZoneInletNode).MassFlowRateMax; ZoneLoad = ZoneSysEnergyDemand(ZoneNum).TotalOutputRequired; ZoneTemp = Node(ZoneNode).Temp; ZoneSetPointTemp = MaxSetPointTemp; ZoneFracFlow = MinFracFlow; if (ZoneLoad < 0.0) { TotCoolLoad += std::abs(ZoneLoad); CpAir = PsyCpAirFnWTdb(Node(ZoneInletNode).HumRat, Node(ZoneInletNode).Temp); if (ZoneMassFlowMax > SmallMassFlow) { if (ControlStrategy == TempFirst) { // First find supply air temperature required to meet the load at minimum flow. If this is // below the minimum supply air temperature, calculate the fractional flow rate required to meet the // load at the minimum supply air temperature. ZoneSetPointTemp = ZoneTemp + ZoneLoad / (CpAir * ZoneMassFlowMax * MinFracFlow); if (ZoneSetPointTemp < MinSetPointTemp) { ZoneFracFlow = (ZoneLoad / (CpAir * (MinSetPointTemp - ZoneTemp))) / ZoneMassFlowMax; } else { ZoneFracFlow = MinFracFlow; } } else { // ControlStrategy = FlowFirst // First find supply air flow rate required to meet the load at maximum supply air temperature. If this // is above the maximum supply air flow rate, calculate the supply air temperature required to meet the // load at the maximum flow. ZoneFracFlow = (ZoneLoad / (CpAir * (MaxSetPointTemp - ZoneTemp))) / ZoneMassFlowMax; if (ZoneFracFlow > 1.0 || ZoneFracFlow < 0.0) { ZoneSetPointTemp = ZoneTemp + ZoneLoad / (CpAir * ZoneMassFlowMax); } else { ZoneSetPointTemp = MaxSetPointTemp; } } } } if (ZoneSetPointTemp < SetPointTemp) { SetPointTemp = ZoneSetPointTemp; CritZoneNumTemp = ZoneNum; } if (ZoneFracFlow > FracFlow) { FracFlow = ZoneFracFlow; CritZoneNumFlow = ZoneNum; } } SetPointTemp = max(MinSetPointTemp, min(SetPointTemp, MaxSetPointTemp)); FracFlow = max(MinFracFlow, min(FracFlow, 1.0)); if (TotCoolLoad < SmallLoad) { SetPointTemp = MaxSetPointTemp; FracFlow = MinFracFlow; } this->SetPt = SetPointTemp; this->Turndown = FracFlow; if (ControlStrategy == TempFirst) { if (CritZoneNumFlow != 0) { this->CritZoneNum = CritZoneNumFlow; } else { this->CritZoneNum = CritZoneNumTemp; } } else { // ControlStrategy = FlowFirst if (CritZoneNumTemp != 0) { this->CritZoneNum = CritZoneNumTemp; } else { this->CritZoneNum = CritZoneNumFlow; } } } void DefRABFlowSetPointManager::calculate() { // SUBROUTINE INFORMATION: // AUTHOR Fred Buhl // DATE WRITTEN July 2005 // MODIFIED na // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Given the desired setpoint temperature, calulate the flow rate through the // return asir branch that will deliver the desired temperature at the loop outlet // node. // METHODOLOGY EMPLOYED: // na // REFERENCES: // na // USE STATEMENTS: // Locals // SUBROUTINE ARGUMENT DEFINITIONS: // SUBROUTINE PARAMETER DEFINITIONS: // INTERFACE BLOCK SPECIFICATIONS // DERIVED TYPE DEFINITIONS // na // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int MixerRABInNode; // Mixer RAB inlet node number int MixerSupInNode; // Mixer supply inlet node number int MixerOutNode; // Mixer outlet node number int LoopOutNode; // loop outlet node number Real64 TempSetPt; // the setpoint temperature (from schedule) [C] Real64 TempSetPtMod; // the setpoint temperature modified for fan heat gain [C] Real64 SupFlow; // supply flow rate before mixing [kg/s] Real64 RABFlow; // Return Air Bypass flow rate [kg/s] Real64 TotSupFlow; // supply air flow after mixing [kg/s] Real64 TempSup; // temperature of supply air before mixing [kg/s] Real64 TempRAB; // temperature of return bypass air MixerRABInNode = this->RABMixInNode; MixerSupInNode = this->SupMixInNode; MixerOutNode = this->MixOutNode; LoopOutNode = this->SysOutNode; TempSetPt = GetCurrentScheduleValue(this->SchedPtr); TempSetPtMod = TempSetPt - (Node(LoopOutNode).Temp - Node(MixerOutNode).Temp); SupFlow = Node(MixerSupInNode).MassFlowRate; TempSup = Node(MixerSupInNode).Temp; TotSupFlow = Node(MixerOutNode).MassFlowRate; TempRAB = Node(MixerRABInNode).Temp; RABFlow = (TotSupFlow * TempSetPtMod - SupFlow * TempSup) / max(TempRAB, 1.0); RABFlow = min(RABFlow, TotSupFlow); RABFlow = max(0.0, RABFlow); this->FlowSetPt = RABFlow; } void DefMultiZoneAverageHeatingSetPointManager::calculate() { // SUBROUTINE INFORMATION: // AUTHOR Bereket Nigusse, FSEC // DATE WRITTEN July 2010 // MODIFIED na // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Calculates the "Average" supply air setpoint temperature that will satisfy the heating // requirements of multizones served by a central air system. // METHODOLOGY EMPLOYED: // Zone sensible (heating load) heat balance around the zones served by a central air system // REFERENCES: // na // Using/Aliasing using DataHVACGlobals::SmallLoad; using DataHVACGlobals::SmallMassFlow; using DataZoneEnergyDemands::ZoneSysEnergyDemand; using DataZoneEquipment::ZoneEquipConfig; // Locals // SUBROUTINE ARGUMENT DEFINITIONS: // SUBROUTINE PARAMETER DEFINITIONS: // INTERFACE BLOCK SPECIFICATIONS // DERIVED TYPE DEFINITIONS // na // SUBROUTINE LOCAL VARIABLE DECLARATIONS: Real64 ZoneLoad; // zone load predicted to the setpoint [W] Real64 ZoneMassFlowRate; // zone inlet node actual mass flow rate lagged by system one time step[kg/s] Real64 CpAir; // inlet air specific heat [J/kg-C] int AirLoopNum; // the index of the air loop served by this setpoint manager Real64 SumHeatLoad; // sum of the zone's predicted heating loads for this air loop [W] Real64 SumProductMdotCpTZoneTot; // sum of the product of zone inlet node actual mass flow rate, // Cp of air at zone air node and zone air node temperature for // all zones in the air loop [W] Real64 SumProductMdotCp; // sum of the product of zone inlet node actual mass flow rate, and // Cp of air at zone inlet node for all heated zones in the airloop [W/C] Real64 SumProductMdotCpTot; // sum of the product of zone inlet node actual mass flow rate, and // Cp of air at zone air node for all zones in the airloop [W/C] Real64 ZoneAverageTemp; // multizone average zone air node temperature [C] int ZonesHeatedIndex; // DO loop index for zones cooled by the air loop int CtrlZoneNum; // the controlled zone index int ZoneInletNode; // the zone inlet node number Real64 ZoneTemp; // zone air node temperature [C] Real64 SetPointTemp; // the system setpoint temperature [C] int ZoneNode; // the zone node number of the current zone SumHeatLoad = 0.0; ZoneAverageTemp = 0.0; SumProductMdotCp = 0.0; SumProductMdotCpTot = 0.0; SumProductMdotCpTZoneTot = 0.0; AirLoopNum = this->AirLoopNum; SetPointTemp = this->MinSetTemp; for (ZonesHeatedIndex = 1; ZonesHeatedIndex <= AirToZoneNodeInfo(AirLoopNum).NumZonesCooled; ++ZonesHeatedIndex) { // DO ZonesHeatedIndex=1,AirToZoneNodeInfo(AirLoopNum)%NumZonesHeated // Using AirToZoneNodeInfo(AirLoopNum)%Cool* structure variables since they include heating and cooling. // The data for number of zones heated is included in the data structure of the variable // "AirToZoneNodeInfo(AirLoopNum)%NumZonesCooled" for all systems. The data structure // "AirToZoneNodeInfo(AirLoopNum)%NumZonesHeated" applies to Dual Duct System only and // if used will limit the application of this setpoint manager to other systems. Thus, // the "AirToZoneNodeInfo(AirLoopNum)%NumZonesCooled" data is used instead. CtrlZoneNum = AirToZoneNodeInfo(AirLoopNum).CoolCtrlZoneNums(ZonesHeatedIndex); ZoneInletNode = AirToZoneNodeInfo(AirLoopNum).CoolZoneInletNodes(ZonesHeatedIndex); ZoneNode = ZoneEquipConfig(CtrlZoneNum).ZoneNode; ZoneMassFlowRate = Node(ZoneInletNode).MassFlowRate; ZoneLoad = ZoneSysEnergyDemand(CtrlZoneNum).TotalOutputRequired; ZoneTemp = Node(ZoneNode).Temp; CpAir = PsyCpAirFnWTdb(Node(ZoneNode).HumRat, ZoneTemp); SumProductMdotCpTot += ZoneMassFlowRate * CpAir; SumProductMdotCpTZoneTot += ZoneMassFlowRate * CpAir * ZoneTemp; if (ZoneLoad > 0.0) { CpAir = PsyCpAirFnWTdb(Node(ZoneInletNode).HumRat, Node(ZoneInletNode).Temp); SumHeatLoad += ZoneLoad; SumProductMdotCp += ZoneMassFlowRate * CpAir; } } if (SumProductMdotCpTot > 0.0) ZoneAverageTemp = SumProductMdotCpTZoneTot / SumProductMdotCpTot; if (SumProductMdotCp > 0.0) SetPointTemp = ZoneAverageTemp + SumHeatLoad / SumProductMdotCp; SetPointTemp = min(this->MaxSetTemp, max(SetPointTemp, this->MinSetTemp)); if (SumHeatLoad < SmallLoad) { SetPointTemp = this->MinSetTemp; } this->SetPt = SetPointTemp; } void DefMultiZoneAverageCoolingSetPointManager::calculate() { // SUBROUTINE INFORMATION: // AUTHOR Bereket Nigusse, FSEC // DATE WRITTEN July 2010 // MODIFIED na // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Calculate the "Average" supply air setpoint temperature that will satisfy the cooling // requirements of all the zones served by a central air system. // METHODOLOGY EMPLOYED: // Zone sensible (cooling load) heat balance around the zones served by a central air system // REFERENCES: // na // Using/Aliasing using DataHVACGlobals::SmallLoad; using DataHVACGlobals::SmallMassFlow; using DataZoneEnergyDemands::ZoneSysEnergyDemand; using DataZoneEquipment::ZoneEquipConfig; // Locals // SUBROUTINE ARGUMENT DEFINITIONS: // SUBROUTINE PARAMETER DEFINITIONS: // INTERFACE BLOCK SPECIFICATIONS // DERIVED TYPE DEFINITIONS // na // SUBROUTINE LOCAL VARIABLE DECLARATIONS: Real64 ZoneLoad; // zone load predicted to the setpoint [W] Real64 ZoneMassFlowRate; // zone inlet node actual mass flow rate lagged by system one time step[kg/s] Real64 CpAir; // inlet air specific heat [J/kg-C] int AirLoopNum; // the index of the air loop served by this setpoint manager Real64 SumCoolLoad; // sum of the zone cooling loads for this air loop [W] Real64 SumProductMdotCpTZoneTot; // sum of the product of zone inlet node actual mass flow rate, // Cp of air at zone air node and zone air node temperature for // all zones in the air loop [W] Real64 SumProductMdotCp; // sum of the product of zone inlet node actual mass flow rate, and // Cp of air at zone inlet node for cooled zones in the airloop [W/C] Real64 SumProductMdotCpTot; // sum of the product of zone inlet node actual mass flow rate, and // Cp of air at zone air node for all zones in the airloop [W/C] Real64 ZoneAverageTemp; // multizone average zone Air node temperature [C] int ZonesCooledIndex; // DO loop index for zones cooled by the air loop int CtrlZoneNum; // the controlled zone index int ZoneInletNode; // the zone inlet node number Real64 ZoneTemp; // zone air node temperature [C] Real64 SetPointTemp; // the system setpoint temperature [C] int ZoneNode; // the zone node number of the current zone SumCoolLoad = 0.0; ZoneAverageTemp = 0.0; SumProductMdotCp = 0.0; SumProductMdotCpTot = 0.0; SumProductMdotCpTZoneTot = 0.0; AirLoopNum = this->AirLoopNum; SetPointTemp = this->MaxSetTemp; for (ZonesCooledIndex = 1; ZonesCooledIndex <= AirToZoneNodeInfo(AirLoopNum).NumZonesCooled; ++ZonesCooledIndex) { CtrlZoneNum = AirToZoneNodeInfo(AirLoopNum).CoolCtrlZoneNums(ZonesCooledIndex); ZoneInletNode = AirToZoneNodeInfo(AirLoopNum).CoolZoneInletNodes(ZonesCooledIndex); ZoneNode = ZoneEquipConfig(CtrlZoneNum).ZoneNode; ZoneMassFlowRate = Node(ZoneInletNode).MassFlowRate; ZoneLoad = ZoneSysEnergyDemand(CtrlZoneNum).TotalOutputRequired; ZoneTemp = Node(ZoneNode).Temp; CpAir = PsyCpAirFnWTdb(Node(ZoneNode).HumRat, ZoneTemp); SumProductMdotCpTot += ZoneMassFlowRate * CpAir; SumProductMdotCpTZoneTot += ZoneMassFlowRate * CpAir * ZoneTemp; if (ZoneLoad < 0.0) { CpAir = PsyCpAirFnWTdb(Node(ZoneInletNode).HumRat, Node(ZoneInletNode).Temp); SumCoolLoad += ZoneLoad; SumProductMdotCp += ZoneMassFlowRate * CpAir; } } if (SumProductMdotCpTot > 0.0) ZoneAverageTemp = SumProductMdotCpTZoneTot / SumProductMdotCpTot; if (SumProductMdotCp > 0.0) SetPointTemp = ZoneAverageTemp + SumCoolLoad / SumProductMdotCp; SetPointTemp = max(this->MinSetTemp, min(SetPointTemp, this->MaxSetTemp)); if (std::abs(SumCoolLoad) < SmallLoad) { SetPointTemp = this->MaxSetTemp; } this->SetPt = SetPointTemp; } void DefMultiZoneAverageMinHumSetPointManager::calculate() { // SUBROUTINE INFORMATION: // AUTHOR Bereket Nigusse, FSEC // DATE WRITTEN July 2010 // MODIFIED na // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Calculate the "Average" supply air minimum humidity setpoint that will satisfy the minimum // humidity ratio requirements of multiple zones served by a central air system. // METHODOLOGY EMPLOYED: // Zone latent load balance around the zones served by a central air system // REFERENCES: // na // Using/Aliasing using DataHVACGlobals::SmallLoad; using DataHVACGlobals::SmallMassFlow; using DataZoneEnergyDemands::ZoneSysMoistureDemand; using DataZoneEquipment::ZoneEquipConfig; // Locals // SUBROUTINE ARGUMENT DEFINITIONS: // SUBROUTINE PARAMETER DEFINITIONS: // INTERFACE BLOCK SPECIFICATIONS // DERIVED TYPE DEFINITIONS // na // SUBROUTINE LOCAL VARIABLE DECLARATIONS: Real64 MoistureLoad; // zone's moisture load predicted to the setpoint [kgH20/s] Real64 ZoneMassFlowRate; // zone inlet node actual mass flow rate lagged by system one time step[kg/s] int AirLoopNum; // the index of the air loop served by this setpoint manager Real64 SumMoistureLoad; // sum of the zone moisture loads for this air loop [W] Real64 SumMdot; // sum of the actual mass flow rate for controlled zones in the air loop [kg/s] Real64 SumMdotTot; // sum of the actual mass flow rate for this air loop [kg/s] Real64 SumProductMdotHumTot; // sum of product of actual mass flow rate at the zone inlet node, // and humidity ratio at zones air node for all zones in the airloop [kgH20/s] Real64 AverageZoneHum; // multizone average zone air node humidity ratio of all zones in the air loop [kg/kg] int ZonesCooledIndex; // DO loop index for zones cooled by the air loop int CtrlZoneNum; // the controlled zone index int ZoneInletNode; // the zone inlet node number Real64 ZoneHum; // zone air node humidity ratio [kg/kg] Real64 SetPointHum; // system setpoint humidity ratio [kg/kg] int ZoneNode; // the zone node number of the current zone SumMdot = 0.0; SumMdotTot = 0.0; AverageZoneHum = 0.0; SumMoistureLoad = 0.0; SumProductMdotHumTot = 0.0; AirLoopNum = this->AirLoopNum; SetPointHum = this->MinSetHum; for (ZonesCooledIndex = 1; ZonesCooledIndex <= AirToZoneNodeInfo(AirLoopNum).NumZonesCooled; ++ZonesCooledIndex) { CtrlZoneNum = AirToZoneNodeInfo(AirLoopNum).CoolCtrlZoneNums(ZonesCooledIndex); ZoneInletNode = AirToZoneNodeInfo(AirLoopNum).CoolZoneInletNodes(ZonesCooledIndex); ZoneNode = ZoneEquipConfig(CtrlZoneNum).ZoneNode; ZoneMassFlowRate = Node(ZoneInletNode).MassFlowRate; MoistureLoad = ZoneSysMoistureDemand(CtrlZoneNum).OutputRequiredToHumidifyingSP; ZoneHum = Node(ZoneNode).HumRat; SumMdotTot += ZoneMassFlowRate; SumProductMdotHumTot += ZoneMassFlowRate * ZoneHum; // For humidification the moisture load is positive if (MoistureLoad > 0.0) { SumMdot += ZoneMassFlowRate; SumMoistureLoad += MoistureLoad; } } if (SumMdotTot > SmallMassFlow) AverageZoneHum = SumProductMdotHumTot / SumMdotTot; if (SumMdot > SmallMassFlow) SetPointHum = max(0.0, AverageZoneHum + SumMoistureLoad / SumMdot); SetPointHum = min(this->MaxSetHum, max(SetPointHum, this->MinSetHum)); this->SetPt = SetPointHum; } void DefMultiZoneAverageMaxHumSetPointManager::calculate() { // SUBROUTINE INFORMATION: // AUTHOR Bereket Nigusse, FSEC // DATE WRITTEN July 2010 // MODIFIED na // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Calculate the "Average" supply air maximum humidity setpoint that will satisfy the maximum // himudity ratio requirements of multiple zones served by a central air system. // METHODOLOGY EMPLOYED: // Zone latent load balance around the zones served by a central air system // REFERENCES: // na // Using/Aliasing using DataHVACGlobals::SmallLoad; using DataHVACGlobals::SmallMassFlow; using DataZoneEnergyDemands::ZoneSysMoistureDemand; using DataZoneEquipment::ZoneEquipConfig; // Locals // SUBROUTINE ARGUMENT DEFINITIONS: // SUBROUTINE PARAMETER DEFINITIONS: // INTERFACE BLOCK SPECIFICATIONS // DERIVED TYPE DEFINITIONS // na // SUBROUTINE LOCAL VARIABLE DECLARATIONS: Real64 MoistureLoad; // zone's moisture load predicted to the setpoint [kgH20/s] Real64 ZoneMassFlowRate; // zone inlet node actual mass flow rate lagged by system one time step[kg/s] int AirLoopNum; // the index of the air loop served by this setpoint manager Real64 SumMoistureLoad; // sum of the zone moisture loads for this air loop [W] Real64 SumMdot; // sum of the actual mass flow rate for controlled zones in the air loop [kg/s] Real64 SumMdotTot; // sum of the actual mass flow rate for this air loop [kg/s] Real64 SumProductMdotHumTot; // sum of product of actual mass flow rate at the zone inlet node, // and humidity ratio at zones air node for all zones in the airloop [kgH20/s] Real64 AverageZoneHum; // multizone average zone air node humidity ratio of all zones in the air loop [kg/kg] int ZonesCooledIndex; // DO loop index for zones cooled by the air loop int CtrlZoneNum; // the controlled zone index int ZoneInletNode; // the zone inlet node number Real64 ZoneHum; // zone air node humidity ratio [kg/kg] // REAL(r64) :: AverageSetPointHum ! Supply air humidity ratio [kg/kg] Real64 SetPointHum; // system setpoint humidity ratio [kg/kg] int ZoneNode; // the zone node number of the current zone SumMdot = 0.0; SumMdotTot = 0.0; AverageZoneHum = 0.0; SumMoistureLoad = 0.0; SumProductMdotHumTot = 0.0; AirLoopNum = this->AirLoopNum; SetPointHum = this->MaxSetHum; for (ZonesCooledIndex = 1; ZonesCooledIndex <= AirToZoneNodeInfo(AirLoopNum).NumZonesCooled; ++ZonesCooledIndex) { CtrlZoneNum = AirToZoneNodeInfo(AirLoopNum).CoolCtrlZoneNums(ZonesCooledIndex); ZoneInletNode = AirToZoneNodeInfo(AirLoopNum).CoolZoneInletNodes(ZonesCooledIndex); ZoneNode = ZoneEquipConfig(CtrlZoneNum).ZoneNode; ZoneMassFlowRate = Node(ZoneInletNode).MassFlowRate; MoistureLoad = ZoneSysMoistureDemand(CtrlZoneNum).OutputRequiredToDehumidifyingSP; ZoneHum = Node(ZoneNode).HumRat; SumMdotTot += ZoneMassFlowRate; SumProductMdotHumTot += ZoneMassFlowRate * ZoneHum; // For dehumidification the moisture load is negative if (MoistureLoad < 0.0) { SumMdot += ZoneMassFlowRate; SumMoistureLoad += MoistureLoad; } } if (SumMdotTot > SmallMassFlow) AverageZoneHum = SumProductMdotHumTot / SumMdotTot; if (SumMdot > SmallMassFlow) SetPointHum = max(0.0, AverageZoneHum + SumMoistureLoad / SumMdot); SetPointHum = max(this->MinSetHum, min(SetPointHum, this->MaxSetHum)); this->SetPt = SetPointHum; } void DefMultiZoneMinHumSetPointManager::calculate() { // SUBROUTINE INFORMATION: // AUTHOR Bereket Nigusse, FSEC/UCF // DATE WRITTEN Aug 2010 // MODIFIED na // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Calculates the minimum supply air humidity ratio based on humidification requirements of // a controlled zone with critical humidification need (i.e., a zone with the highest // humidity ratio setpoint) in an air loop served by a central air-conditioner. // METHODOLOGY EMPLOYED: // Uses moisture mass balance to calculate the humidity ratio setpoint. The algorithm loops // over all the zones that a central air system can humidify and calculates the setpoint based // on a zone with the highest humidity ratio setpoint requirement: // REFERENCES: // na // Using/Aliasing using DataHVACGlobals::SmallLoad; using DataHVACGlobals::SmallMassFlow; using DataZoneEnergyDemands::ZoneSysMoistureDemand; using DataZoneEquipment::ZoneEquipConfig; // Locals // SUBROUTINE ARGUMENT DEFINITIONS: // SUBROUTINE PARAMETER DEFINITIONS: Real64 const SmallMoistureLoad(0.00001); // small moisture load [kgH2O/s] // INTERFACE BLOCK SPECIFICATIONS // DERIVED TYPE DEFINITIONS // na // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int AirLoopNum; // the index of the air loop served by this setpoint manager int ZonesCooledIndex; // DO loop index for zones cooled by the air loop int CtrlZoneNum; // the controlled zone index int ZoneInletNode; // the zone inlet node number int ZoneNode; // the zone node number of the current zone Real64 ZoneHum; // zone air node humidity ratio [kg/kg] Real64 SetPointHum; // system setpoint humidity ratio [kg/kg] Real64 ZoneSetPointHum; // Zone setpoint humidity ratio [kg/kg] Real64 MoistureLoad; // zone's moisture load predicted to the setpoint [kgH20/s] Real64 ZoneMassFlowRate; // zone inlet node actual supply air mass flow rate [kg/s] Real64 SumMoistureLoad(0.0); // sum of the zone moisture loads for this air loop [W] AirLoopNum = this->AirLoopNum; SetPointHum = this->MinSetHum; for (ZonesCooledIndex = 1; ZonesCooledIndex <= AirToZoneNodeInfo(AirLoopNum).NumZonesCooled; ++ZonesCooledIndex) { CtrlZoneNum = AirToZoneNodeInfo(AirLoopNum).CoolCtrlZoneNums(ZonesCooledIndex); ZoneInletNode = AirToZoneNodeInfo(AirLoopNum).CoolZoneInletNodes(ZonesCooledIndex); ZoneNode = ZoneEquipConfig(CtrlZoneNum).ZoneNode; ZoneMassFlowRate = Node(ZoneInletNode).MassFlowRate; MoistureLoad = ZoneSysMoistureDemand(CtrlZoneNum).OutputRequiredToHumidifyingSP; ZoneHum = Node(ZoneNode).HumRat; ZoneSetPointHum = this->MinSetHum; // For humidification the moisture load is positive if (MoistureLoad > 0.0) { SumMoistureLoad += MoistureLoad; if (ZoneMassFlowRate > SmallMassFlow) { ZoneSetPointHum = max(0.0, ZoneHum + MoistureLoad / ZoneMassFlowRate); } } SetPointHum = max(SetPointHum, ZoneSetPointHum); } SetPointHum = min(this->MaxSetHum, max(SetPointHum, this->MinSetHum)); if (SumMoistureLoad < SmallMoistureLoad) { SetPointHum = this->MinSetHum; } this->SetPt = SetPointHum; } void DefMultiZoneMaxHumSetPointManager::calculate() { // SUBROUTINE INFORMATION: // AUTHOR Bereket Nigusse, FSEC/UCF // DATE WRITTEN August 2010 // MODIFIED na // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Calculates the maximum supply air humidity ratio based on dehumidification requirements of // a controlled zone with critical dehumidification need (i.e., a zone with the lowest // humidity ratio setpoint) in an air loop served by a central air-conditioner. // METHODOLOGY EMPLOYED: // Uses moisture mass balance to calculate the humidity ratio setpoint. The algorithm loops // over all the zones that a central air system can dehumidify and calculates the setpoint // based on a zone with the lowest humidity ratio setpoint requirement: // REFERENCES: // na // Using/Aliasing using DataHVACGlobals::SmallLoad; using DataHVACGlobals::SmallMassFlow; using DataZoneEnergyDemands::ZoneSysMoistureDemand; using DataZoneEquipment::ZoneEquipConfig; // Locals // SUBROUTINE ARGUMENT DEFINITIONS: // SUBROUTINE PARAMETER DEFINITIONS: Real64 const SmallMoistureLoad(0.00001); // small moisture load [kgH2O/s] // INTERFACE BLOCK SPECIFICATIONS // DERIVED TYPE DEFINITIONS // na // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int AirLoopNum; // the index of the air loop served by this setpoint manager int ZonesCooledIndex; // DO loop index for zones cooled by the air loop int CtrlZoneNum; // the controlled zone index int ZoneInletNode; // the zone inlet node number int ZoneNode; // the zone node number of the current zone Real64 ZoneHum; // zone air node humidity ratio [kg/kg] Real64 SetPointHum; // system setpoint humidity ratio [kg/kg] Real64 ZoneSetPointHum; // Zone setpoint humidity ratio [kg/kg] Real64 MoistureLoad; // zone's moisture load predicted to the setpoint [kgH20/s] Real64 ZoneMassFlowRate; // zone inlet node actual supply air mass flow rate [kg/s] Real64 SumMoistureLoad(0.0); // sum of the zone moisture loads for this air loop [W] AirLoopNum = this->AirLoopNum; SetPointHum = this->MaxSetHum; for (ZonesCooledIndex = 1; ZonesCooledIndex <= AirToZoneNodeInfo(AirLoopNum).NumZonesCooled; ++ZonesCooledIndex) { CtrlZoneNum = AirToZoneNodeInfo(AirLoopNum).CoolCtrlZoneNums(ZonesCooledIndex); ZoneInletNode = AirToZoneNodeInfo(AirLoopNum).CoolZoneInletNodes(ZonesCooledIndex); ZoneNode = ZoneEquipConfig(CtrlZoneNum).ZoneNode; ZoneMassFlowRate = Node(ZoneInletNode).MassFlowRate; MoistureLoad = ZoneSysMoistureDemand(CtrlZoneNum).OutputRequiredToDehumidifyingSP; ZoneHum = Node(ZoneNode).HumRat; ZoneSetPointHum = this->MaxSetHum; // For dehumidification the moisture load is negative if (MoistureLoad < 0.0) { SumMoistureLoad += MoistureLoad; if (ZoneMassFlowRate > SmallMassFlow) { ZoneSetPointHum = max(0.0, ZoneHum + MoistureLoad / ZoneMassFlowRate); } } SetPointHum = min(SetPointHum, ZoneSetPointHum); } SetPointHum = max(this->MinSetHum, min(SetPointHum, this->MaxSetHum)); if (std::abs(SumMoistureLoad) < SmallMoistureLoad) { SetPointHum = this->MaxSetHum; } this->SetPt = SetPointHum; } void DefineFollowOATempSetPointManager::calculate() { // SUBROUTINE INFORMATION: // AUTHOR Chandan Sharma, FSEC // DATE WRITTEN July 2011 // MODIFIED na // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Set the setpoint based on outdoor air dry-bulb/wet-bulb temperature // METHODOLOGY EMPLOYED: // Based on reference temperature type specifed in the setpoint manager, // the setpoint is calculated as OutWetBulbTemp(Or OutDryBulbTemp) + Offset. // The sign convention is that a positive Offset will increase the resulting setpoint. // Final value of the setpoint is limited by the Max and Min limit specified in the setpoint manager. // REFERENCES: // na // USE STATEMENTS: // Locals // SUBROUTINE ARGUMENT DEFINITIONS: // SUBROUTINE PARAMETER DEFINITIONS: // INTERFACE BLOCK SPECIFICATIONS // DERIVED TYPE DEFINITIONS // na // SUBROUTINE LOCAL VARIABLE DECLARATIONS: // INTEGER :: CtrldNodeNum ! index of the items in the controlled node list Real64 MinSetPoint; // minimum allowed setpoint Real64 MaxSetPoint; // maximum allowed setpoint MaxSetPoint = this->MaxSetTemp; MinSetPoint = this->MinSetTemp; { auto const SELECT_CASE_var(this->RefTypeMode); if (SELECT_CASE_var == iRefTempType_WetBulb) { this->SetPt = OutWetBulbTemp + this->Offset; } else if (SELECT_CASE_var == iRefTempType_DryBulb) { this->SetPt = OutDryBulbTemp + this->Offset; } } // Apply maximum and minimum values this->SetPt = max(this->SetPt, MinSetPoint); this->SetPt = min(this->SetPt, MaxSetPoint); } void DefineFollowSysNodeTempSetPointManager::calculate() { // SUBROUTINE INFORMATION: // AUTHOR Chandan Sharma, FSEC // DATE WRITTEN July 2011 // MODIFIED na // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Set the setpoint based on current temperatures at a separate system node. // METHODOLOGY EMPLOYED: // The current value of the temperature at a reference node are obtained and used // to generate setpoint on a second system node. If the reference node is also designated // to be an outdoor air (intake) node, then this setpoint manager can be used to follow // outdoor air conditions that are adjusted for altitude. // Also, based on reference temperature type specifed in the setpoint manager, the out door air wet-bulb // or dry-bulb temperature at the reference node could be used. // A temperature offset will be applied to the value obtained from the reference system node. // If this value is zero, and the limits are met, then the resulting setpoint will be exactly the same // as the reference system node temperature. The sign convention is that a positive offset will increase // the resulting setpoint. // REFERENCES: // na // USE STATEMENTS: // na // Locals // SUBROUTINE ARGUMENT DEFINITIONS: // SUBROUTINE PARAMETER DEFINITIONS: // INTERFACE BLOCK SPECIFICATIONS // DERIVED TYPE DEFINITIONS // na // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int RefNode; // setpoint reference node number Real64 RefNodeTemp; // setpoint at reference node Real64 MinSetPoint; // minimum allowed setpoint Real64 MaxSetPoint; // maximum allowed setpoint RefNodeTemp = 0.0; MaxSetPoint = this->MaxSetTemp; MinSetPoint = this->MinSetTemp; RefNode = this->RefNodeNum; { auto const SELECT_CASE_var(this->RefTypeMode); if (SELECT_CASE_var == iRefTempType_WetBulb) { if (allocated(MoreNodeInfo)) { RefNodeTemp = MoreNodeInfo(RefNode).WetBulbTemp; } } else if (SELECT_CASE_var == iRefTempType_DryBulb) { RefNodeTemp = Node(RefNode).Temp; } } this->SetPt = RefNodeTemp + this->Offset; // Apply maximum and minimum values this->SetPt = max(this->SetPt, MinSetPoint); this->SetPt = min(this->SetPt, MaxSetPoint); } void DefineGroundTempSetPointManager::calculate() { // SUBROUTINE INFORMATION: // AUTHOR Chandan Sharma, FSEC // DATE WRITTEN July 2011 // MODIFIED na // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Set the setpoint based on current ground temperature // METHODOLOGY EMPLOYED: // Based on reference ground temperature object type specifed in the setpoint manager, // the setpoint is calculated as GroundTemperature + Offset. // The sign convention is that a positive Offset will increase the resulting setpoint. // Final value of the setpoint is limited by the Max and Min limit specified in the setpoint manager. // REFERENCES: // na // Using/Aliasing using DataEnvironment::GroundTemp; using DataEnvironment::GroundTemp_Deep; using DataEnvironment::GroundTemp_Surface; using DataEnvironment::GroundTempFC; // Locals // SUBROUTINE ARGUMENT DEFINITIONS: // SUBROUTINE PARAMETER DEFINITIONS: // INTERFACE BLOCK SPECIFICATIONS // DERIVED TYPE DEFINITIONS // na // SUBROUTINE LOCAL VARIABLE DECLARATIONS: // INTEGER :: CtrldNodeNum ! index of the items in the controlled node list Real64 MinSetPoint; // minimum allowed setpoint Real64 MaxSetPoint; // maximum allowed setpoint MaxSetPoint = this->MaxSetTemp; MinSetPoint = this->MinSetTemp; { auto const SELECT_CASE_var(this->RefTypeMode); if (SELECT_CASE_var == iRefGroundTempObjType_BuildingSurface) { this->SetPt = GroundTemp + this->Offset; } else if (SELECT_CASE_var == iRefGroundTempObjType_Shallow) { this->SetPt = GroundTemp_Surface + this->Offset; } else if (SELECT_CASE_var == iRefGroundTempObjType_Deep) { this->SetPt = GroundTemp_Deep + this->Offset; } else if (SELECT_CASE_var == iRefGroundTempObjType_FCfactorMethod) { this->SetPt = GroundTempFC + this->Offset; } } // Apply maximum and minimum values this->SetPt = max(this->SetPt, MinSetPoint); this->SetPt = min(this->SetPt, MaxSetPoint); } void DefineCondEntSetPointManager::calculate() { // SUBROUTINE INFORMATION: // AUTHOR Atefe Makhmalbaf and Heejin Cho, PNNL // DATE WRITTEN March 2012 // MODIFIED na // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Calculate the optimal condenser water temperature set point for a chiller plant // with one or more chillers. The condenser water leaving the tower should be at this temperature // for optimal operation of the chiller plant. // METHODOLOGY EMPLOYED: // using one curve to determine the optimum condenser entering water temperature for a given timestep // and two other curves to place boundary conditions on the optimal setpoint value. // REFERENCES: // na // Using/Aliasing using CurveManager::CurveValue; using DataEnvironment::CurMnDy; using DataEnvironment::OutWetBulbTemp; using ScheduleManager::GetCurrentScheduleValue; using namespace DataPlant; using DataLoopNode::Node; // Locals // SUBROUTINE ARGUMENT DEFINITIONS: // SUBROUTINE PARAMETER DEFINITIONS: // INTERFACE BLOCK SPECIFICATIONS // DERIVED TYPE DEFINITIONS // na // SUBROUTINE LOCAL VARIABLE DECLARATIONS: //////////// hoisted into namespace //////////////////////////////////////////////// // static Real64 Dsn_EntCondTemp( 0.0 ); // The chiller design entering condenser temp, C; e.g. 29.44C {85F} // DCESPMDsn_EntCondTemp // static Real64 Dsn_MinCondSetpt( 0.0 ); // The design minimum condenser water temp, C; e.g. 18.33C {65 F} // DCESPMDsn_MinCondSetpt // static Real64 Cur_MinLiftTD( 0.0 ); // Minimum lift (TCond entering - Tevap leaving) TD this timestep // DCESPMCur_MinLiftTD // static Real64 Design_Load_Sum( 0.0 ); // the design load of the chillers, W // DCESPMDesign_Load_Sum // static Real64 Actual_Load_Sum( 0.0 ); // the actual load of the chillers, W // DCESPMActual_Load_Sum // static Real64 Weighted_Actual_Load_Sum( 0.0 ); // Intermediate weighted value of actual load on plant, W // DCESPMWeighted_Actual_Load_Sum // static Real64 Weighted_Design_Load_Sum( 0.0 ); // Intermediate weighted value of design load on plant, W // DCESPMWeighted_Design_Load_Sum // static Real64 Weighted_Ratio( 0.0 ); // Weighted part load ratio of chillers // DCESPMWeighted_Ratio // static Real64 Min_DesignWB( 0.0 ); // Minimum design twr wet bulb allowed, C // DCESPMMin_DesignWB // static Real64 Min_ActualWb( 0.0 ); // Minimum actual oa wet bulb allowed, C // DCESPMMin_ActualWb // static Real64 Opt_CondEntTemp( 0.0 ); // Optimized Condenser entering water temperature setpoint this timestep, C // DCESPMOpt_CondEntTemp // static Real64 DesignClgCapacity_Watts( 0.0 ); // DCESPMDesignClgCapacity_Watts // static Real64 CurrentLoad_Watts( 0.0 ); // DCESPMCurrentLoad_Watts // static Real64 CondInletTemp( 0.0 ); // Condenser water inlet temperature (C) // DCESPMCondInletTemp // static Real64 EvapOutletTemp( 0.0 ); // Evaporator water outlet temperature (C) // DCESPMEvapOutletTemp //////////////////////////////////////////////////////////////////////////////////// Real64 NormDsnCondFlow(0.0); // Normalized design condenser flow for cooling towers, m3/s per watt Real64 Twr_DesignWB(0.0); // The cooling tower design inlet air wet bulb temperature, C Real64 Dsn_CondMinThisChiller(0.0); // Design Minimum Condenser Entering for current chillers this timestep Real64 temp_MinLiftTD(0.0); // Intermediate variable associated with lift (TCond entering - Tevap leaving) TD Real64 Des_Load(0.0); // array of chiller design loads Real64 Act_Load(0.0); // array of chiller actual loads Real64 ALW(0.0); // Actual load weighting of each chiller, W Real64 DLW(0.0); // Design capacity of each chiller, W Real64 SetPoint(0.0); // Condenser entering water temperature setpoint this timestep, C Real64 CondWaterSetPoint(0.0); // Condenser entering water temperature setpoint this timestep, C Real64 TempDesCondIn(0.0); // Design condenser inlet temp. C , or 25.d0 Real64 TempEvapOutDesign(0.0); // design evaporator outlet temperature, water side Real64 CurLoad(0.0); int ChillerIndexPlantSide(0); int ChillerIndexDemandSide(0); int BranchIndexPlantSide(0); int BranchIndexDemandSide(0); int LoopIndexPlantSide(0); int LoopIndexDemandSide(0); int TypeNum(0); // Get from tower design values NormDsnCondFlow = 5.38e-8; // m3/s per watt (typically 3 gpm/ton)=(Volume of condenser fluid)/(ton of heat rejection) // Grab tower design inlet air wet bulb from setpoint manager Twr_DesignWB = this->TowerDsnInletAirWetBulb; // Current timestep's condenser water entering setpoint CondWaterSetPoint = GetCurrentScheduleValue(this->CondEntTempSchedPtr); LoopIndexPlantSide = this->LoopIndexPlantSide; ChillerIndexPlantSide = this->ChillerIndexPlantSide; BranchIndexPlantSide = this->BranchIndexPlantSide; TypeNum = this->TypeNum; LoopIndexDemandSide = this->LoopIndexDemandSide; ChillerIndexDemandSide = this->ChillerIndexDemandSide; BranchIndexDemandSide = this->BranchIndexDemandSide; // If chiller is on CurLoad = std::abs(PlantLoop(LoopIndexPlantSide).LoopSide(SupplySide).Branch(BranchIndexPlantSide).Comp(ChillerIndexPlantSide).MyLoad); if (CurLoad > 0) { if (TypeNum == TypeOf_Chiller_Absorption || TypeNum == TypeOf_Chiller_CombTurbine || TypeNum == TypeOf_Chiller_Electric || TypeNum == TypeOf_Chiller_ElectricReformEIR || TypeNum == TypeOf_Chiller_EngineDriven) { TempDesCondIn = PlantLoop(LoopIndexPlantSide).LoopSide(SupplySide).Branch(BranchIndexPlantSide).Comp(ChillerIndexPlantSide).TempDesCondIn; DCESPMCondInletTemp = Node(PlantLoop(LoopIndexDemandSide).LoopSide(DemandSide).Branch(BranchIndexDemandSide).Comp(ChillerIndexDemandSide).NodeNumIn) .Temp; DCESPMEvapOutletTemp = Node(PlantLoop(LoopIndexPlantSide).LoopSide(SupplySide).Branch(BranchIndexPlantSide).Comp(ChillerIndexPlantSide).NodeNumOut).Temp; TempEvapOutDesign = PlantLoop(LoopIndexPlantSide).LoopSide(SupplySide).Branch(BranchIndexPlantSide).Comp(ChillerIndexPlantSide).TempDesEvapOut; DCESPMDesignClgCapacity_Watts = PlantLoop(LoopIndexPlantSide).LoopSide(SupplySide).Branch(BranchIndexPlantSide).Comp(ChillerIndexPlantSide).MaxLoad; DCESPMCurrentLoad_Watts = PlantReport(LoopIndexPlantSide).CoolingDemand; } else if (TypeNum == TypeOf_Chiller_Indirect_Absorption || TypeNum == TypeOf_Chiller_DFAbsorption) { TempDesCondIn = PlantLoop(LoopIndexPlantSide).LoopSide(SupplySide).Branch(BranchIndexPlantSide).Comp(ChillerIndexPlantSide).TempDesCondIn; TempEvapOutDesign = 6.666; } else { TempDesCondIn = 25.0; TempEvapOutDesign = 6.666; } // for attached chillers (that are running this timestep) find their Dsn_MinCondSetpt and Dsn_EntCondTemp DCESPMDsn_MinCondSetpt = 999.0; DCESPMDsn_EntCondTemp = 0.0; // Design Minimum Condenser Entering as a function of the minimum lift and TEvapLvg // for chillers operating on current cond loop this timestep Dsn_CondMinThisChiller = TempEvapOutDesign + (this->MinimumLiftTD); DCESPMDsn_MinCondSetpt = min(DCESPMDsn_MinCondSetpt, Dsn_CondMinThisChiller); // Design entering condenser water temperature for chillers operating // on current cond loop this timestep DCESPMDsn_EntCondTemp = max(DCESPMDsn_EntCondTemp, TempDesCondIn); // Load this array with the design capacity and actual load of each chiller this timestep Des_Load = DCESPMDesignClgCapacity_Watts; Act_Load = DCESPMCurrentLoad_Watts; // ***** Load Calculations ***** // In this section the sum of the actual load (watts) and design load (watts) // of the chillers that are on is calculated. DCESPMActual_Load_Sum += Act_Load; DCESPMDesign_Load_Sum += Des_Load; // Exit if the chillers are all off this hour if (DCESPMActual_Load_Sum <= 0) { CondWaterSetPoint = DCESPMDsn_EntCondTemp; return; } // ***** Weighted Ratio Calculation ***** // This section first calculates the actual (ALW) and design (DLW) individual // weights. Then the weighted actual and design loads are computed. Finally // the Weighted Ratio is found. if (DCESPMActual_Load_Sum != 0 && DCESPMDesign_Load_Sum != 0) { ALW = ((Act_Load / DCESPMActual_Load_Sum) * Act_Load); DLW = ((Des_Load / DCESPMDesign_Load_Sum) * Des_Load); } else { ALW = 0.0; DLW = 0.0; } DCESPMWeighted_Actual_Load_Sum += ALW; DCESPMWeighted_Design_Load_Sum += DLW; DCESPMWeighted_Ratio = DCESPMWeighted_Actual_Load_Sum / DCESPMWeighted_Design_Load_Sum; // ***** Optimal Temperature Calculation ***** // In this section the optimal temperature is computed along with the minimum // design wet bulb temp and the minimum actual wet bulb temp. // Min_DesignWB = ACoef1 + ACoef2*OaWb + ACoef3*WPLR + ACoef4*TwrDsnWB + ACoef5*NF DCESPMMin_DesignWB = CurveValue(this->MinTwrWbCurve, OutWetBulbTemp, DCESPMWeighted_Ratio, Twr_DesignWB, NormDsnCondFlow); // Min_ActualWb = BCoef1 + BCoef2*MinDsnWB + BCoef3*WPLR + BCoef4*TwrDsnWB + BCoef5*NF DCESPMMin_ActualWb = CurveValue(this->MinOaWbCurve, DCESPMMin_DesignWB, DCESPMWeighted_Ratio, Twr_DesignWB, NormDsnCondFlow); // Opt_CondEntTemp = CCoef1 + CCoef2*OaWb + CCoef3*WPLR + CCoef4*TwrDsnWB + CCoef5*NF DCESPMOpt_CondEntTemp = CurveValue(this->OptCondEntCurve, OutWetBulbTemp, DCESPMWeighted_Ratio, Twr_DesignWB, NormDsnCondFlow); // ***** Calculate (Cond ent - Evap lvg) Section ***** // In this section we find the worst case of (Cond ent - Evap lvg) for the // chillers that are running. DCESPMCur_MinLiftTD = 9999.0; // temp_MinLiftTD = 20.0 / 1.8; temp_MinLiftTD = DCESPMCondInletTemp - DCESPMEvapOutletTemp; DCESPMCur_MinLiftTD = min(DCESPMCur_MinLiftTD, temp_MinLiftTD); } // ***** Limit conditions Section ***** // Check for limit conditions and control to the proper value. if ((DCESPMWeighted_Ratio >= 0.90) && (DCESPMOpt_CondEntTemp >= (DCESPMDsn_EntCondTemp + 1.0))) { // Optimized value exceeds the design condenser entering condition or chillers // near full load condition; reset condenser entering setpoint to its design value SetPoint = DCESPMDsn_EntCondTemp + 1.0; } else { if ((OutWetBulbTemp >= DCESPMMin_ActualWb) && (Twr_DesignWB >= DCESPMMin_DesignWB) && (DCESPMCur_MinLiftTD > this->MinimumLiftTD)) { // Boundaries are satified; use optimized condenser entering water temp SetPoint = DCESPMOpt_CondEntTemp; } else { // Boundaries violated; Reset to scheduled value of condenser water entering setpoint SetPoint = CondWaterSetPoint; } } // Do not allow new setpoint to be less than the design condenser minimum entering condition, // i.e., TCondWaterEnt not allowed to be less than DsnEvapWaterLvg + MinimumLiftTD CondWaterSetPoint = max(SetPoint, DCESPMDsn_MinCondSetpt); this->SetPt = CondWaterSetPoint; } void DefineIdealCondEntSetPointManager::calculate() { // SUBROUTINE INFORMATION: // AUTHOR Heejin Cho, PNNL // DATE WRITTEN March 2012 // MODIFIED na // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Calculate the optimal condenser water entering temperature set point for a chiller plant. // METHODOLOGY EMPLOYED: // The "ideal" chiller-tower optimization scheme uses a search algorithm to find the ideal optimal setpoint // at a given timestep. This requires resimulating HVAC systems at each timestep until finding // an "optimal" condenser water entering setpoint (OptSetpoint) which gives the minimum total chiller, // cooling tower, chilled water pump and condenser water pump power consumption. // The OptSetpoint falls between realistic minimum and maximum boundaries, which are set by the user. // The minimum boundary is determined based on the minimum lift (user input) // and evaporator leaving water temperature. The maximum boundary is specified by the user. // It is assumed that a single minimum point exists between these boundaries. // Using/Aliasing using namespace DataPlant; using DataLoopNode::Node; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: static Real64 CondWaterSetPoint(0.0); // Condenser entering water temperature setpoint this timestep, C static Real64 EvapOutletTemp(0.0); // Evaporator water outlet temperature (C) static Real64 CondTempLimit(0.0); // Condenser entering water temperature setpoint lower limit static Real64 CurLoad(0.0); // Current cooling load, W static Real64 TotEnergy(0.0); // Total energy consumptions at this time step static Real64 TotEnergyPre(0.0); // Total energy consumptions at the previous time step static bool RunSubOptCondEntTemp(false); static bool RunFinalOptCondEntTemp(false); if (MetersHaveBeenInitialized) { // Setup meter vars if (this->SetupIdealCondEntSetPtVars) { this->SetupMeteredVarsForSetPt(); this->SetupIdealCondEntSetPtVars = false; } } if (MetersHaveBeenInitialized && RunOptCondEntTemp) { // If chiller is on CurLoad = std::abs( PlantLoop(this->LoopIndexPlantSide).LoopSide(SupplySide).Branch(this->BranchIndexPlantSide).Comp(this->ChillerIndexPlantSide).MyLoad); if (CurLoad > 0) { // Calculate the minimum condenser inlet temperature boundary for set point if (this->TypeNum == TypeOf_Chiller_Absorption || this->TypeNum == TypeOf_Chiller_CombTurbine || this->TypeNum == TypeOf_Chiller_Electric || this->TypeNum == TypeOf_Chiller_ElectricReformEIR || this->TypeNum == TypeOf_Chiller_EngineDriven) { EvapOutletTemp = Node(PlantLoop(this->LoopIndexPlantSide) .LoopSide(SupplySide) .Branch(this->BranchIndexPlantSide) .Comp(this->ChillerIndexPlantSide) .NodeNumOut) .Temp; } else { EvapOutletTemp = 6.666; } CondTempLimit = this->MinimumLiftTD + EvapOutletTemp; TotEnergy = this->calculateCurrentEnergyUsage(); this->setupSetPointAndFlags( TotEnergy, TotEnergyPre, CondWaterSetPoint, CondTempLimit, RunOptCondEntTemp, RunSubOptCondEntTemp, RunFinalOptCondEntTemp); } else { CondWaterSetPoint = this->MaxCondEntTemp; TotEnergyPre = 0.0; RunOptCondEntTemp = false; RunSubOptCondEntTemp = false; } } else { CondWaterSetPoint = this->MaxCondEntTemp; RunOptCondEntTemp = false; RunSubOptCondEntTemp = false; } this->SetPt = CondWaterSetPoint; } void DefineIdealCondEntSetPointManager::setupSetPointAndFlags(Real64 &TotEnergy, Real64 &TotEnergyPre, Real64 &CondWaterSetPoint, Real64 &CondTempLimit, bool &RunOptCondEntTemp, bool &RunSubOptCondEntTemp, bool &RunFinalOptCondEntTemp) { Real64 DeltaTotEnergy; if (TotEnergyPre != 0.0) { // Calculate the total energy consumption difference DeltaTotEnergy = TotEnergyPre - TotEnergy; // Search for the minimum total energy consumption if ((DeltaTotEnergy > 0) && (CondWaterSetPoint >= CondTempLimit) && (!RunFinalOptCondEntTemp)) { if (!RunSubOptCondEntTemp) { --CondWaterSetPoint; RunOptCondEntTemp = true; } else { CondWaterSetPoint -= 0.2; RunOptCondEntTemp = true; } TotEnergyPre = TotEnergy; // Set smaller set point (0.2 degC) decrease } else if ((DeltaTotEnergy < 0) && (!RunSubOptCondEntTemp) && (CondWaterSetPoint > CondTempLimit) && (!RunFinalOptCondEntTemp)) { CondWaterSetPoint += 0.8; RunOptCondEntTemp = true; RunSubOptCondEntTemp = true; } else { if (!RunFinalOptCondEntTemp) { CondWaterSetPoint += 0.2; RunOptCondEntTemp = true; RunSubOptCondEntTemp = false; RunFinalOptCondEntTemp = true; } else { // CondWaterSetPoint = CondWaterSetPoint; // Self-assignment commented out TotEnergyPre = 0.0; RunOptCondEntTemp = false; RunSubOptCondEntTemp = false; RunFinalOptCondEntTemp = false; } } } else { CondWaterSetPoint = this->MaxCondEntTemp - 1.0; TotEnergyPre = TotEnergy; RunOptCondEntTemp = true; RunSubOptCondEntTemp = false; } } Real64 DefineIdealCondEntSetPointManager::calculateCurrentEnergyUsage() { Real64 ChillerEnergy(0.0); // Chiller energy consumption Real64 ChilledPumpEnergy(0.0); // Chilled water pump energy consumption Real64 TowerFanEnergy(0.0); // Cooling tower fan energy consumption Real64 CondPumpEnergy(0.0); // Condenser water pump energy consumption // Energy consumption metered variable number = 1 // Get the chiller energy consumption ChillerEnergy = GetInternalVariableValue(this->ChllrVarType, this->ChllrVarIndex); // Get the chilled water pump energy consumption ChilledPumpEnergy = GetInternalVariableValue(this->ChlPumpVarType, this->ChlPumpVarIndex); // Get the cooling tower fan energy consumption TowerFanEnergy = 0; for (int i = 1; i <= this->numTowers; i++) { TowerFanEnergy += GetInternalVariableValue(this->ClTowerVarType(i), this->ClTowerVarIndex(i)); } // Get the condenser pump energy consumption CondPumpEnergy = GetInternalVariableValue(this->CndPumpVarType, this->CndPumpVarIndex); // Calculate the total energy consumption return (ChillerEnergy + ChilledPumpEnergy + TowerFanEnergy + CondPumpEnergy); } void DefineReturnWaterChWSetPointManager::calculate(DataLoopNode::NodeData &returnNode, DataLoopNode::NodeData &supplyNode) { // SUBROUTINE INFORMATION: // AUTHOR Edwin Lee, NREL // DATE WRITTEN May 2015 // MODIFIED na // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Calculate the plant supply temperature reset required to achieve a target plant return temperature // METHODOLOGY EMPLOYED: // The setpoint manager follows this procedure: // 1. Calculate the current demand // a. Sense the current return temperature // b. Sense the current supply temperature // c. Sense the current flow rate // d. Approximate the fluid properties (rho, Cp) from the temperatures // ---> Use these to calculate the demand with Q_demand = V_dot * rho * C_p * (T_return_sensed - T_supply_sensed) // 2. Calculate a new value of supply setpoint that will reject this much Q_demand, while providing a target return temperature // * this assumes that the demand will be the same value on the next time around // * at any time step, the value of target return temperature may vary if it is scheduled (or actuated with EMS) // a. T_supply_setpoint = T_return_target - Q_demand / ( V_dot * rho * C_p ) // 3. Constrain this value to limits // a. T_supply_setpoint will be within: [ Design Chilled Water Supply Temperature, Maximum Supply Water Reset Temperature ] // NOTES: // The assumptions related to lagging of setpoint are most suited for smaller timesteps and/or plants that don't vary wildly from one time // step to another The assumptions also become affected by variable flow plants more-so than constant-flow plants // Using/Aliasing using namespace DataPlant; using DataLoopNode::Node; // we need to know the plant to get the fluid ID in case it is glycol // but we have to wait in case plant isn't initialized yet // if plant isn't initialized, assume index=1 (water) int fluidIndex = 1; if (this->plantLoopIndex == 0) { for (int plantIndex = 1; plantIndex <= DataPlant::TotNumLoops; plantIndex++) { if (this->supplyNodeIndex == DataPlant::PlantLoop(plantIndex).LoopSide(2).NodeNumOut) { this->plantLoopIndex = plantIndex; this->plantSetpointNodeIndex = DataPlant::PlantLoop(plantIndex).TempSetPointNodeNum; fluidIndex = DataPlant::PlantLoop(plantIndex).FluidIndex; // now that we've found the plant populated, let's verify that the nodes match if (!PlantUtilities::verifyTwoNodeNumsOnSamePlantLoop(this->supplyNodeIndex, this->returnNodeIndex)) { ShowSevereError("Node problem for SetpointManager:ReturnTemperature:ChilledWater."); ShowContinueError("Return and Supply nodes were not found on the same plant loop. Verify node names."); ShowFatalError("Simulation aborts due to setpoint node problem"); } } } } // we don't need fluid names since we have a real index, so just pass in the temperature and get properties Real64 avgTemp = (returnNode.Temp + supplyNode.Temp) / 2; Real64 cp = FluidProperties::GetSpecificHeatGlycol("", avgTemp, fluidIndex, "ReturnWaterChWSetPointManager::calculate"); // get the operating flow rate Real64 mdot = supplyNode.MassFlowRate; // calculate the current demand Real64 Qdemand = mdot * cp * (returnNode.Temp - supplyNode.Temp); // check for strange conditions if (Qdemand < 0) { this->currentSupplySetPt = this->minimumChilledWaterSetpoint; return; } // Determine a return target, default is to use the constant value, but scheduled or externally // set on the return node TempSetPoint will overwrite it. Note that the schedule index is only // greater than zero if the input type is scheduled, and the useReturnTempSetpoint flag is only // true if the input type is specified as such Real64 T_return_target = this->returnTemperatureConstantTarget; if (this->returnTemperatureScheduleIndex > 0) { T_return_target = GetCurrentScheduleValue(this->returnTemperatureScheduleIndex); } else if (this->useReturnTempSetpoint) { if (returnNode.TempSetPoint != SensedNodeFlagValue) { T_return_target = returnNode.TempSetPoint; } else { ShowSevereError("Return temperature reset setpoint manager encountered an error."); ShowContinueError("The manager is specified to look to the return node setpoint to find a target return temperature, but the node " "setpoint was invalid"); ShowContinueError("Verify that a separate sepoint manager is specified to set the setpoint on the return node named \"" + NodeID(this->returnNodeIndex) + "\""); ShowContinueError("Or change the target return temperature input type to constant or scheduled"); ShowFatalError("Missing reference setpoint"); } } // calculate the supply setpoint to use, default to the design value if flow is zero Real64 T_supply_setpoint = this->minimumChilledWaterSetpoint; if (mdot > DataConvergParams::PlantFlowRateToler) { T_supply_setpoint = T_return_target - Qdemand / (mdot * cp); } // now correct it to bring it into range T_supply_setpoint = min(max(T_supply_setpoint, this->minimumChilledWaterSetpoint), this->maximumChilledWaterSetpoint); // now save it for use in the update routine this->currentSupplySetPt = T_supply_setpoint; } void DefineReturnWaterHWSetPointManager::calculate(DataLoopNode::NodeData &returnNode, DataLoopNode::NodeData &supplyNode) { // SUBROUTINE INFORMATION: // AUTHOR Edwin Lee, NREL // DATE WRITTEN May 2015 // MODIFIED na // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Calculate the plant supply temperature reset required to achieve a target plant return temperature // METHODOLOGY EMPLOYED: // The setpoint manager follows this procedure: // 1. Calculate the current demand // a. Sense the current return temperature // b. Sense the current supply temperature // c. Sense the current flow rate // d. Approximate the fluid properties (rho, Cp) from the temperatures // ---> Use these to calculate the demand with Q_demand = V_dot * rho * C_p * (T_supply_sensed - T_return_sensed) // 2. Calculate a new value of supply setpoint that will reject this much Q_demand, while providing a target return temperature // * this assumes that the demand will be the same value on the next time around // * at any time step, the value of target return temperature may vary if it is scheduled (or actuated with EMS) // a. T_supply_setpoint = T_return_target + Q_demand / ( V_dot * rho * C_p ) // 3. Constrain this value to limits // a. T_supply_setpoint will be within: [ Minimum Chilled Water Reset Temperature, Design Hot Water Supply Temperature ] // NOTES: // The assumptions related to lagging of setpoint are most suited for smaller timesteps and/or plants that don't vary wildly from one time // step to another The assumptions also become affected by variable flow plants more-so than constant-flow plants // Using/Aliasing using namespace DataPlant; using DataLoopNode::Node; // we need to know the plant to get the fluid ID in case it is glycol // but we have to wait in case plant isn't initialized yet // if plant isn't initialized, assume index=1 (water) int fluidIndex = 1; if (this->plantLoopIndex == 0) { for (int plantIndex = 1; plantIndex <= DataPlant::TotNumLoops; plantIndex++) { if (this->supplyNodeIndex == DataPlant::PlantLoop(plantIndex).LoopSide(2).NodeNumOut) { this->plantLoopIndex = plantIndex; this->plantSetpointNodeIndex = DataPlant::PlantLoop(plantIndex).TempSetPointNodeNum; fluidIndex = DataPlant::PlantLoop(plantIndex).FluidIndex; // now that we've found the plant populated, let's verify that the nodes match if (!PlantUtilities::verifyTwoNodeNumsOnSamePlantLoop(this->supplyNodeIndex, this->returnNodeIndex)) { ShowSevereError("Node problem for SetpointManager:ReturnTemperature:HotWater."); ShowContinueError("Return and Supply nodes were not found on the same plant loop. Verify node names."); ShowFatalError("Simulation aborts due to setpoint node problem"); } } } } // we don't need fluid names since we have a real index, so just pass in the temperature and get properties Real64 avgTemp = (returnNode.Temp + supplyNode.Temp) / 2; Real64 cp = FluidProperties::GetSpecificHeatGlycol("", avgTemp, fluidIndex, "ReturnWaterHWSetPointManager::calculate"); // get the operating flow rate Real64 mdot = supplyNode.MassFlowRate; // calculate the current demand Real64 Qdemand = mdot * cp * (supplyNode.Temp - returnNode.Temp); // check for strange conditions if (Qdemand < 0) { this->currentSupplySetPt = this->maximumHotWaterSetpoint; return; } // Determine a return target, default is to use the constant value, but scheduled overwrites it Real64 T_return_target = this->returnTemperatureConstantTarget; if (this->returnTemperatureScheduleIndex > 0) { T_return_target = GetCurrentScheduleValue(this->returnTemperatureScheduleIndex); } else if (this->useReturnTempSetpoint) { if (returnNode.TempSetPoint != SensedNodeFlagValue) { T_return_target = returnNode.TempSetPoint; } else { ShowSevereError("Return temperature reset setpoint manager encountered an error."); ShowContinueError("The manager is specified to look to the return node setpoint to find a target return temperature, but the node " "setpoint was invalid"); ShowContinueError("Verify that a separate sepoint manager is specified to set the setpoint on the return node named \"" + NodeID(this->returnNodeIndex) + "\""); ShowContinueError("Or change the target return temperature input type to constant or scheduled"); ShowFatalError("Missing reference setpoint"); } } // calculate the supply setpoint to use, default to the design value if flow is zero Real64 T_supply_setpoint = this->maximumHotWaterSetpoint; if (mdot > DataConvergParams::PlantFlowRateToler) { T_supply_setpoint = T_return_target + Qdemand / (mdot * cp); } // now correct it to bring it into range T_supply_setpoint = max(min(T_supply_setpoint, this->maximumHotWaterSetpoint), this->minimumHotWaterSetpoint); // now save it for use in the update routine this->currentSupplySetPt = T_supply_setpoint; } void DefineIdealCondEntSetPointManager::SetupMeteredVarsForSetPt() { // SUBROUTINE INFORMATION: // AUTHOR Linda Lawrie // DATE WRITTEN Sep 2013 // MODIFIED na // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // For the Ideal Cond reset setpoint manager, this sets up the // report variables used during the calculation. // Using/Aliasing using namespace DataPlant; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: std::string TypeOfComp; std::string NameOfComp; Array1D_int VarIndexes; // Variable Numbers Array1D_int VarTypes; // Variable Types (1=integer, 2=real, 3=meter) Array1D_int IndexTypes; // Variable Index Types (1=Zone,2=HVAC) Array1D<OutputProcessor::Unit> unitsForVar; // units from enum for each variable Array1D_int ResourceTypes; // ResourceTypes for each variable Array1D_string EndUses; // EndUses for each variable Array1D_string Groups; // Groups for each variable Array1D_string Names; // Variable Names for each variable int NumVariables; int NumFound; // Chiller and ChW pump location, assumes supply side int ChillerLoopNum(this->LoopIndexPlantSide); // Chiller loop number int ChillerBranchNum(this->BranchIndexPlantSide); // Chiller branch number int ChillerNum(this->ChillerIndexPlantSide); // Chiller number int ChilledPumpBranchNum(this->ChilledPumpBranchNum); // Chilled water pump branch number int ChilledPumpNum(this->ChilledPumpNum); // Chilled water pump number // Tower and CW pump location, assumes supply side, and tower branch/comp nums are used directly instead of local variable copies int TowerLoopNum(this->CondLoopNum); // Tower loop number int CondPumpBranchNum(this->CondPumpBranchNum); // Condenser water pump branch number int CondPumpNum(this->CondPumpNum); // Condenser pump number TypeOfComp = PlantLoop(ChillerLoopNum).LoopSide(SupplySide).Branch(ChillerBranchNum).Comp(ChillerNum).TypeOf; NameOfComp = PlantLoop(ChillerLoopNum).LoopSide(SupplySide).Branch(ChillerBranchNum).Comp(ChillerNum).Name; NumVariables = GetNumMeteredVariables(TypeOfComp, NameOfComp); VarIndexes.allocate(NumVariables); VarTypes.allocate(NumVariables); IndexTypes.allocate(NumVariables); unitsForVar.allocate(NumVariables); ResourceTypes.allocate(NumVariables); EndUses.allocate(NumVariables); Groups.allocate(NumVariables); Names.allocate(NumVariables); GetMeteredVariables(TypeOfComp, NameOfComp, VarIndexes, VarTypes, IndexTypes, unitsForVar, ResourceTypes, EndUses, Groups, Names, NumFound); this->ChllrVarType = VarTypes(1); this->ChllrVarIndex = VarIndexes(1); TypeOfComp = PlantLoop(ChillerLoopNum).LoopSide(SupplySide).Branch(ChilledPumpBranchNum).Comp(ChilledPumpNum).TypeOf; NameOfComp = PlantLoop(ChillerLoopNum).LoopSide(SupplySide).Branch(ChilledPumpBranchNum).Comp(ChilledPumpNum).Name; NumVariables = GetNumMeteredVariables(TypeOfComp, NameOfComp); VarIndexes.allocate(NumVariables); VarTypes.allocate(NumVariables); IndexTypes.allocate(NumVariables); unitsForVar.allocate(NumVariables); ResourceTypes.allocate(NumVariables); EndUses.allocate(NumVariables); Groups.allocate(NumVariables); Names.allocate(NumVariables); GetMeteredVariables(TypeOfComp, NameOfComp, VarIndexes, VarTypes, IndexTypes, unitsForVar, ResourceTypes, EndUses, Groups, Names, NumFound); this->ChlPumpVarType = VarTypes(1); this->ChlPumpVarIndex = VarIndexes(1); for (int i = 1; i <= this->numTowers; i++) { TypeOfComp = PlantLoop(TowerLoopNum).LoopSide(SupplySide).Branch(this->CondTowerBranchNum(i)).Comp(this->TowerNum(i)).TypeOf; NameOfComp = PlantLoop(TowerLoopNum).LoopSide(SupplySide).Branch(this->CondTowerBranchNum(i)).Comp(this->TowerNum(i)).Name; NumVariables = GetNumMeteredVariables(TypeOfComp, NameOfComp); VarIndexes.allocate(NumVariables); VarTypes.allocate(NumVariables); IndexTypes.allocate(NumVariables); unitsForVar.allocate(NumVariables); ResourceTypes.allocate(NumVariables); EndUses.allocate(NumVariables); Groups.allocate(NumVariables); Names.allocate(NumVariables); GetMeteredVariables( TypeOfComp, NameOfComp, VarIndexes, VarTypes, IndexTypes, unitsForVar, ResourceTypes, EndUses, Groups, Names, NumFound); this->ClTowerVarType.push_back(VarTypes(1)); this->ClTowerVarIndex.push_back(VarIndexes(1)); } TypeOfComp = PlantLoop(TowerLoopNum).LoopSide(SupplySide).Branch(CondPumpBranchNum).Comp(CondPumpNum).TypeOf; NameOfComp = PlantLoop(TowerLoopNum).LoopSide(SupplySide).Branch(CondPumpBranchNum).Comp(CondPumpNum).Name; NumVariables = GetNumMeteredVariables(TypeOfComp, NameOfComp); VarIndexes.allocate(NumVariables); VarTypes.allocate(NumVariables); IndexTypes.allocate(NumVariables); unitsForVar.allocate(NumVariables); ResourceTypes.allocate(NumVariables); EndUses.allocate(NumVariables); Groups.allocate(NumVariables); Names.allocate(NumVariables); GetMeteredVariables(TypeOfComp, NameOfComp, VarIndexes, VarTypes, IndexTypes, unitsForVar, ResourceTypes, EndUses, Groups, Names, NumFound); this->CndPumpVarType = VarTypes(1); this->CndPumpVarIndex = VarIndexes(1); } void UpdateSetPointManagers() { // SUBROUTINE INFORMATION: // AUTHOR Fred Buhl // DATE WRITTEN July 1998 // MODIFIED Shirey/Raustad (FSEC), Jan 2004 // P. Haves Oct 2004 // Add new setpoint managers: // SET POINT MANAGER:WARMEST TEMP FLOW and // SET POINT MANAGER:COLDEST TEMP FLOW // Nov 2004 M. J. Witte, GARD Analytics, Inc. // Add new setpoint managers: // SET POINT MANAGER:SINGLE ZONE HEATING and // SET POINT MANAGER:SINGLE ZONE COOLING // Work supported by ASHRAE research project 1254-RP // B. Griffith Aug. 2006. Allow HUMRAT for scheduled setpoint manager // P. Haves Aug 2007 // SET POINT MANAGER:WARMEST TEMP FLOW: // Set AirLoopControlInfo()%LoopFlowRateSet every call not just on // initialization (flag now reset in SUBROUTINE ResetHVACControl) // Removed SET POINT MANAGER:COLDEST TEMP FLOW // July 2010 B.A. Nigusse, FSEC/UCF // Added new setpoint managers // SetpointManager:MultiZone:Heating:Average // SetpointManager:MultiZone:Cooling:Average // SetpointManager:MultiZone:MinimumHumidity:Average // SetpointManager:MultiZone:MaximumHumidity:Average // Aug 2010 B.A. Nigusse, FSEC/UCF // Added new setpoint managers: // SetpointManager:MultiZone:Humidity:Minimum // SetpointManager:MultiZone:Humidity:Maximum // Aug 2014 Rick Strand, UIUC // SetpointManager:ScheduledTES (internally defined) // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE // Loop over all the Setpoint Managers and use their output arrays // to set the node setpoints. // METHODOLOGY EMPLOYED: // REFERENCES: // na // Using/Aliasing using DataGlobals::AnyEnergyManagementSystemInModel; using DataGlobals::SysSizingCalc; using DataHVACGlobals::SetPointErrorFlag; using EMSManager::CheckIfNodeSetPointManagedByEMS; using EMSManager::iTemperatureSetPoint; // Locals // SUBROUTINE PARAMETER DEFINITIONS: // na // INTERFACE BLOCK SPECIFICATIONS // na // DERIVED TYPE DEFINITIONS // na // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int SetPtMgrNum; int CtrlNodeIndex; int NodeNum; // Loop over all the Scheduled Setpoint Managers for (SetPtMgrNum = 1; SetPtMgrNum <= NumSchSetPtMgrs; ++SetPtMgrNum) { for (CtrlNodeIndex = 1; CtrlNodeIndex <= SchSetPtMgr(SetPtMgrNum).NumCtrlNodes; ++CtrlNodeIndex) { // Loop over the list of nodes wanting // setpoints from this setpoint manager NodeNum = SchSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); // Get the node number { auto const SELECT_CASE_var(SchSetPtMgr(SetPtMgrNum).CtrlTypeMode); // set the setpoint depending on the type of variable being controlled if (SELECT_CASE_var == iCtrlVarType_Temp) { Node(NodeNum).TempSetPoint = SchSetPtMgr(SetPtMgrNum).SetPt; } else if (SELECT_CASE_var == iCtrlVarType_MaxTemp) { Node(NodeNum).TempSetPointHi = SchSetPtMgr(SetPtMgrNum).SetPt; } else if (SELECT_CASE_var == iCtrlVarType_MinTemp) { Node(NodeNum).TempSetPointLo = SchSetPtMgr(SetPtMgrNum).SetPt; } else if (SELECT_CASE_var == iCtrlVarType_HumRat) { Node(NodeNum).HumRatSetPoint = SchSetPtMgr(SetPtMgrNum).SetPt; } else if (SELECT_CASE_var == iCtrlVarType_MaxHumRat) { Node(NodeNum).HumRatMax = SchSetPtMgr(SetPtMgrNum).SetPt; } else if (SELECT_CASE_var == iCtrlVarType_MinHumRat) { Node(NodeNum).HumRatMin = SchSetPtMgr(SetPtMgrNum).SetPt; } else if (SELECT_CASE_var == iCtrlVarType_MassFlow) { Node(NodeNum).MassFlowRateSetPoint = SchSetPtMgr(SetPtMgrNum).SetPt; } else if (SELECT_CASE_var == iCtrlVarType_MaxMassFlow) { Node(NodeNum).MassFlowRateMax = SchSetPtMgr(SetPtMgrNum).SetPt; } else if (SELECT_CASE_var == iCtrlVarType_MinMassFlow) { Node(NodeNum).MassFlowRateMin = SchSetPtMgr(SetPtMgrNum).SetPt; } } } // nodes in list } // setpoint manger:scheduled // Loop over all the Scheduled TES Setpoint Managers for (SetPtMgrNum = 1; SetPtMgrNum <= NumSchTESSetPtMgrs; ++SetPtMgrNum) { // only one setpoint for each scheduled TES setpoint manager and its a temperature setpoint NodeNum = SchTESSetPtMgr(SetPtMgrNum).CtrlNodeNum; // Get the node number Node(NodeNum).TempSetPoint = SchTESSetPtMgr(SetPtMgrNum).SetPt; } // setpoint manger:scheduledTES // Loop over all the Scheduled Dual Setpoint Managers for (SetPtMgrNum = 1; SetPtMgrNum <= NumDualSchSetPtMgrs; ++SetPtMgrNum) { for (CtrlNodeIndex = 1; CtrlNodeIndex <= DualSchSetPtMgr(SetPtMgrNum).NumCtrlNodes; ++CtrlNodeIndex) { // Loop over the list of nodes wanting // setpoints from this setpoint manager NodeNum = DualSchSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); // Get the node number if (DualSchSetPtMgr(SetPtMgrNum).CtrlTypeMode == iCtrlVarType_Temp) { Node(NodeNum).TempSetPointHi = DualSchSetPtMgr(SetPtMgrNum).SetPtHi; // Set the setpoint High Node(NodeNum).TempSetPointLo = DualSchSetPtMgr(SetPtMgrNum).SetPtLo; // Set the setpoint Low Node(NodeNum).TempSetPoint = (Node(NodeNum).TempSetPointHi + Node(NodeNum).TempSetPointLo) / 2.0; // average of the high and low } } } // Loop over all the Outside Air Setpoint Managers for (SetPtMgrNum = 1; SetPtMgrNum <= NumOutAirSetPtMgrs; ++SetPtMgrNum) { for (CtrlNodeIndex = 1; CtrlNodeIndex <= OutAirSetPtMgr(SetPtMgrNum).NumCtrlNodes; ++CtrlNodeIndex) { // Loop over the list of nodes wanting // setpoints from this setpoint manager NodeNum = OutAirSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); // Get the node number if (OutAirSetPtMgr(SetPtMgrNum).CtrlTypeMode == iCtrlVarType_Temp) { Node(NodeNum).TempSetPoint = OutAirSetPtMgr(SetPtMgrNum).SetPt; // Set the setpoint } else if (OutAirSetPtMgr(SetPtMgrNum).CtrlTypeMode == iCtrlVarType_MaxTemp) { Node(NodeNum).TempSetPointHi = OutAirSetPtMgr(SetPtMgrNum).SetPt; // Set the high temperature setpoint } else if (OutAirSetPtMgr(SetPtMgrNum).CtrlTypeMode == iCtrlVarType_MinTemp) { Node(NodeNum).TempSetPointLo = OutAirSetPtMgr(SetPtMgrNum).SetPt; // Set the low temperature setpoint } } } // Loop over all the Single Zone Reheat Setpoint Managers for (SetPtMgrNum = 1; SetPtMgrNum <= NumSZRhSetPtMgrs; ++SetPtMgrNum) { for (CtrlNodeIndex = 1; CtrlNodeIndex <= SingZoneRhSetPtMgr(SetPtMgrNum).NumCtrlNodes; ++CtrlNodeIndex) { // Loop over the list of nodes wanting // setpoints from this setpoint manager NodeNum = SingZoneRhSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); // Get the node number if (SingZoneRhSetPtMgr(SetPtMgrNum).CtrlTypeMode == iCtrlVarType_Temp) { Node(NodeNum).TempSetPoint = SingZoneRhSetPtMgr(SetPtMgrNum).SetPt; // Set the setpoint } } } // Loop over all the Single Zone Heating Setpoint Managers for (SetPtMgrNum = 1; SetPtMgrNum <= NumSZHtSetPtMgrs; ++SetPtMgrNum) { for (CtrlNodeIndex = 1; CtrlNodeIndex <= SingZoneHtSetPtMgr(SetPtMgrNum).NumCtrlNodes; ++CtrlNodeIndex) { // Loop over the list of nodes wanting // setpoints from this setpoint manager NodeNum = SingZoneHtSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); // Get the node number if (SingZoneHtSetPtMgr(SetPtMgrNum).CtrlTypeMode == iCtrlVarType_Temp) { Node(NodeNum).TempSetPoint = SingZoneHtSetPtMgr(SetPtMgrNum).SetPt; // Set the setpoint } } } // Loop over all the Single Zone Cooling Setpoint Managers for (SetPtMgrNum = 1; SetPtMgrNum <= NumSZClSetPtMgrs; ++SetPtMgrNum) { for (CtrlNodeIndex = 1; CtrlNodeIndex <= SingZoneClSetPtMgr(SetPtMgrNum).NumCtrlNodes; ++CtrlNodeIndex) { // Loop over the list of nodes wanting // setpoints from this setpoint manager NodeNum = SingZoneClSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); // Get the node number if (SingZoneClSetPtMgr(SetPtMgrNum).CtrlTypeMode == iCtrlVarType_Temp) { Node(NodeNum).TempSetPoint = SingZoneClSetPtMgr(SetPtMgrNum).SetPt; // Set the setpoint } } } // Loop over all the Single Zone Minimum Humidity Setpoint Managers for (SetPtMgrNum = 1; SetPtMgrNum <= NumSZMinHumSetPtMgrs; ++SetPtMgrNum) { for (CtrlNodeIndex = 1; CtrlNodeIndex <= SZMinHumSetPtMgr(SetPtMgrNum).NumCtrlNodes; ++CtrlNodeIndex) { // Loop over the list of nodes wanting // setpoints from this setpoint manager NodeNum = SZMinHumSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); // Get the node number Node(NodeNum).HumRatMin = SZMinHumSetPtMgr(SetPtMgrNum).SetPt; // Set the setpoint } } // Loop over all the Single Zone Maximum Humidity Setpoint Managers for (SetPtMgrNum = 1; SetPtMgrNum <= NumSZMaxHumSetPtMgrs; ++SetPtMgrNum) { for (CtrlNodeIndex = 1; CtrlNodeIndex <= SZMaxHumSetPtMgr(SetPtMgrNum).NumCtrlNodes; ++CtrlNodeIndex) { // Loop over the list of nodes wanting // setpoints from this setpoint manager NodeNum = SZMaxHumSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); // Get the node number Node(NodeNum).HumRatMax = SZMaxHumSetPtMgr(SetPtMgrNum).SetPt; // Set the setpoint } } // Loop over all the Warmest Setpoint Managers for (SetPtMgrNum = 1; SetPtMgrNum <= NumWarmestSetPtMgrs; ++SetPtMgrNum) { for (CtrlNodeIndex = 1; CtrlNodeIndex <= WarmestSetPtMgr(SetPtMgrNum).NumCtrlNodes; ++CtrlNodeIndex) { // Loop over the list of nodes wanting // setpoints from this setpoint manager NodeNum = WarmestSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); // Get the node number if (WarmestSetPtMgr(SetPtMgrNum).CtrlTypeMode == iCtrlVarType_Temp) { Node(NodeNum).TempSetPoint = WarmestSetPtMgr(SetPtMgrNum).SetPt; // Set the setpoint } } } // Loop over all the Coldest Setpoint Managers for (SetPtMgrNum = 1; SetPtMgrNum <= NumColdestSetPtMgrs; ++SetPtMgrNum) { for (CtrlNodeIndex = 1; CtrlNodeIndex <= ColdestSetPtMgr(SetPtMgrNum).NumCtrlNodes; ++CtrlNodeIndex) { // Loop over the list of nodes wanting // setpoints from this setpoint manager NodeNum = ColdestSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); // Get the node number if (ColdestSetPtMgr(SetPtMgrNum).CtrlTypeMode == iCtrlVarType_Temp) { Node(NodeNum).TempSetPoint = ColdestSetPtMgr(SetPtMgrNum).SetPt; // Set the setpoint } } } // Loop over all the Warmest Temp Flow Setpoint Managers for (SetPtMgrNum = 1; SetPtMgrNum <= NumWarmestSetPtMgrsTempFlow; ++SetPtMgrNum) { for (CtrlNodeIndex = 1; CtrlNodeIndex <= WarmestSetPtMgrTempFlow(SetPtMgrNum).NumCtrlNodes; ++CtrlNodeIndex) { // Loop over the list of nodes wanting // setpoints from this setpoint manager NodeNum = WarmestSetPtMgrTempFlow(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); // Get the node number if (WarmestSetPtMgrTempFlow(SetPtMgrNum).CtrlTypeMode == iCtrlVarType_Temp) { Node(NodeNum).TempSetPoint = WarmestSetPtMgrTempFlow(SetPtMgrNum).SetPt; // Set the supply air temperature setpoint AirLoopFlow(WarmestSetPtMgrTempFlow(SetPtMgrNum).AirLoopNum).ReqSupplyFrac = WarmestSetPtMgrTempFlow(SetPtMgrNum).Turndown; // Set the supply air flow rate AirLoopControlInfo(WarmestSetPtMgrTempFlow(SetPtMgrNum).AirLoopNum).LoopFlowRateSet = true; // PH 8/17/07 } } } for (SetPtMgrNum = 1; SetPtMgrNum <= NumRABFlowSetPtMgrs; ++SetPtMgrNum) { NodeNum = RABFlowSetPtMgr(SetPtMgrNum).RABSplitOutNode; // Get the node number if (RABFlowSetPtMgr(SetPtMgrNum).CtrlTypeMode == iCtrlVarType_MassFlow) { Node(NodeNum).MassFlowRateSetPoint = RABFlowSetPtMgr(SetPtMgrNum).FlowSetPt; // Set the flow setpoint } } // Loop over all the MultiZone Average Cooling Setpoint Managers for (SetPtMgrNum = 1; SetPtMgrNum <= NumMZClgAverageSetPtMgrs; ++SetPtMgrNum) { for (CtrlNodeIndex = 1; CtrlNodeIndex <= MZAverageCoolingSetPtMgr(SetPtMgrNum).NumCtrlNodes; ++CtrlNodeIndex) { // Loop over the list of nodes wanting // setpoints from this setpoint manager NodeNum = MZAverageCoolingSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); // Get the node number if (MZAverageCoolingSetPtMgr(SetPtMgrNum).CtrlTypeMode == iCtrlVarType_Temp) { Node(NodeNum).TempSetPoint = MZAverageCoolingSetPtMgr(SetPtMgrNum).SetPt; // Set the temperature setpoint } } } // Loop over all the MultiZone Average Heating Setpoint Managers for (SetPtMgrNum = 1; SetPtMgrNum <= NumMZHtgAverageSetPtMgrs; ++SetPtMgrNum) { for (CtrlNodeIndex = 1; CtrlNodeIndex <= MZAverageHeatingSetPtMgr(SetPtMgrNum).NumCtrlNodes; ++CtrlNodeIndex) { // Loop over the list of nodes wanting // setpoints from this setpoint manager NodeNum = MZAverageHeatingSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); // Get the node number if (MZAverageHeatingSetPtMgr(SetPtMgrNum).CtrlTypeMode == iCtrlVarType_Temp) { Node(NodeNum).TempSetPoint = MZAverageHeatingSetPtMgr(SetPtMgrNum).SetPt; // Set the temperature setpoint } } } // Loop over all the MultiZone Average Minimum Humidity Setpoint Managers for (SetPtMgrNum = 1; SetPtMgrNum <= NumMZAverageMinHumSetPtMgrs; ++SetPtMgrNum) { for (CtrlNodeIndex = 1; CtrlNodeIndex <= MZAverageMinHumSetPtMgr(SetPtMgrNum).NumCtrlNodes; ++CtrlNodeIndex) { // Loop over the list of nodes wanting // setpoints from this setpoint manager NodeNum = MZAverageMinHumSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); // Get the node number if (MZAverageMinHumSetPtMgr(SetPtMgrNum).CtrlTypeMode == iCtrlVarType_MinHumRat) { Node(NodeNum).HumRatMin = MZAverageMinHumSetPtMgr(SetPtMgrNum).SetPt; // Set the humidity ratio setpoint } } } // Loop over all the MultiZone Average Maxiumum Humidity Setpoint Managers for (SetPtMgrNum = 1; SetPtMgrNum <= NumMZAverageMaxHumSetPtMgrs; ++SetPtMgrNum) { for (CtrlNodeIndex = 1; CtrlNodeIndex <= MZAverageMaxHumSetPtMgr(SetPtMgrNum).NumCtrlNodes; ++CtrlNodeIndex) { // Loop over the list of nodes wanting // setpoints from this setpoint manager NodeNum = MZAverageMaxHumSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); // Get the node number if (MZAverageMaxHumSetPtMgr(SetPtMgrNum).CtrlTypeMode == iCtrlVarType_MaxHumRat) { Node(NodeNum).HumRatMax = MZAverageMaxHumSetPtMgr(SetPtMgrNum).SetPt; // Set the humidity ratio setpoint } } } // Loop over all the Multizone Minimum Humidity Ratio Setpoint Managers for (SetPtMgrNum = 1; SetPtMgrNum <= NumMZMinHumSetPtMgrs; ++SetPtMgrNum) { for (CtrlNodeIndex = 1; CtrlNodeIndex <= MZMinHumSetPtMgr(SetPtMgrNum).NumCtrlNodes; ++CtrlNodeIndex) { // Loop over the list of nodes wanting // setpoints from this setpoint manager NodeNum = MZMinHumSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); // Get the node number if (MZMinHumSetPtMgr(SetPtMgrNum).CtrlTypeMode == iCtrlVarType_MinHumRat) { Node(NodeNum).HumRatMin = MZMinHumSetPtMgr(SetPtMgrNum).SetPt; // Set the humidity ratio setpoint } } } // Loop over all the Multizone Maximum Humidity Ratio Setpoint Managers for (SetPtMgrNum = 1; SetPtMgrNum <= NumMZMaxHumSetPtMgrs; ++SetPtMgrNum) { for (CtrlNodeIndex = 1; CtrlNodeIndex <= MZMaxHumSetPtMgr(SetPtMgrNum).NumCtrlNodes; ++CtrlNodeIndex) { // Loop over the list of nodes wanting // setpoints from this setpoint manager NodeNum = MZMaxHumSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); // Get the node number if (MZMaxHumSetPtMgr(SetPtMgrNum).CtrlTypeMode == iCtrlVarType_MaxHumRat) { Node(NodeNum).HumRatMax = MZMaxHumSetPtMgr(SetPtMgrNum).SetPt; // Set the humidity ratio setpoint } } } // Loop over all the Follow Outdoor Air Setpoint Managers for (SetPtMgrNum = 1; SetPtMgrNum <= NumFollowOATempSetPtMgrs; ++SetPtMgrNum) { for (CtrlNodeIndex = 1; CtrlNodeIndex <= FollowOATempSetPtMgr(SetPtMgrNum).NumCtrlNodes; ++CtrlNodeIndex) { // Loop over the list of nodes wanting // setpoints from this setpoint manager NodeNum = FollowOATempSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); // Get the node number if (FollowOATempSetPtMgr(SetPtMgrNum).CtrlTypeMode == iCtrlVarType_Temp) { Node(NodeNum).TempSetPoint = FollowOATempSetPtMgr(SetPtMgrNum).SetPt; // Set the temperature setpoint } else if (FollowOATempSetPtMgr(SetPtMgrNum).CtrlTypeMode == iCtrlVarType_MaxTemp) { Node(NodeNum).TempSetPointHi = FollowOATempSetPtMgr(SetPtMgrNum).SetPt; // Set the temperature setpoint } else if (FollowOATempSetPtMgr(SetPtMgrNum).CtrlTypeMode == iCtrlVarType_MinTemp) { Node(NodeNum).TempSetPointLo = FollowOATempSetPtMgr(SetPtMgrNum).SetPt; // Set the temperature setpoint } } } // Loop over all the Follow System Node Temperature Setpoint Managers for (SetPtMgrNum = 1; SetPtMgrNum <= NumFollowSysNodeTempSetPtMgrs; ++SetPtMgrNum) { for (CtrlNodeIndex = 1; CtrlNodeIndex <= FollowSysNodeTempSetPtMgr(SetPtMgrNum).NumCtrlNodes; ++CtrlNodeIndex) { // Loop over the list of nodes wanting // setpoints from this setpoint manager NodeNum = FollowSysNodeTempSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); // Get the node number if (FollowSysNodeTempSetPtMgr(SetPtMgrNum).CtrlTypeMode == iCtrlVarType_Temp) { Node(NodeNum).TempSetPoint = FollowSysNodeTempSetPtMgr(SetPtMgrNum).SetPt; // Set the temperature setpoint } else if (FollowSysNodeTempSetPtMgr(SetPtMgrNum).CtrlTypeMode == iCtrlVarType_MaxTemp) { Node(NodeNum).TempSetPointHi = FollowSysNodeTempSetPtMgr(SetPtMgrNum).SetPt; // Set the temperature setpoint } else if (FollowSysNodeTempSetPtMgr(SetPtMgrNum).CtrlTypeMode == iCtrlVarType_MinTemp) { Node(NodeNum).TempSetPointLo = FollowSysNodeTempSetPtMgr(SetPtMgrNum).SetPt; // Set the temperature setpoint } } } // Loop over all the Ground Tempearture Setpoint Managers for (SetPtMgrNum = 1; SetPtMgrNum <= NumGroundTempSetPtMgrs; ++SetPtMgrNum) { for (CtrlNodeIndex = 1; CtrlNodeIndex <= GroundTempSetPtMgr(SetPtMgrNum).NumCtrlNodes; ++CtrlNodeIndex) { // Loop over the list of nodes wanting // setpoints from this setpoint manager NodeNum = GroundTempSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); // Get the node number if (GroundTempSetPtMgr(SetPtMgrNum).CtrlTypeMode == iCtrlVarType_Temp) { Node(NodeNum).TempSetPoint = GroundTempSetPtMgr(SetPtMgrNum).SetPt; // Set the temperature setpoint } else if (GroundTempSetPtMgr(SetPtMgrNum).CtrlTypeMode == iCtrlVarType_MaxTemp) { Node(NodeNum).TempSetPointHi = GroundTempSetPtMgr(SetPtMgrNum).SetPt; // Set the temperature setpoint } else if (GroundTempSetPtMgr(SetPtMgrNum).CtrlTypeMode == iCtrlVarType_MinTemp) { Node(NodeNum).TempSetPointLo = GroundTempSetPtMgr(SetPtMgrNum).SetPt; // Set the temperature setpoint } } } // Loop over all Condenser Entering Set Point Managers for (SetPtMgrNum = 1; SetPtMgrNum <= NumCondEntSetPtMgrs; ++SetPtMgrNum) { for (CtrlNodeIndex = 1; CtrlNodeIndex <= CondEntSetPtMgr(SetPtMgrNum).NumCtrlNodes; ++CtrlNodeIndex) { // Loop over the list of nodes wanting // set points from this set point manager NodeNum = CondEntSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); // Get the node number if (CondEntSetPtMgr(SetPtMgrNum).CtrlTypeMode == iCtrlVarType_Temp) { Node(NodeNum).TempSetPoint = CondEntSetPtMgr(SetPtMgrNum).SetPt; // Set the temperature setpoint } } } // Loop over all Ideal Condenser Entering Set Point Managers for (SetPtMgrNum = 1; SetPtMgrNum <= NumIdealCondEntSetPtMgrs; ++SetPtMgrNum) { for (CtrlNodeIndex = 1; CtrlNodeIndex <= IdealCondEntSetPtMgr(SetPtMgrNum).NumCtrlNodes; ++CtrlNodeIndex) { // Loop over the list of nodes wanting // set points from this set point manager NodeNum = IdealCondEntSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); // Get the node number if (IdealCondEntSetPtMgr(SetPtMgrNum).CtrlTypeMode == iCtrlVarType_Temp) { Node(NodeNum).TempSetPoint = IdealCondEntSetPtMgr(SetPtMgrNum).SetPt; // Set the temperature setpoint } } } // loop over all single zone on/off cooling setpoint managers for (SetPtMgrNum = 1; SetPtMgrNum <= NumSZOneStageCoolingSetPtMgrs; ++SetPtMgrNum) { for (CtrlNodeIndex = 1; CtrlNodeIndex <= SZOneStageCoolingSetPtMgr(SetPtMgrNum).NumCtrlNodes; ++CtrlNodeIndex) { // Loop over the list of nodes wanting // set points from this set point manager NodeNum = SZOneStageCoolingSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); // Get the node number if (SZOneStageCoolingSetPtMgr(SetPtMgrNum).CtrlTypeMode == iCtrlVarType_Temp) { Node(NodeNum).TempSetPoint = SZOneStageCoolingSetPtMgr(SetPtMgrNum).SetPt; // Set the temperature setpoint } } } // loop over all single zone on/off heating setpoint managers for (SetPtMgrNum = 1; SetPtMgrNum <= NumSZOneStageHeatingSetPtMgrs; ++SetPtMgrNum) { for (CtrlNodeIndex = 1; CtrlNodeIndex <= SZOneStageHeatingSetPtMgr(SetPtMgrNum).NumCtrlNodes; ++CtrlNodeIndex) { // Loop over the list of nodes wanting // set points from this set point manager NodeNum = SZOneStageHeatingSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); // Get the node number if (SZOneStageHeatingSetPtMgr(SetPtMgrNum).CtrlTypeMode == iCtrlVarType_Temp) { Node(NodeNum).TempSetPoint = SZOneStageHeatingSetPtMgr(SetPtMgrNum).SetPt; // Set the temperature setpoint } } } // return water temperature reset setpoint managers for (SetPtMgrNum = 1; SetPtMgrNum <= NumReturnWaterResetChWSetPtMgrs; ++SetPtMgrNum) { auto &returnWaterSPM(ReturnWaterResetChWSetPtMgr(SetPtMgrNum)); if (returnWaterSPM.plantSetpointNodeIndex > 0) { Node(returnWaterSPM.plantSetpointNodeIndex).TempSetPoint = returnWaterSPM.currentSupplySetPt; } else { // if plant isn't set up yet, no need to set anything, just wait } } // hot-water return water temperature reset setpoint managers for (SetPtMgrNum = 1; SetPtMgrNum <= NumReturnWaterResetHWSetPtMgrs; ++SetPtMgrNum) { auto &returnWaterSPM(ReturnWaterResetHWSetPtMgr(SetPtMgrNum)); if (returnWaterSPM.plantSetpointNodeIndex > 0) { Node(returnWaterSPM.plantSetpointNodeIndex).TempSetPoint = returnWaterSPM.currentSupplySetPt; } else { // if plant isn't set up yet, no need to set anything, just wait } } } void UpdateMixedAirSetPoints() { // SUBROUTINE INFORMATION: // AUTHOR Fred Buhl // DATE WRITTEN May 2001 // MODIFIED na // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE // Loop over all the Mixed Air Managers and use their output arrays // to set the node setpoints. // METHODOLOGY EMPLOYED: // REFERENCES: // na // USE STATEMENTS: // Locals // SUBROUTINE PARAMETER DEFINITIONS: // na // INTERFACE BLOCK SPECIFICATIONS // na // DERIVED TYPE DEFINITIONS // na // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int SetPtMgrNum; int CtrlNodeIndex; int NodeNum; // Loop over all the Mixed Air Setpoint Managers for (SetPtMgrNum = 1; SetPtMgrNum <= NumMixedAirSetPtMgrs; ++SetPtMgrNum) { for (CtrlNodeIndex = 1; CtrlNodeIndex <= MixedAirSetPtMgr(SetPtMgrNum).NumCtrlNodes; ++CtrlNodeIndex) { // Loop over the list of nodes wanting // setpoints from this setpoint manager NodeNum = MixedAirSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); // Get the node number if (MixedAirSetPtMgr(SetPtMgrNum).CtrlTypeMode == iCtrlVarType_Temp) { Node(NodeNum).TempSetPoint = MixedAirSetPtMgr(SetPtMgrNum).SetPt; // Set the setpoint } } } } void UpdateOAPretreatSetPoints() { // SUBROUTINE INFORMATION: // AUTHOR M. J. Witte based on UpdateMixedAirSetPoints by Fred Buhl, // Work supported by ASHRAE research project 1254-RP // DATE WRITTEN January 2005 // MODIFIED na // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE // Loop over all the Outside Air Pretreat Managers and use their output arrays // to set the node setpoints. // METHODOLOGY EMPLOYED: // REFERENCES: // na // USE STATEMENTS: // Locals // SUBROUTINE PARAMETER DEFINITIONS: // na // INTERFACE BLOCK SPECIFICATIONS // na // DERIVED TYPE DEFINITIONS // na // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int SetPtMgrNum; int CtrlNodeIndex; int NodeNum; // Loop over all the Mixed Air Setpoint Managers for (SetPtMgrNum = 1; SetPtMgrNum <= NumOAPretreatSetPtMgrs; ++SetPtMgrNum) { for (CtrlNodeIndex = 1; CtrlNodeIndex <= OAPretreatSetPtMgr(SetPtMgrNum).NumCtrlNodes; ++CtrlNodeIndex) { // Loop over the list of nodes wanting // setpoints from this setpoint manager NodeNum = OAPretreatSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); // Get the node number { auto const SELECT_CASE_var(OAPretreatSetPtMgr(SetPtMgrNum).CtrlTypeMode); if (SELECT_CASE_var == iCtrlVarType_Temp) { // 'Temperature' Node(NodeNum).TempSetPoint = OAPretreatSetPtMgr(SetPtMgrNum).SetPt; // Set the setpoint } else if (SELECT_CASE_var == iCtrlVarType_MaxHumRat) { // 'MaximumHumidityRatio' Node(NodeNum).HumRatMax = OAPretreatSetPtMgr(SetPtMgrNum).SetPt; // Set the setpoint } else if (SELECT_CASE_var == iCtrlVarType_MinHumRat) { // 'MinimumHumidityRatio' Node(NodeNum).HumRatMin = OAPretreatSetPtMgr(SetPtMgrNum).SetPt; // Set the setpoint } else if (SELECT_CASE_var == iCtrlVarType_HumRat) { // 'HumidityRatio' Node(NodeNum).HumRatSetPoint = OAPretreatSetPtMgr(SetPtMgrNum).SetPt; // Set the setpoint } } } } } bool IsNodeOnSetPtManager(int const NodeNum, int const SetPtType) { // FUNCTION INFORMATION: // AUTHOR Sankaranarayanan K P // DATE WRITTEN January 2007 // MODIFIED na // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Determines if a particular node is acted upon by a specific setpoint manager // METHODOLOGY EMPLOYED: // Cycle through all setpoint managers and find if the node passed in has a setpoint manager of passed // in type associated to it. // REFERENCES: // na // USE STATEMENTS: // Return value bool IsNodeOnSetPtManager; // Locals int SetPtMgrNum; int NumNode; // First time called, get the input for all the setpoint managers if (GetInputFlag) { GetSetPointManagerInputs(); GetInputFlag = false; } IsNodeOnSetPtManager = false; for (SetPtMgrNum = 1; SetPtMgrNum <= NumAllSetPtMgrs; ++SetPtMgrNum) { if (SetPtType == AllSetPtMgr(SetPtMgrNum).CtrlTypeMode) { for (NumNode = 1; NumNode <= AllSetPtMgr(SetPtMgrNum).NumCtrlNodes; ++NumNode) { if (NodeNum == AllSetPtMgr(SetPtMgrNum).CtrlNodes(NumNode)) { IsNodeOnSetPtManager = true; break; } } } } return IsNodeOnSetPtManager; } bool NodeHasSPMCtrlVarType(int const NodeNum, int const iCtrlVarType) { // FUNCTION INFORMATION: // AUTHOR Chandan Sharma // DATE WRITTEN March 2013 // MODIFIED na // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Determines if a particular node is acted upon by a specific setpoint manager // METHODOLOGY EMPLOYED: // Cycle through all setpoint managers and find if the node has a specific control type // REFERENCES: // na // USE STATEMENTS: // na // INTERFACE BLOCK SPECIFICATIONS // na // SUBROUTINE PARAMETER DEFINITIONS: // na // SUBROUTINE ARGUMENT DEFINITIONS: // Return value bool NodeHasSPMCtrlVarType; // Locals // DERIVED TYPE DEFINITIONS // na // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int SetPtMgrNum; // loop counter for each set point manager int NumNode; // loop counter for each node and specific control type // FLOW: // First time called, get the input for all the setpoint managers if (GetInputFlag) { GetSetPointManagerInputs(); GetInputFlag = false; } // Initialize to false that node is not controlled by set point manager NodeHasSPMCtrlVarType = false; for (SetPtMgrNum = 1; SetPtMgrNum <= NumAllSetPtMgrs; ++SetPtMgrNum) { for (NumNode = 1; NumNode <= AllSetPtMgr(SetPtMgrNum).NumCtrlNodes; ++NumNode) { if (NodeNum == AllSetPtMgr(SetPtMgrNum).CtrlNodes(NumNode)) { if (AllSetPtMgr(SetPtMgrNum).CtrlTypeMode == iCtrlVarType) { // If specific control type is found, it doesn't matter if there are other of same type. NodeHasSPMCtrlVarType = true; goto SPMLoop_exit; } } } } SPMLoop_exit:; return NodeHasSPMCtrlVarType; } void ResetHumidityRatioCtrlVarType(int const NodeNum) { // FUNCTION INFORMATION: // AUTHOR Bereket Nigusse // DATE WRITTEN August 2015 // MODIFIED na // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Resets setpoint control variable type to "Maximum Humidty Ratio" if control variable type // is "Humidity Ratio". // METHODOLOGY EMPLOYED: // Cycle through all setpoint managers and find if the node has a "Humidity Ratio" control // variable type. This routine is called from "GetControllerInput" routine. This reset is // just to stop false warning message due to control variable type mismatch. // REFERENCES: // na // USE STATEMENTS: // na // INTERFACE BLOCK SPECIFICATIONS // na // SUBROUTINE PARAMETER DEFINITIONS: static std::string const RoutineName("ResetHumidityRatioCtrlVarType: "); // SUBROUTINE ARGUMENT DEFINITIONS: // na // Locals // DERIVED TYPE DEFINITIONS // na // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int SetPtMgrNum; // loop counter for each set point manager int NumNode; // loop counter for each node and specific control type int SetPtMgrNumPtr; // setpoint manager bool ResetCntrlVarType; // if true reset Hum Rat control var type to maxhumidity ratio // First time called, get the input for all the setpoint managers if (GetInputFlag) { GetSetPointManagerInputs(); GetInputFlag = false; } ResetCntrlVarType = false; for (SetPtMgrNum = 1; SetPtMgrNum <= NumAllSetPtMgrs; ++SetPtMgrNum) { for (NumNode = 1; NumNode <= AllSetPtMgr(SetPtMgrNum).NumCtrlNodes; ++NumNode) { if (NodeNum == AllSetPtMgr(SetPtMgrNum).CtrlNodes(NumNode)) { if (AllSetPtMgr(SetPtMgrNum).CtrlTypeMode == iCtrlVarType_HumRat) { AllSetPtMgr(SetPtMgrNum).CtrlTypeMode = iCtrlVarType_MaxHumRat; SetPtMgrNumPtr = SetPtMgrNum; ResetCntrlVarType = true; goto SPMLoop_exit; } } } } SPMLoop_exit:; if (ResetCntrlVarType) { ShowWarningError(RoutineName + cValidSPMTypes(AllSetPtMgr(SetPtMgrNumPtr).SPMType) + "=\"" + AllSetPtMgr(SetPtMgrNumPtr).Name + "\". "); ShowContinueError(" ..Humidity ratio control variable type specified is = " + cValidCtrlTypes(iCtrlVarType_HumRat)); ShowContinueError(" ..Humidity ratio control variable type allowed with water coils is = " + cValidCtrlTypes(iCtrlVarType_MaxHumRat)); ShowContinueError(" ..Setpointmanager control variable type is reset to = " + cValidCtrlTypes(iCtrlVarType_MaxHumRat)); ShowContinueError(" ..Simulation continues. "); } } void CheckIfAnyIdealCondEntSetPoint() { // SUBROUTINE INFORMATION: // AUTHOR Heejin Cho, PNNL // DATE WRITTEN March 2012 // MODIFIED na // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Determine if ideal condenser entering set point manager is used in model and set flag // Using/Aliasing using DataGlobals::AnyIdealCondEntSetPointInModel; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: std::string cCurrentModuleObject; cCurrentModuleObject = "SetpointManager:CondenserEnteringReset:Ideal"; NumIdealCondEntSetPtMgrs = inputProcessor->getNumObjectsFound(cCurrentModuleObject); if (NumIdealCondEntSetPtMgrs > 0) { AnyIdealCondEntSetPointInModel = true; } else { AnyIdealCondEntSetPointInModel = false; } } int GetHumidityRatioVariableType(int const CntrlNodeNum) { // SUBROUTINE INFORMATION: // AUTHOR B. A. Nigusse // DATE WRITTEN December 2013 // MODIFIED na // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE // Loop over all the humidity setpoint Managers to determine the // humidity ratio setpoint type // METHODOLOGY EMPLOYED: // REFERENCES: // na // USE STATEMENTS: // Return value int HumRatCntrlType; // Locals // SUBROUTINE PARAMETER DEFINITIONS: // INTERFACE BLOCK SPECIFICATIONS // na // DERIVED TYPE DEFINITIONS // na // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int SetPtMgrNum; int CtrlNodeIndex; int NodeNum; if (GetInputFlag) { GetSetPointManagerInputs(); GetInputFlag = false; } HumRatCntrlType = iCtrlVarType_HumRat; // Loop over the single zone maximum humidity setpoint Managers for (SetPtMgrNum = 1; SetPtMgrNum <= NumSZMaxHumSetPtMgrs; ++SetPtMgrNum) { for (CtrlNodeIndex = 1; CtrlNodeIndex <= SZMaxHumSetPtMgr(SetPtMgrNum).NumCtrlNodes; ++CtrlNodeIndex) { NodeNum = SZMaxHumSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); if (CntrlNodeNum == NodeNum) { HumRatCntrlType = iCtrlVarType_MaxHumRat; return HumRatCntrlType; } } } // Loop over the MultiZone maximum humidity setpoint Managers for (SetPtMgrNum = 1; SetPtMgrNum <= NumMZMaxHumSetPtMgrs; ++SetPtMgrNum) { for (CtrlNodeIndex = 1; CtrlNodeIndex <= MZMaxHumSetPtMgr(SetPtMgrNum).NumCtrlNodes; ++CtrlNodeIndex) { NodeNum = MZMaxHumSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); if (CntrlNodeNum == NodeNum) { HumRatCntrlType = iCtrlVarType_MaxHumRat; return HumRatCntrlType; } } } // Loop over the MultiZone Average Maxiumum Humidity Setpoint Managers for (SetPtMgrNum = 1; SetPtMgrNum <= NumMZAverageMaxHumSetPtMgrs; ++SetPtMgrNum) { for (CtrlNodeIndex = 1; CtrlNodeIndex <= MZAverageMaxHumSetPtMgr(SetPtMgrNum).NumCtrlNodes; ++CtrlNodeIndex) { NodeNum = MZAverageMaxHumSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); if (CntrlNodeNum == NodeNum) { HumRatCntrlType = iCtrlVarType_MaxHumRat; return HumRatCntrlType; } } } // Loop over the single zone minimum humidity setpoint Managers for (SetPtMgrNum = 1; SetPtMgrNum <= NumSZMinHumSetPtMgrs; ++SetPtMgrNum) { for (CtrlNodeIndex = 1; CtrlNodeIndex <= SZMinHumSetPtMgr(SetPtMgrNum).NumCtrlNodes; ++CtrlNodeIndex) { NodeNum = SZMinHumSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); if (CntrlNodeNum == NodeNum) { HumRatCntrlType = iCtrlVarType_MinHumRat; return HumRatCntrlType; } } } // Loop over the MultiZone minimum humidity setpoint Managers for (SetPtMgrNum = 1; SetPtMgrNum <= NumMZMinHumSetPtMgrs; ++SetPtMgrNum) { for (CtrlNodeIndex = 1; CtrlNodeIndex <= MZMinHumSetPtMgr(SetPtMgrNum).NumCtrlNodes; ++CtrlNodeIndex) { NodeNum = MZMinHumSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); if (CntrlNodeNum == NodeNum) { HumRatCntrlType = iCtrlVarType_MinHumRat; return HumRatCntrlType; } } } // Loop over the MultiZone Average Minimum Humidity Setpoint Managers for (SetPtMgrNum = 1; SetPtMgrNum <= NumMZAverageMinHumSetPtMgrs; ++SetPtMgrNum) { for (CtrlNodeIndex = 1; CtrlNodeIndex <= MZAverageMinHumSetPtMgr(SetPtMgrNum).NumCtrlNodes; ++CtrlNodeIndex) { NodeNum = MZAverageMinHumSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); if (CntrlNodeNum == NodeNum) { HumRatCntrlType = iCtrlVarType_MinHumRat; return HumRatCntrlType; } } } // Loop over the schedule setpoint managers for (SetPtMgrNum = 1; SetPtMgrNum <= NumSchSetPtMgrs; ++SetPtMgrNum) { for (CtrlNodeIndex = 1; CtrlNodeIndex <= SchSetPtMgr(SetPtMgrNum).NumCtrlNodes; ++CtrlNodeIndex) { if (CntrlNodeNum == SchSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex)) { if (SchSetPtMgr(SetPtMgrNum).CtrlTypeMode == iCtrlVarType_HumRat) { return iCtrlVarType_HumRat; } else if (SchSetPtMgr(SetPtMgrNum).CtrlTypeMode == iCtrlVarType_MaxHumRat) { return iCtrlVarType_MaxHumRat; } } } } return HumRatCntrlType; } void SetUpNewScheduledTESSetPtMgr( int const SchedPtr, int const SchedPtrCharge, Real64 NonChargeCHWTemp, Real64 ChargeCHWTemp, int const CompOpType, int const ControlNodeNum) { // SUBROUTINE INFORMATION: // AUTHOR Rick Strand // DATE WRITTEN August 2014 // MODIFIED na // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE // Set up new scheduled TES setpoint managers based on plant control Simple TES // METHODOLOGY EMPLOYED: // Set up internally created scheduled setpoint managers to control the setpoints // of various ice storage equipment with the user having to do this manually. The // point is to provide a simpler input description and take care of logic internally. // REFERENCES: // na // USE STATEMENTS: // Locals // SUBROUTINE PARAMETER DEFINITIONS: // INTERFACE BLOCK SPECIFICATIONS // na // DERIVED TYPE DEFINITIONS // na // SUBROUTINE LOCAL VARIABLE DECLARATIONS: bool ErrorsFoundinTESSchSetup(false); int NodeNum; NumSchTESSetPtMgrs += 1; NumAllSetPtMgrs += 1; // allocate/redimension structures for new item if (NumSchTESSetPtMgrs == 1) { // first time through--main structure not allocated yet SchTESSetPtMgr.allocate(1); } else if (NumSchTESSetPtMgrs > 1) { // no longer first time through--redimension to new size SchTESSetPtMgr.redimension(NumSchTESSetPtMgrs); } AllSetPtMgr.redimension(NumAllSetPtMgrs); // Set up the scheduled TES setpoint manager information SchTESSetPtMgr(NumSchTESSetPtMgrs).SchedPtr = SchedPtr; SchTESSetPtMgr(NumSchTESSetPtMgrs).SchedPtrCharge = SchedPtrCharge; SchTESSetPtMgr(NumSchTESSetPtMgrs).NonChargeCHWTemp = NonChargeCHWTemp; SchTESSetPtMgr(NumSchTESSetPtMgrs).ChargeCHWTemp = ChargeCHWTemp; SchTESSetPtMgr(NumSchTESSetPtMgrs).CompOpType = CompOpType; SchTESSetPtMgr(NumSchTESSetPtMgrs).CtrlNodeNum = ControlNodeNum; // Set up the all setpoint manager information for "verification" that no other setpoint manager controls the node that this new ones does AllSetPtMgr(NumAllSetPtMgrs).CtrlNodes.allocate(1); AllSetPtMgr(NumAllSetPtMgrs).CtrlNodes(1) = SchTESSetPtMgr(NumSchTESSetPtMgrs).CtrlNodeNum; AllSetPtMgr(NumAllSetPtMgrs).Name = SchSetPtMgr(NumSchTESSetPtMgrs).Name; AllSetPtMgr(NumAllSetPtMgrs).SPMType = iSPMType_TESScheduled; AllSetPtMgr(NumAllSetPtMgrs).CtrlTypeMode = iCtrlVarType_Temp; AllSetPtMgr(NumAllSetPtMgrs).NumCtrlNodes = 1; // Now verify that there is no overlap (no other SPM uses the node of the new setpoint manager) ErrorsFoundinTESSchSetup = false; VerifySetPointManagers(ErrorsFoundinTESSchSetup); if (ErrorsFoundinTESSchSetup) { ShowFatalError("Errors found in verification step of SetUpNewScheduledTESSetPtMgr. Program terminates."); } // Since all of the other setpoint managers not only been read and verified but also initialized, simulated, and updated, // we must now also initialize, simulate, and update the current SchTESStPtMgr that was just added. But the init and simulate // steps are the same so we can call the simulate first. SchTESSetPtMgr(NumSchTESSetPtMgrs).calculate(); // Now update reusing code from Update routine specialized to only doing the current (new) setpoint manager and then we are done NodeNum = SchTESSetPtMgr(NumSchTESSetPtMgrs).CtrlNodeNum; // Get the node number Node(NodeNum).TempSetPoint = SchTESSetPtMgr(NumSchTESSetPtMgrs).SetPt; } // end of SetUpNewScheduledTESSetPtMgr bool GetCoilFreezingCheckFlag(int const MixedAirSPMNum) { // SUBROUTINE INFORMATION: // AUTHOR L. Gu // DATE WRITTEN Nov. 2015 // MODIFIED na // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE // Get freezing check status // METHODOLOGY EMPLOYED: // REFERENCES: // na // USE STATEMENTS: // Return value bool FeezigCheckFlag; // Locals // SUBROUTINE PARAMETER DEFINITIONS: // INTERFACE BLOCK SPECIFICATIONS // na // DERIVED TYPE DEFINITIONS // na // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int CtrldNodeNum; if (GetInputFlag) { GetSetPointManagerInputs(); GetInputFlag = false; } FeezigCheckFlag = false; for (CtrldNodeNum = 1; CtrldNodeNum <= MixedAirSetPtMgr(MixedAirSPMNum).NumCtrlNodes; ++CtrldNodeNum) { if (MixedAirSetPtMgr(MixedAirSPMNum).FreezeCheckEnable) { FeezigCheckFlag = true; break; } } return FeezigCheckFlag; } // End of GetCoilFreezingCheckFlag int GetMixedAirNumWithCoilFreezingCheck(int const MixedAirNode) { // SUBROUTINE INFORMATION: // AUTHOR L. Gu // DATE WRITTEN Nov. 2015 // MODIFIED na // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE // Loop over all the MixedAir setpoint Managers to find coil freezing check flag // METHODOLOGY EMPLOYED: // REFERENCES: // na // USE STATEMENTS: // Return value int MixedAirSPMNum; // Locals // SUBROUTINE PARAMETER DEFINITIONS: // INTERFACE BLOCK SPECIFICATIONS // na // DERIVED TYPE DEFINITIONS // na // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int SetPtMgrNum; int CtrldNodeNum; if (GetInputFlag) { GetSetPointManagerInputs(); GetInputFlag = false; } MixedAirSPMNum = 0; for (SetPtMgrNum = 1; SetPtMgrNum <= NumMixedAirSetPtMgrs; ++SetPtMgrNum) { for (CtrldNodeNum = 1; CtrldNodeNum <= MixedAirSetPtMgr(SetPtMgrNum).NumCtrlNodes; ++CtrldNodeNum) { if (MixedAirSetPtMgr(SetPtMgrNum).CtrlNodes(CtrldNodeNum) == MixedAirNode) { if (MixedAirSetPtMgr(SetPtMgrNum).CoolCoilInNode > 0 && MixedAirSetPtMgr(SetPtMgrNum).CoolCoilOutNode > 0) { MixedAirSPMNum = CtrldNodeNum; break; } } } } return MixedAirSPMNum; } // End of GetMixedAirNumWithCoilFreezingCheck( } // namespace SetPointManager } // namespace EnergyPlus
55.758854
204
0.584328
[ "object", "model" ]
954f2027ed5773d964087a654b578fce495acffa
34,918
cpp
C++
opencl/bmfr.cpp
TheVaffel/bmfr
163fc5e11f2008e36366828d7d293494a856b7dd
[ "MIT" ]
null
null
null
opencl/bmfr.cpp
TheVaffel/bmfr
163fc5e11f2008e36366828d7d293494a856b7dd
[ "MIT" ]
null
null
null
opencl/bmfr.cpp
TheVaffel/bmfr
163fc5e11f2008e36366828d7d293494a856b7dd
[ "MIT" ]
null
null
null
/* The MIT License (MIT) * * Copyright (c) 2019 Matias Koskela / Tampere University * Copyright (c) 2018 Kalle Immonen / Tampere University of Technology * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #ifdef WITH_VISBUF #pragma message "Compiling with visualization buffer" #else #pragma message "Compiling without visualization buffer" #endif // WITH_VISBUF #include <fstream> #include "bmfr.hpp" #ifdef EVALUATION_MODE #include <diffcal.hpp> #endif #include <nlohmann/json.hpp> namespace json = nlohmann; #include "OpenImageIO/imageio.h" #include "CLUtils/CLUtils.hpp" namespace OpenImageIO = OIIO; #define _CRT_SECURE_NO_WARNINGS #define STR_HELPER(x) #x #define STR(x) STR_HELPER(x) // ### Choose your OpenCL device and platform with these defines ### #define PLATFORM_INDEX 0 #define DEVICE_INDEX 0 // Location where input frames and feature buffers are located // #define INPUT_DATA_PATH /home/haakon/data/bmfr_data/sponza-(static-camera)/inputs #define INPUT_DATA_PATH /home/haakon/Documents/NTNU/TDT4900/dataconstruction/output #define INPUT_DATA_PATH_STR STR(INPUT_DATA_PATH) // camera_matrices.h is expected to be in the same folder #include STR(INPUT_DATA_PATH/camera_matrices.h) // These names are appended with NN.exr, where NN is the frame number #define NOISY_FILE_NAME INPUT_DATA_PATH_STR"/color" #define NORMAL_FILE_NAME INPUT_DATA_PATH_STR"/shading_normal" #define POSITION_FILE_NAME INPUT_DATA_PATH_STR"/world_position" #define ALBEDO_FILE_NAME INPUT_DATA_PATH_STR"/albedo" #define OUTPUT_FILE_NAME "outputs/output" #ifdef EVALUATION_MODE #define REFERENCE_FILE_NAME "/home/haakon/Documents/NTNU/TDT4900/dataconstruction/reference_sponza/color" #endif // ### Edit these defines if you want to experiment different parameters ### // The amount of noise added to feature buffers to cancel sigularities #define NOISE_AMOUNT 1e-2 // The amount of new frame used in accumulated frame (1.f would mean no accumulation). #define BLEND_ALPHA 0.2f #define SECOND_BLEND_ALPHA 0.1f #define TAA_BLEND_ALPHA 0.2f // NOTE: if you want to use other than normal and world_position data you have to make // it available in the first accumulation kernel and in the weighted sum kernel /* #define NOT_SCALED_FEATURE_BUFFERS \ "1.f,"\ "normal.x,"\ "normal.y,"\ "normal.z,"\ */ // The next features are not in the range from -1 to 1 so they are scaled to be from 0 to 1. /* #define SCALED_FEATURE_BUFFERS \ "world_position.x,"\ "world_position.y,"\ "world_position.z,"\ "world_position.x*world_position.x,"\ "world_position.y*world_position.y,"\ "world_position.z*world_position.z" */ #define NOT_SCALED_FEATURE_BUFFERS \ "1.f,"\ "normal.z * normal.z,"\ "normal.x,"\ "normal.z,"\ "normal.y*normal.y,"\ #define SCALED_FEATURE_BUFFERS \ "world_position.x*world_position.x,"\ "world_position.x*world_position.z,"\ "world_position.y*wold_position.y,"\ "world_position.y*normal.y,"\ "world_position.y*world_position.z" // ### Edit these defines to change optimizations for your target hardware ### // If 1 uses ~half local memory space for R, but computing indexes is more complicated #define COMPRESSED_R 1 // If 1 stores tmp_data to private memory when it is loaded for dot product calculation #define CACHE_TMP_DATA 1 // If 1 tmp_data buffer is in half precision for faster load and store. // NOTE: if world position values are greater than 256 this cannot be used because // 256*256 is infinity in half-precision #define USE_HALF_PRECISION_IN_TMP_DATA 1 // If 1 adds __attribute__((reqd_work_group_size(256, 1, 1))) to fitter and // accumulate_noisy_data kernels. With some codes, attribute made the kernels faster and // with some it slowed them down. #define ADD_REQD_WG_SIZE 1 // These local sizes are used with 2D kernels which do not require spesific local size // (Global sizes are always a multiple of 32) #define LOCAL_WIDTH 8 #define LOCAL_HEIGHT 8 // Fastest on AMD Radeon Vega Frontier Edition was (LOCAL_WIDTH = 256, LOCAL_HEIGHT = 1) // Fastest on Nvidia Titan Xp was (LOCAL_WIDTH = 32, LOCAL_HEIGHT = 1) // ### Do not edit defines after this line unless you know what you are doing ### // For example, other than 32x32 blocks are not supported #define BLOCK_EDGE_LENGTH 32 #define BLOCK_PIXELS (BLOCK_EDGE_LENGTH * BLOCK_EDGE_LENGTH) // Rounds image sizes up to next multiple of BLOCK_EDGE_LENGTH #define WORKSET_WIDTH (BLOCK_EDGE_LENGTH * \ ((IMAGE_WIDTH + BLOCK_EDGE_LENGTH - 1) / BLOCK_EDGE_LENGTH)) #define WORKSET_HEIGHT (BLOCK_EDGE_LENGTH * \ ((IMAGE_HEIGHT + BLOCK_EDGE_LENGTH - 1) / BLOCK_EDGE_LENGTH)) #define WORKSET_WITH_MARGINS_WIDTH (WORKSET_WIDTH + BLOCK_EDGE_LENGTH) #define WORKSET_WITH_MARGINS_HEIGHT (WORKSET_HEIGHT + BLOCK_EDGE_LENGTH) #define OUTPUT_SIZE (WORKSET_WIDTH * WORKSET_HEIGHT) // 256 is the maximum local size on AMD GCN // Synchronization within 32x32=1024 block requires unrollign four times #define LOCAL_SIZE 256 #define FITTER_GLOBAL (LOCAL_SIZE * ((WORKSET_WITH_MARGINS_WIDTH / BLOCK_EDGE_LENGTH) * \ (WORKSET_WITH_MARGINS_HEIGHT / BLOCK_EDGE_LENGTH))) // Creates two same buffers and swap() call can be used to change which one is considered // current and which one previous template <class T> class Double_buffer { private: T a, b; bool swapped; public: template <typename... Args> Double_buffer(Args... args) : a(args...), b(args...), swapped(false){}; T *current() { return swapped ? &a : &b; } T *previous() { return swapped ? &b : &a; } void swap() { swapped = !swapped; } }; struct Operation_result { bool success; std::string error_message; Operation_result(bool success, const std::string &error_message = "") : success(success), error_message(error_message) {} }; Operation_result read_image_file( const std::string &file_name, const int frame, float *buffer) { std::unique_ptr<OpenImageIO::ImageInput> in = OpenImageIO::ImageInput::open( file_name + std::to_string(frame) + ".exr"); if (!in || in->spec().width != IMAGE_WIDTH || in->spec().height != IMAGE_HEIGHT || in->spec().nchannels != 3) { if(!in) { std::cerr << "Could not open " << (file_name + std::to_string(frame) + ".exr") << std::endl; } // std::cout << "in = " << in << std::endl; // std::cout << "width = " << in->spec().width << ", height = " << in->spec().height << ", nchannels = " << in->spec().nchannels << std::endl; return {false, "Can't open image file or it has wrong type: " + file_name}; } // NOTE: this converts .exr files that might be in halfs to single precision floats // In the dataset distributed with the BMFR paper all exr files are in single precision in->read_image(OpenImageIO::TypeDesc::FLOAT, buffer); in->close(); return {true}; } Operation_result load_image(cl_float *image, const std::string file_name, const int frame) { Operation_result result = read_image_file(file_name, frame, image); if (!result.success) return result; return {true}; } ImageData initializeData() { ImageData image_data; printf("Loading input data.\n"); bool error = false; #pragma omp parallel for for (int frame = 0; frame < FRAME_COUNT; ++frame) { if (error) continue; image_data.out_data[frame].resize(3 * OUTPUT_SIZE); image_data.albedos[frame].resize(3 * IMAGE_WIDTH * IMAGE_HEIGHT); Operation_result result = load_image(image_data.albedos[frame].data(), ALBEDO_FILE_NAME, frame); if (!result.success) { error = true; printf("Albedo buffer loading failed, reason: %s\n", result.error_message.c_str()); continue; } image_data.normals[frame].resize(3 * IMAGE_WIDTH * IMAGE_HEIGHT); result = load_image(image_data.normals[frame].data(), NORMAL_FILE_NAME, frame); if (!result.success) { error = true; printf("Normal buffer loading failed, reason: %s\n", result.error_message.c_str()); continue; } image_data.positions[frame].resize(3 * IMAGE_WIDTH * IMAGE_HEIGHT); result = load_image(image_data.positions[frame].data(), POSITION_FILE_NAME, frame); if (!result.success) { error = true; printf("Position buffer loading failed, reason: %s\n", result.error_message.c_str()); continue; } image_data.noisy_input[frame].resize(3 * IMAGE_WIDTH * IMAGE_HEIGHT); result = load_image(image_data.noisy_input[frame].data(), NOISY_FILE_NAME, frame); if (!result.success) { error = true; printf("Noisy buffer loading failed, reason: %s\n", result.error_message.c_str()); continue; } #ifdef EVALUATION_MODE image_data.reference_data[frame].resize(3 * IMAGE_WIDTH * IMAGE_HEIGHT); result = load_image(image_data.reference_data[frame].data(), REFERENCE_FILE_NAME, frame); if(!result.success) { error = true; printf("Reference buffer loading failed, reason: %s\n", result.error_message.c_str()); continue; } #endif std::cout << "Read buffers for frame " << frame << std::endl; } if (error) { printf("One or more errors occurred during buffer loading\n"); exit(-1); } return image_data; } void writeOutputImages(const ImageData& image_data, const std::string& output_file) { // Store results bool error = false; #pragma omp parallel for for (int frame = 0; frame < FRAME_COUNT; ++frame) { if (error) continue; // Output image std::string output_file_name = output_file + std::to_string(frame) + ".png"; // Crops back from WORKSET_SIZE to IMAGE_SIZE OpenImageIO::ImageSpec spec(IMAGE_WIDTH, IMAGE_HEIGHT, 3, OpenImageIO::TypeDesc::FLOAT); std::unique_ptr<OpenImageIO::ImageOutput> out(OpenImageIO::ImageOutput::create(output_file_name)); if (out && out->open(output_file_name, spec)) { out->write_image(OpenImageIO::TypeDesc::FLOAT, image_data.out_data[frame].data(), 3 * sizeof(cl_float), WORKSET_WIDTH * 3 * sizeof(cl_float), 0); out->close(); } else { printf("Can't create image file on disk to location %s\n", output_file_name.c_str()); error = true; continue; } } if (error) { printf("One or more errors occurred during image saving\n"); exit(-1); } printf("Wrote images with format %s\n", output_file.c_str()); } float clamp(float value, float minimum, float maximum) { return std::max(std::min(value, maximum), minimum); } void initOpenCL(OpenCLState& ostate) { printf("Initialize.\n"); ostate.context = cl::Context(ostate.clEnv.addContext(PLATFORM_INDEX)); // Find name of the used device std::string deviceName; ostate.clEnv.devices[0][DEVICE_INDEX].getInfo(CL_DEVICE_NAME, &deviceName); printf("Using device named: %s\n", deviceName.c_str()); ostate.queue = cl::CommandQueue(ostate.clEnv.addQueue(0, DEVICE_INDEX, CL_QUEUE_PROFILING_ENABLE)); } json::json getProfileObj(ProfileState& profile_state) { json::json obj = json::json::object(); for(int i = 0; i < ProfileState::NUM_STAGES; i++) { obj[ProfileState::STAGE_NAMES[i]] = json::json(profile_state.times[i]); } return obj; } template <unsigned int num> json::json getProfileArray(clutils::ProfilingInfo<num>& profile) { json::json arr = json::json::array(); for(unsigned int i = 0; i < num; i++) { arr.push_back(profile[i]); } return arr; } int tasks(ImageData& image_data, ProfileState& profile_state, OpenCLState& oc_state, const std::string& not_scaled_feature_buffers, const std::string& scaled_feature_buffers, std::ostream& output_stream = std::cout) { std::string features_not_scaled(not_scaled_feature_buffers); std::string features_scaled(scaled_feature_buffers); int features_not_scaled_count = std::count(features_not_scaled.begin(), features_not_scaled.end(), ','); if(features_not_scaled_count == 0 && features_not_scaled.length() > 0) { features_not_scaled_count = 1; } // + 1 because last one does not have ',' after it. const int features_scaled_count = std::count(features_scaled.begin(), features_scaled.end(), ',') + (features_scaled.length() > 0 ? 1 : 0); // + 3 stands for three noisy channels. const int buffer_count = features_not_scaled_count + features_scaled_count + 3; // Create and build the kernel std::stringstream build_options; build_options << " -D BUFFER_COUNT=" << buffer_count << " -D FEATURES_NOT_SCALED=" << features_not_scaled_count << " -D FEATURES_SCALED=" << features_scaled_count << " -D IMAGE_WIDTH=" << IMAGE_WIDTH << " -D IMAGE_HEIGHT=" << IMAGE_HEIGHT << " -D WORKSET_WIDTH=" << WORKSET_WIDTH << " -D WORKSET_HEIGHT=" << WORKSET_HEIGHT << " -D FEATURE_BUFFERS=" << (not_scaled_feature_buffers + scaled_feature_buffers) << " -D LOCAL_WIDTH=" << LOCAL_WIDTH << " -D LOCAL_HEIGHT=" << LOCAL_HEIGHT << " -D WORKSET_WITH_MARGINS_WIDTH=" << WORKSET_WITH_MARGINS_WIDTH << " -D WORKSET_WITH_MARGINS_HEIGHT=" << WORKSET_WITH_MARGINS_HEIGHT << " -D BLOCK_EDGE_LENGTH=" << STR(BLOCK_EDGE_LENGTH) << " -D BLOCK_PIXELS=" << BLOCK_PIXELS << " -D R_EDGE=" << buffer_count - 2 << " -D NOISE_AMOUNT=" << STR(NOISE_AMOUNT) << " -D BLEND_ALPHA=" << STR(BLEND_ALPHA) << " -D SECOND_BLEND_ALPHA=" << STR(SECOND_BLEND_ALPHA) << " -D TAA_BLEND_ALPHA=" << STR(TAA_BLEND_ALPHA) << " -D POSITION_LIMIT_SQUARED=" << position_limit_squared << " -D NORMAL_LIMIT_SQUARED=" << normal_limit_squared << " -D COMPRESSED_R=" << STR(COMPRESSED_R) << " -D CACHE_TMP_DATA=" << STR(CACHE_TMP_DATA) << " -D ADD_REQD_WG_SIZE=" << STR(ADD_REQD_WG_SIZE) << " -D LOCAL_SIZE=" << STR(LOCAL_SIZE) << " -D USE_HALF_PRECISION_IN_TMP_DATA=" << STR(USE_HALF_PRECISION_IN_TMP_DATA) #ifdef WITH_VISBUF << " -D WITH_VISBUF " #endif // WITH_VISBUF ; cl::Kernel &fitter_kernel(oc_state.clEnv.addProgram(0, "bmfr.cl", "fitter", build_options.str().c_str())); cl::Kernel &weighted_sum_kernel(oc_state.clEnv.addProgram(0, "bmfr.cl", "weighted_sum", build_options.str().c_str())); cl::Kernel &accum_noisy_kernel(oc_state.clEnv.addProgram(0, "bmfr.cl", "accumulate_noisy_data", build_options.str().c_str())); cl::Kernel &accum_filtered_kernel(oc_state.clEnv.addProgram(0, "bmfr.cl", "accumulate_filtered_data", build_options.str().c_str())); cl::Kernel &taa_kernel(oc_state.clEnv.addProgram(0, "bmfr.cl", "taa", build_options.str().c_str())); cl::NDRange accum_global(WORKSET_WITH_MARGINS_WIDTH, WORKSET_WITH_MARGINS_HEIGHT); cl::NDRange output_global(WORKSET_WIDTH, WORKSET_HEIGHT); cl::NDRange local(LOCAL_WIDTH, LOCAL_HEIGHT); cl::NDRange fitter_global(FITTER_GLOBAL); cl::NDRange fitter_local(LOCAL_SIZE); // Create buffers Double_buffer<cl::Buffer> normals_buffer(oc_state.context, CL_MEM_READ_WRITE, OUTPUT_SIZE * 3 * sizeof(cl_float)); Double_buffer<cl::Buffer> positions_buffer(oc_state.context, CL_MEM_READ_WRITE, OUTPUT_SIZE * 3 * sizeof(cl_float)); Double_buffer<cl::Buffer> noisy_buffer(oc_state.context, CL_MEM_READ_WRITE, OUTPUT_SIZE * 3 * sizeof(cl_float)); size_t in_buffer_data_size = USE_HALF_PRECISION_IN_TMP_DATA ? sizeof(cl_half) : sizeof(cl_float); cl::Buffer in_buffer(oc_state.context, CL_MEM_READ_WRITE, WORKSET_WITH_MARGINS_WIDTH * WORKSET_WITH_MARGINS_HEIGHT * buffer_count * in_buffer_data_size, nullptr); cl::Buffer filtered_buffer(oc_state.context, CL_MEM_READ_WRITE, OUTPUT_SIZE * 3 * sizeof(cl_float)); Double_buffer<cl::Buffer> out_buffer(oc_state.context, CL_MEM_READ_WRITE, WORKSET_WITH_MARGINS_WIDTH * WORKSET_WITH_MARGINS_HEIGHT * 3 * sizeof(cl_float)); Double_buffer<cl::Buffer> result_buffer(oc_state.context, CL_MEM_READ_WRITE, OUTPUT_SIZE * 3 * sizeof(cl_float)); cl::Buffer prev_pixels_buffer(oc_state.context, CL_MEM_READ_WRITE, OUTPUT_SIZE * sizeof(cl_float2)); cl::Buffer accept_buffer(oc_state.context, CL_MEM_READ_WRITE, OUTPUT_SIZE * sizeof(cl_uchar)); cl::Buffer albedo_buffer(oc_state.context, CL_MEM_READ_ONLY, IMAGE_WIDTH * IMAGE_HEIGHT * 3 * sizeof(cl_float)); cl::Buffer tone_mapped_buffer(oc_state.context, CL_MEM_READ_WRITE, IMAGE_WIDTH * IMAGE_HEIGHT * 3 * sizeof(cl_float)); cl::Buffer weights_buffer(oc_state.context, CL_MEM_READ_WRITE, (FITTER_GLOBAL / 256) * (buffer_count - 3) * 3 * sizeof(cl_float)); cl::Buffer mins_maxs_buffer(oc_state.context, CL_MEM_READ_WRITE, (FITTER_GLOBAL / 256) * 6 * sizeof(cl_float2)); Double_buffer<cl::Buffer> spp_buffer(oc_state.context, CL_MEM_READ_WRITE, OUTPUT_SIZE * sizeof(cl_char)); #ifdef WITH_VISBUF cl::Buffer vis_buffer(oc_state.context, CL_MEM_READ_WRITE, OUTPUT_SIZE * 3 * sizeof(cl_float)); #endif std::vector<Double_buffer<cl::Buffer> *> all_double_buffers = { &normals_buffer, &positions_buffer, &noisy_buffer, &out_buffer, &result_buffer, &spp_buffer}; // Set kernel arguments int arg_index = 0; accum_noisy_kernel.setArg(arg_index++, prev_pixels_buffer); accum_noisy_kernel.setArg(arg_index++, accept_buffer); arg_index = 0; #if COMPRESSED_R const int r_size = ((buffer_count - 2) * (buffer_count - 1) / 2) * sizeof(cl_float3); #else const int r_size = (buffer_count - 2) * (buffer_count - 2) * sizeof(cl_float3); #endif fitter_kernel.setArg(arg_index++, LOCAL_SIZE * sizeof(float), nullptr); fitter_kernel.setArg(arg_index++, BLOCK_PIXELS * sizeof(float), nullptr); fitter_kernel.setArg(arg_index++, r_size, nullptr); fitter_kernel.setArg(arg_index++, weights_buffer); fitter_kernel.setArg(arg_index++, mins_maxs_buffer); arg_index = 0; weighted_sum_kernel.setArg(arg_index++, weights_buffer); weighted_sum_kernel.setArg(arg_index++, mins_maxs_buffer); weighted_sum_kernel.setArg(arg_index++, filtered_buffer); arg_index = 0; accum_filtered_kernel.setArg(arg_index++, filtered_buffer); accum_filtered_kernel.setArg(arg_index++, prev_pixels_buffer); accum_filtered_kernel.setArg(arg_index++, accept_buffer); accum_filtered_kernel.setArg(arg_index++, albedo_buffer); accum_filtered_kernel.setArg(arg_index++, tone_mapped_buffer); arg_index = 0; taa_kernel.setArg(arg_index++, prev_pixels_buffer); taa_kernel.setArg(arg_index++, tone_mapped_buffer); oc_state.queue.finish(); std::vector<clutils::GPUTimer<std::milli>> accum_noisy_timer; std::vector<clutils::GPUTimer<std::milli>> copy_timer; std::vector<clutils::GPUTimer<std::milli>> fitter_timer; std::vector<clutils::GPUTimer<std::milli>> weighted_sum_timer; std::vector<clutils::GPUTimer<std::milli>> accum_filtered_timer; std::vector<clutils::GPUTimer<std::milli>> taa_timer; accum_noisy_timer.assign(FRAME_COUNT - 1, clutils::GPUTimer<std::milli>(oc_state.clEnv.devices[0][0])); copy_timer.assign(FRAME_COUNT, clutils::GPUTimer<std::milli>(oc_state.clEnv.devices[0][0])); fitter_timer.assign(FRAME_COUNT, clutils::GPUTimer<std::milli>(oc_state.clEnv.devices[0][0])); weighted_sum_timer.assign(FRAME_COUNT, clutils::GPUTimer<std::milli>(oc_state.clEnv.devices[0][0])); accum_filtered_timer.assign(FRAME_COUNT - 1, clutils::GPUTimer<std::milli>(oc_state.clEnv.devices[0][0])); taa_timer.assign(FRAME_COUNT - 1, clutils::GPUTimer<std::milli>(oc_state.clEnv.devices[0][0])); clutils::ProfilingInfo<FRAME_COUNT - 1> profile_info_accum_noisy( "Accumulation of noisy data"); clutils::ProfilingInfo<FRAME_COUNT> profile_info_copy( "Copy input buffer"); clutils::ProfilingInfo<FRAME_COUNT> profile_info_fitter( "Fitting feature buffers to noisy data"); clutils::ProfilingInfo<FRAME_COUNT> profile_info_weighted_sum( "Weighted sum"); clutils::ProfilingInfo<FRAME_COUNT - 1> profile_info_accum_filtered( "Accumulation of filtered data"); clutils::ProfilingInfo<FRAME_COUNT - 1> profile_info_taa( "TAA"); clutils::ProfilingInfo<FRAME_COUNT - 1> profile_info_total( "Total time in all kernels (including intermediate launch overheads)"); // Note: in real use case there would not be WriteBuffer and ReadBuffer function calls // because the input data comes from the path tracer and output goes to the screen for (int frame = 0; frame < FRAME_COUNT; ++frame) { oc_state.queue.enqueueWriteBuffer(albedo_buffer, true, 0, IMAGE_WIDTH * IMAGE_HEIGHT * 3 * sizeof(cl_float), image_data.albedos[frame].data()); oc_state.queue.enqueueWriteBuffer(*normals_buffer.current(), true, 0, IMAGE_WIDTH * IMAGE_HEIGHT * 3 * sizeof(cl_float), image_data.normals[frame].data()); oc_state.queue.enqueueWriteBuffer(*positions_buffer.current(), true, 0, IMAGE_WIDTH * IMAGE_HEIGHT * 3 * sizeof(cl_float), image_data.positions[frame].data()); oc_state.queue.enqueueWriteBuffer(*noisy_buffer.current(), true, 0, IMAGE_WIDTH * IMAGE_HEIGHT * 3 * sizeof(cl_float), image_data.noisy_input[frame].data()); // On the first frame accum_noisy_kernel just copies to the in_buffer arg_index = 2; accum_noisy_kernel.setArg(arg_index++, *normals_buffer.current()); accum_noisy_kernel.setArg(arg_index++, *normals_buffer.previous()); accum_noisy_kernel.setArg(arg_index++, *positions_buffer.current()); accum_noisy_kernel.setArg(arg_index++, *positions_buffer.previous()); accum_noisy_kernel.setArg(arg_index++, *noisy_buffer.current()); accum_noisy_kernel.setArg(arg_index++, *noisy_buffer.previous()); accum_noisy_kernel.setArg(arg_index++, *spp_buffer.previous()); accum_noisy_kernel.setArg(arg_index++, *spp_buffer.current()); accum_noisy_kernel.setArg(arg_index++, in_buffer); const int matrix_index = frame == 0 ? 0 : frame - 1; accum_noisy_kernel.setArg(arg_index++, sizeof(cl_float16), &(camera_matrices[matrix_index][0][0])); accum_noisy_kernel.setArg(arg_index++, sizeof(cl_float2), &(pixel_offsets[frame][0])); accum_noisy_kernel.setArg(arg_index++, sizeof(cl_int), &frame); oc_state.queue.enqueueNDRangeKernel(accum_noisy_kernel, cl::NullRange, accum_global, local, nullptr, &accum_noisy_timer[matrix_index].event()); arg_index = 5; fitter_kernel.setArg(arg_index++, in_buffer); fitter_kernel.setArg(arg_index++, sizeof(cl_int), &frame); oc_state.queue.enqueueNDRangeKernel(fitter_kernel, cl::NullRange, fitter_global, fitter_local, nullptr, &fitter_timer[frame].event()); arg_index = 3; weighted_sum_kernel.setArg(arg_index++, *normals_buffer.current()); weighted_sum_kernel.setArg(arg_index++, *positions_buffer.current()); weighted_sum_kernel.setArg(arg_index++, *noisy_buffer.current()); weighted_sum_kernel.setArg(arg_index++, sizeof(cl_int), &frame); oc_state.queue.enqueueNDRangeKernel(weighted_sum_kernel, cl::NullRange, output_global, local, nullptr, &weighted_sum_timer[frame].event()); arg_index = 5; accum_filtered_kernel.setArg(arg_index++, *spp_buffer.current()); accum_filtered_kernel.setArg(arg_index++, *out_buffer.previous()); accum_filtered_kernel.setArg(arg_index++, *out_buffer.current()); accum_filtered_kernel.setArg(arg_index++, sizeof(cl_int), &frame); oc_state.queue.enqueueNDRangeKernel(accum_filtered_kernel, cl::NullRange, output_global, local, nullptr, &accum_filtered_timer[matrix_index].event()); arg_index = 2; taa_kernel.setArg(arg_index++, *result_buffer.current()); taa_kernel.setArg(arg_index++, *result_buffer.previous()); taa_kernel.setArg(arg_index++, sizeof(cl_int), &frame); #ifdef WITH_VISBUF taa_kernel.setArg(arg_index++, vis_buffer); // #endif oc_state.queue.enqueueNDRangeKernel(taa_kernel, cl::NullRange, output_global, local, nullptr, &taa_timer[matrix_index].event()); // This is not timed because in real use case the result is stored to frame buffer #ifdef WITH_VISBUF oc_state.queue.enqueueReadBuffer(vis_buffer, false, 0, OUTPUT_SIZE * 3 * sizeof(cl_float), image_data.out_data[frame].data()); // #else oc_state.queue.enqueueReadBuffer(*result_buffer.current(), false, 0, OUTPUT_SIZE * 3 * sizeof(cl_float), image_data.out_data[frame].data()); #endif // Swap all double buffers std::for_each(all_double_buffers.begin(), all_double_buffers.end(), std::bind(&Double_buffer<cl::Buffer>::swap, std::placeholders::_1)); } oc_state.queue.finish(); // Store profiling data for (int i = 0; i < FRAME_COUNT; ++i) { if (i > 0) { profile_info_accum_noisy[i - 1] = accum_noisy_timer[i - 1].duration(); profile_state.times[ProfileState::Indices::accumulation_noisy].push_back(accum_noisy_timer[i - 1].duration()); profile_info_accum_filtered[i - 1] = accum_filtered_timer[i - 1].duration(); profile_state.times[ProfileState::Indices::accumulation_filtered].push_back(accum_filtered_timer[i - 1].duration()); profile_info_taa[i - 1] = taa_timer[i - 1].duration(); profile_state.times[ProfileState::Indices::taa].push_back(taa_timer[i - 1].duration()); cl_ulong total_start = accum_noisy_timer[i - 1].event().getProfilingInfo<CL_PROFILING_COMMAND_START>(); cl_ulong total_end = taa_timer[i - 1].event().getProfilingInfo<CL_PROFILING_COMMAND_END>(); profile_info_total[i - 1] = (total_end - total_start) * taa_timer[i - 1].getUnit(); profile_state.times[ProfileState::Indices::total].push_back((total_end - total_start) * taa_timer[i - 1].getUnit()); } profile_info_fitter[i] = fitter_timer[i].duration(); profile_state.times[ProfileState::Indices::fitting].push_back(fitter_timer[i].duration()); profile_info_weighted_sum[i] = weighted_sum_timer[i].duration(); profile_state.times[ProfileState::Indices::weighted_sum].push_back(weighted_sum_timer[i].duration()); } #ifndef EVALUATION_MODE json::json accum_noisy_arr = getProfileArray(profile_info_accum_noisy); json::json accum_filtered_arr = getProfileArray(profile_info_accum_filtered); json::json taa_arr = getProfileArray(profile_info_taa); json::json fitter_arr = getProfileArray(profile_info_fitter); json::json weighted_sum_arr = getProfileArray(profile_info_weighted_sum); json::json total_arr = getProfileArray(profile_info_total); json::json out_object = {}; out_object["accum_noisy"] = accum_noisy_arr; out_object["accum_filtered"] = accum_filtered_arr; out_object["taa"] = taa_arr; out_object["fitter"] = fitter_arr; out_object["weighted_sum"] = weighted_sum_arr; out_object["total"] = total_arr; std::string out_object_name = OUTPUT_FILE_NAME + std::string("_time_results.json"); std::ofstream out_object_file(out_object_name); out_object_file << std::setw(4) << out_object << std::endl; out_object_file.close(); std::cout << "Wrote time results to " << out_object_name << std::endl; if (FRAME_COUNT > 1) profile_info_accum_noisy.print(output_stream); profile_info_fitter.print(output_stream); profile_info_weighted_sum.print(output_stream); if (FRAME_COUNT > 1) { profile_info_accum_filtered.print(output_stream); profile_info_taa.print(output_stream); profile_info_total.print(output_stream); } #endif return 0; } #ifdef EVALUATION_MODE int run_evaluation_mode(ImageData& image_data) { ImageDataIterator image_iterator(0, image_data, IMAGE_WIDTH, IMAGE_HEIGHT); std::vector<std::string> not_scaled_buffers = { "1.f", "normal.x", "normal.y", "normal.z" }; std::vector<std::string> scaled_buffers = { "world_position.x", "world_position.y", "world_position.z", "world_position.x*world_position.x", "world_position.y*world_position.y", "world_position.z*world_position.z" }; OpenCLState ocl_state; initOpenCL(ocl_state); std::vector<bool> added_buffers(not_scaled_buffers.size() + scaled_buffers.size(), false); int sum_num_buffers = not_scaled_buffers.size() + scaled_buffers.size(); std::string str1 = ""; std::string str2 = ""; std::ofstream result_stream("results/results.txt"); const int MAX_BUFFERS = 12; // Maximum amount of features we'll add int num_added = 0; json::json profile_list; while(true) { if(num_added >= MAX_BUFFERS || num_added >= sum_num_buffers) { break; } int best_ind = -1; float best_score = -1; for(size_t i = 0; i < not_scaled_buffers.size() + scaled_buffers.size(); i++) { if(added_buffers[i]) { continue; } std::cout << "Loop iteration " << num_added << ", " << i << std::endl; bool is_scaled = i >= not_scaled_buffers.size(); std::string buf = is_scaled ? scaled_buffers[i - not_scaled_buffers.size()] : not_scaled_buffers[i]; std::string tmp_str1 = str1; std::string tmp_str2 = str2; if(!is_scaled) { if(tmp_str1.length() != 0) { tmp_str1 += ","; } tmp_str1 += buf; } else { if(tmp_str2.length() != 0) { tmp_str2 += ","; } tmp_str2 += buf; } // Make sure we have separator if both are non-empty if(tmp_str1.length() > 0 && tmp_str2.length() > 0) { tmp_str1 += ","; } ProfileState profile_state; tasks(image_data, profile_state, ocl_state, tmp_str1, tmp_str2, result_stream); DiffResultState diff_result = computeDiff(image_iterator, false); // without ssim float vmaf_score = diff_result.means[DIFF_VMAF_INDEX]; if(vmaf_score > best_score) { best_ind = i; best_score = vmaf_score; } image_iterator.reset(); } added_buffers[best_ind] = true; bool is_best_scaled = best_ind >= (int)not_scaled_buffers.size(); std::string buf = is_best_scaled ? scaled_buffers[best_ind - not_scaled_buffers.size()] : not_scaled_buffers[best_ind]; std::cout << "Picked " << buf << " as buffer number " << num_added << std::endl; if(!is_best_scaled) { if(str1.length() != 0) { str1 += ","; } str1 += buf; } else { if(str2.length() != 0) { str2 += ","; } str2 += buf; } std::string real_str1 = str1; if(str1.length() > 0 && str2.length() > 0) { real_str1 += ","; } std::cout << "Current choice of buffers is " << real_str1 << str2 << std::endl; // We run it once more, to save the stats. Not ideal, but it works ProfileState profile_state; tasks(image_data, profile_state, ocl_state, real_str1, str2, result_stream); DiffResultState diff_result = computeDiff(image_iterator, true); // with ssim outputResult(diff_result, "results/diff_results" + std::to_string(num_added) + ".txt", false); json::json profile_obj = getProfileObj(profile_state); profile_list[std::to_string(num_added + 1)] = profile_obj; writeOutputImages(image_data, "results/" + std::to_string(num_added) + "buffers"); num_added++; image_iterator.reset(); } result_stream << profile_list << std::endl; result_stream.close(); return 0; } #endif // EVALUATION_MODE int main() { try { ImageData image_data = initializeData(); #ifdef EVALUATION_MODE return run_evaluation_mode(image_data); #else ProfileState profile_state; OpenCLState oc_state; initOpenCL(oc_state); int result = tasks(image_data, profile_state, oc_state, NOT_SCALED_FEATURE_BUFFERS, SCALED_FEATURE_BUFFERS); writeOutputImages(image_data, OUTPUT_FILE_NAME); return result; #endif } catch (std::exception &err) { printf("Exception: %s", err.what()); std::exception *err_ptr = &err; cl::Error *cl_err = dynamic_cast<cl::Error *>(err_ptr); if (cl_err != nullptr) { printf(" call with error code %i = %s\n", cl_err->err(), clutils::getOpenCLErrorCodeString(cl_err->err())); return cl_err->err(); } printf("\n"); return 1; } }
38.711752
148
0.669397
[ "object", "vector" ]
9558a4ebd55c9e74f7004f99fdc941fb19099fb7
18,991
hpp
C++
include/OpenFrames/ReferenceFrame.hpp
ravidavi/OpenFrames
67cce87f1ccd23df91d6d070d86c06ceb180dadb
[ "Apache-2.0" ]
26
2017-08-16T18:17:50.000Z
2022-03-11T10:23:52.000Z
include/OpenFrames/ReferenceFrame.hpp
ravidavi/OpenFrames
67cce87f1ccd23df91d6d070d86c06ceb180dadb
[ "Apache-2.0" ]
4
2018-10-18T12:31:19.000Z
2020-08-12T08:59:25.000Z
include/OpenFrames/ReferenceFrame.hpp
ravidavi/OpenFrames
67cce87f1ccd23df91d6d070d86c06ceb180dadb
[ "Apache-2.0" ]
11
2018-09-10T18:29:07.000Z
2022-03-09T13:53:52.000Z
/*********************************** Copyright 2020 Ravishankar Mathur 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. ***********************************/ /** \file ReferenceFrame.hpp * Declaration of ReferenceFrame class. */ #ifndef _OF_REFERENCEFRAME_ #define _OF_REFERENCEFRAME_ #include <OpenFrames/Export.h> #include <OpenFrames/FrameTransform.hpp> #include <OpenFrames/Vector.hpp> #include <osg/Geode> #include <osg/LightSource> #include <osgText/Text> #include <osg/Referenced> #include <osg/ref_ptr> #include <osgShadow/ShadowedScene> #include <vector> #include <string> /** \namespace OpenFrames * This namespace contains all OpenFrames code / functionality. */ namespace OpenFrames { class FrameTracker; class Trajectory; /* * \class ReferenceFrame. * * \brief Defines the standard functions of a classical reference frame. * * A reference frame can only contain other reference frames, * so all objects should be derived from this class. */ class OF_EXPORT ReferenceFrame : public osg::Referenced { public: typedef std::vector<ReferenceFrame*> ParentList; /**< Defines a vector of all direct parents of this frame */ typedef std::vector<osg::ref_ptr<ReferenceFrame> > ChildList; /**< Defines a vector of all direct children of this frame */ typedef std::vector<FrameTracker*> TrackerList; /**< Defines a vector of all trackers of this frame */ /* * \brief Construct a new ReferenceFrame. * * The color of this frame will be white and 90% opaque. * * \param name Name of the frame. */ ReferenceFrame(const std::string &name); /* * \brief Construct a new ReferenceFrame. * * The color of this frame is specified by the constructor arguments and is 90% opaque. * * \param name Name of the frame. * \param color Vector of the colors [red, green, blue]. */ ReferenceFrame(const std::string &name, const osg::Vec3 &color); /* * \brief Construct a new ReferenceFrame. * * The color of this frame is specified by the constructor arguments. * * \param name Name of the frame. * \param color Vector of the colors [red, green, blue, alpha]. */ ReferenceFrame(const std::string &name, const osg::Vec4 &color); /* * \brief Construct a new ReferenceFrame. * * The color of this frame is specified by the constructor arguments. * * \param name Name of the frame. * \param r Red color component [0-1]. * \param g Green color component [0-1]. * \param b Blue color component [0-1]. * \param a Alpha (transparancy) component [0-1]. */ ReferenceFrame( const std::string &name , float r, float g, float b, float a = 1.0 ); /* * \brief Set the name of the frame that will be displayed. * * \param name Name of the frame. */ void setName( const std::string &name ); /* * \brief Get the name of the frame. * * \return Name of the frame. */ inline const std::string& getName() const { return _name; } /* * \brief Set the color of the frame's decorations (axes, name, ...). * * This method can be overridden by derived classes. * * \param color Vector of color components [0-1] [red, green, blue, alpha]. */ virtual void setColor( const osg::Vec4 &color ); /* * \brief Set the color of the frame's decorations (axes, name, ...). * * This method can be overridden by derived classes. * * \param r Red color component [0-1]. * \param g Green color component [0-1]. * \param b Blue color component [0-1]. * \param a Alpha (transparency) component [0-1]. */ virtual void setColor( float r, float g, float b, float a = 1.0 ); /* * \brief Get the color of the frame's decorations (axes, name, ...). * * This method can be overridden by derived classes. * * \return Vector of the colors [red, green, blue, alpha]. */ virtual const osg::Vec4& getColor() const; /* * \brief Get the color of the frame's decorations (axes, name, ...). * * This method can be overridden by derived classes. * * \param r Returned red color component [0-1]. * \param g Returned green color component [0-1]. * \param b Returned blue color component [0-1]. * \param a Returned alpha (transparancy) component [0-1]. */ virtual void getColor( float &r, float &g, float &b, float &a ) const; /* * \brief Get the transform corresponding to this ReferenceFrame. * * \return The transform. */ inline FrameTransform* getTransform() const {return _xform.get();} /* * \brief Get the group corresponding to this ReferenceFrame. * * By default, the frame's group is the same as its transform. * However, subclasses can define a separate group if they wish to. * A child frame's group is what is added to a parent frame's * transform in addChild(). * * \return The FrameTransform. */ virtual osg::Group* getGroup() const; /* * \brief Set the position of this frame. * * This only applies if the frame is not being auto positioned by a TrajectoryFollower. * * \param x X position. * \param y Y position. * \param z Z position. */ inline void setPosition( const double &x, const double &y, const double &z ) { _xform->setPosition(x, y, z); } inline void setPosition( const osg::Vec3d &pos ) { _xform->setPosition(pos); } /* * \brief Get the position of this frame. * * \param x Returned X position. * \param y Returned Y position. * \param z Returned Z position. */ inline void getPosition( double &x, double &y, double &z ) const { _xform->getPosition(x, y, z); } inline void getPosition( osg::Vec3d &pos ) const { _xform->getPosition(pos); } inline const osg::Vec3d& getPosition() const { return _xform->getPosition(); } /* * \brief Set the orientation of this frame. * * This only applies if the frame is not being auto positioned by a TrajectoryFollower. * * \param rx X component of the rotation quaternion. * \param ry Y component of the rotation quaternion. * \param rz Z component of the rotation quaternion. * \param angle Angle component of the rotation quaternion. */ inline void setAttitude( const double &rx, const double &ry, const double &rz, const double &angle ) { _xform->setAttitude(rx, ry, rz, angle); } inline void setAttitude( const osg::Quat &att ) { _xform->setAttitude(att); } /* * \brief Get the orientation of this frame. * * \param rx Returned X component of the rotation quaternion. * \param ry Returned Y component of the rotation quaternion. * \param rz Returned Z component of the rotation quaternion. * \param angle Returned angle component of the rotation quaternion. */ inline void getAttitude( double &rx, double &ry, double &rz, double &angle) const { _xform->getAttitude(rx, ry, rz, angle); } inline void getAttitude( osg::Quat &att ) const { _xform->getAttitude(att); } /* * \brief Get the BoundingSphere encompassing this frame plus all of its decorations. * * Derived classes should override this method and compute their own local BoundingSphere. * * \return The BoundingSphere */ virtual const osg::BoundingSphere& getBound() const; enum AxesType /** Specifies which axes to draw */ { NO_AXES = 0, X_AXIS = 1, Y_AXIS = 2, Z_AXIS = 4 }; // Show/hide the x, y, z axes vectors and labels; see AxesType /* * \brief Show/hide the x, y, z axes vectors. * * \param axes AxesType indicating which axes are to be shown. */ virtual void showAxes(unsigned int axes); /* * \brief Select which axis labels are to be displayed. * * \param labels AxesType indicating which axes labels are to be shown. */ virtual void showAxesLabels(unsigned int labels); /* * \brief Show/hide axis name labels. * * \param show True if labels are to be shown. */ virtual void showNameLabel(bool namelabel); // Show/hide this frame's contents, e.g. everything a frame shows (excluding axes, labels, and children). // Derived classes should override this. virtual void showContents(bool showContents) {} virtual bool getContentsShown() const { return true; } /* * \brief Place x axis vectors at the given location with given length. * * \param base Position of the base of the axis vector. * \param len Length of the drawn axis vector. * \param headRatio Ratio of the size of the axis vector head compared to the base. * \param bodyRadius Radius of the body of the drawn axis. * \param headRadius Radius of the head of the drawn axis. */ void moveXAxis(osg::Vec3d base, double len, double headRatio = 0.3, double bodyRadius = 0.0, double headRadius = 0.0) const; /* * Place y axis vectors at the given location with given length. * * \param base Position of the base of the axis vector. * \param len Length of the drawn axis vector. * \param headRatio Ratio of the size of the axis vector head compared to the base. * \param bodyRadius Radius of the body of the drawn axis. * \param headRadius Radius of the head of the drawn axis. */ void moveYAxis(osg::Vec3d base, double len, double headRatio = 0.3, double bodyRadius = 0.0, double headRadius = 0.0) const; /* * Place z axis vectors at the given location with given length. * * \param base Position of the base of the axis vector. * \param len Length of the drawn axis vector. * \param headRatio Ratio of the size of the axis vector head compared to the base. * \param bodyRadius Radius of the body of the drawn axis. * \param headRadius Radius of the head of the drawn axis. */ void moveZAxis(osg::Vec3d base, double len, double headRatio = 0.3, double bodyRadius = 0.0, double headRadius = 0.0) const; /* * Set the text displayed for the x-axis label. * * The default axis label is 'X'. * * \param str String to set as the axis label. */ inline void setXLabel(const std::string &str) { _xLabel->setText(str); } /* * Set the text displayed for the y-axis label. * * The default axis label is 'Y'. * * \param str String to set as the axis label. */ inline void setYLabel(const std::string &str) { _yLabel->setText(str); } /* * Set the text displayed for the z-axis label. * * The default axis label is 'Z'. * * \param str String to set as the axis label. */ inline void setZLabel(const std::string &str) { _zLabel->setText(str); } /** * Set the font used for labels * * The default font is arial.ttf * * \param font Font name string (or full pathname of font), including extension. */ void setLabelFont(const std::string &font); /** * Get the font name used for labels * * This returns only the font name, including extension * * \return Font name string, including extension. e.g. 'arial.ttf' */ std::string getLabelFontName() const; /** * Get the path to the font used for labels * * This returns the full font path, including extension * * \param Font file path, including extension. e.g. '/usr/share/fonts/arial.ttf' */ std::string getLabelFontPath() const; /** * Set the size for labels * * The default size is 30 * The name label has a fixed size, but the X/Y/Z axis labels vary their * size based on distance. This function sets their maximum size. * * \param height Integer maximum character size */ void setLabelSize(unsigned int size); /** * Get the size for labels * * The name label has a fixed size, but the X/Y/Z axis labels vary their * size based on distance. This function gets their maximum size. * * \return Integer character size (maximum size for axes labels) */ unsigned int getLabelSize() const { return _nameLabel->getCharacterHeight(); } /* * \brief Add a ReferenceFrame as a child to this one. * * This effectively adds the osg structure of that frame as a child to this frame's transform. * * \param child Child to add. * * \return True if successful, false otherwise. */ bool addChild(ReferenceFrame* frame); /* * \brief Remove a ReferenceFrame from the children of this one. * * This effectively removes the osg structure of that frame from this frame's transform. * * \param child Child to remove. * * \return True if successful, false otherwise. */ bool removeChild( ReferenceFrame* frame ); /* * \brief Set whether this frame's light source is enabled. * A light source will be created as needed. * A ReferenceFrame's light source is disabled by default. * * \param enable Whether to enable/disable light source. */ void setLightSourceEnabled(bool enable); /* * \brief Check whether this frame's light source is enabled. */ bool getLightSourceEnabled() const; /* * \brief Get this frame's light source. * * \return The osg::LightSource, or NULL if it doesn't exist. */ osg::LightSource* getLightSource() const; void setShadowedSceneRoot(bool isRoot); osgShadow::ShadowedScene* getShadowedSceneRoot() const; /* * \brief Get the number of children. * * \return The number of children. */ inline int getNumChildren() { return _children.size(); } /* * \brief Get a child by its index. * * \param i Index of the child to get. * * \return The child at the index. */ inline ReferenceFrame* getChild( int i ) { return _children[i].get(); } /* * \brief Create a formatted string containing names of all child frames. * * \param str Formatted string. * \param prefix Prefix to display in front of child objects. */ void createFrameString( std::string& str, std::string prefix = " " ) const; /* * \brief Information about this ReferenceFrame that is included in its * formatted name during a createFrameString() call. * * \return Frame info. */ virtual std::string frameInfo() const; /* * \brief Add a parent for this frame. * * This is called automatically by addChild, so should not be called manually. * * \param frame Parent to add. */ void addParent( ReferenceFrame* frame ); /* * \brief Remove a parent for this frame, if it exists. * * \param frame Parent to remove. */ void removeParent( ReferenceFrame* frame ); /* * \brief Get the number of parents * * \return The number of parents. */ inline int getNumParents() const { return _parents.size(); } /* * \brief Get a parent by its index * * \param i Index of the parent to get * * \return The parent at the index. */ inline ReferenceFrame* getParent( int i ) { return _parents[i]; } /* * \brief Add a tracker for this frame. * * \param t Tracker to add. */ void addTracker( FrameTracker* t ); /* * \brief Remove a tracker for this frame, if it exists. * * \param t Tracker to remove. */ void removeTracker( FrameTracker* t ); /* * \brief Get the number of trackers. * * \return The number of trackers. */ inline int getNumTrackers() const { return _trackers.size(); } /* * \brief Get a tracker by its index. * * \param i Index of the tracker to get. * * \return The tracker at the index. */ inline FrameTracker* getTracker( int i ) { return _trackers[i]; } /* * \brief Find the index of the requested child. * * \param frame Child to find the index * * \return Index of the requested child. * If the requested child does not exist, return -1. */ int getChildIndex( const ReferenceFrame* frame ) const; /* * \brief Find the index of the requested parent * * \param frame Parent to find the index * * \return Index of the requested parent. * If the requested parent does not exist, return -1. */ int getParentIndex( const ReferenceFrame* frame ) const; /* * \brief Find the index of the requested tracker. * * \param frame Tracker to find the index. * * \return Index of the requested tracker. * If the requested tracker does not exist, return -1. */ int getTrackerIndex( const FrameTracker* t ) const; protected: virtual ~ReferenceFrame(); // Must be allocated on heap using 'new' std::string _name; ///< Name of reference frame mutable osg::ref_ptr<Vector> _xAxis; ///< Vector of frame's x-axis mutable osg::ref_ptr<Vector> _yAxis; ///< Vector of frame's y-axis mutable osg::ref_ptr<Vector> _zAxis; ///< Vector of frame's z-axis mutable osg::ref_ptr<osgText::Text> _xLabel; ///< X-Axes label mutable osg::ref_ptr<osgText::Text> _yLabel; ///< Y-Axes label mutable osg::ref_ptr<osgText::Text> _zLabel; ///< Z-Axes label mutable osg::ref_ptr<osgText::Text> _nameLabel; ///< Name of reference frame that is displayed osg::ref_ptr<osg::Geode> _axes; ///< x,y,z axes together osg::ref_ptr<osg::Geode> _labels; ///< axes and name labels mutable osg::BoundingSphere _bound; ///< Frame's bounding sphere osg::ref_ptr<FrameTransform> _xform; ///< The transform that all contained objects will undergo osg::ref_ptr<osgShadow::ShadowedScene> _shadowedSceneRoot; private: void _init( const std::string &name, const osg::Vec4& c ); void _resetTextGlyphs(); ParentList _parents; ///< All direct parents of this frame ChildList _children; ///< All direct children of this frame TrackerList _trackers; ///< All trackers of this frame }; } // !namespace OpenFrames #endif // !define _OF_REFERENCEFRAME_
31.864094
128
0.635038
[ "vector", "transform" ]
955ae105d6f107c848f8b9ce16c3831f1ab00a44
288
hpp
C++
src/chat/chat.hpp
senior-sigan/chat_from_scratch
a550da2da008c754c4bf4ee89dd1a9394e99261f
[ "MIT" ]
null
null
null
src/chat/chat.hpp
senior-sigan/chat_from_scratch
a550da2da008c754c4bf4ee89dd1a9394e99261f
[ "MIT" ]
null
null
null
src/chat/chat.hpp
senior-sigan/chat_from_scratch
a550da2da008c754c4bf4ee89dd1a9394e99261f
[ "MIT" ]
null
null
null
#pragma once #include <vector> #include <string> #include <sstream> class Chat { std::vector<std::string> users_; public: std::string selectedUser = ""; std::stringstream textInput; void AddUser(const std::string& user); const std::vector<std::string>& GetUsers() const; };
18
51
0.690972
[ "vector" ]
9563c794989a5b11d6c748434faeb379a1fc9647
71,043
cpp
C++
common/automation.cpp
grodansparadis/vscpl2drv-automation
ae5ecf45e6c25284321c1b119abaf9246e516a1c
[ "MIT" ]
1
2019-11-19T14:54:31.000Z
2019-11-19T14:54:31.000Z
common/automation.cpp
grodansparadis/vscpl2drv-automation
ae5ecf45e6c25284321c1b119abaf9246e516a1c
[ "MIT" ]
null
null
null
common/automation.cpp
grodansparadis/vscpl2drv-automation
ae5ecf45e6c25284321c1b119abaf9246e516a1c
[ "MIT" ]
null
null
null
// automation.cpp // // This file is part of the VSCP (http://www.vscp.org) // // The MIT License (MIT) // // Copyright (C) 2000-2021 Ake Hedman, Grodans Paradis AB // <info@grodansparadis.com> // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice cat /sys/class/net/eth0/addressand this permission // notice shall be included in all copies or substantial portions of the // Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. // #ifdef __GNUG__ //#pragma implementation #endif #define _POSIX #include <list> #include <string> #include <limits.h> #include <math.h> #include <net/if.h> #include <pthread.h> #include <semaphore.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/ioctl.h> #include <sys/socket.h> #include <sys/types.h> #include <syslog.h> #include <unistd.h> #include <ctype.h> #include <errno.h> #include <libgen.h> #include <net/if.h> #include <signal.h> #include <sys/ioctl.h> #include <sys/socket.h> #include <sys/time.h> #include <sys/types.h> #include <sys/uio.h> #include <time.h> #include <expat.h> #include <hlo.h> #include <remotevariablecodes.h> #include <vscp.h> #include <vscp_class.h> #include <vscp_type.h> #include <vscphelper.h> #include <vscpremotetcpif.h> #include <json.hpp> // Needs C++11 -std=c++11 #include <mustache.hpp> #include "automation.h" #include <iostream> #include <fstream> #include <list> #include <map> #include <string> // https://github.com/nlohmann/json using json = nlohmann::json; using namespace kainjow::mustache; // Buffer for XML parser //#define XML_BUFF_SIZE 30000 // Forward declaration void* workerThread(void* pData); /////////////////////////////////////////////////// // GLOBALS /////////////////////////////////////////////////// // Seconds for 24h #define SPAN24 (24 * 3600) //----------------------------------------------------------------------------- // Helpers for sunrise/sunset calculations //----------------------------------------------------------------------------- // C program calculating the sunrise and sunset for // the current date and a fixed location(latitude,longitude) // Note, twilight calculation gives insufficient accuracy of results // Jarmo Lammi 1999 - 2001 // Last update July 21st, 2001 static double pi = 3.14159; static double degs; static double rads; static double L, g, daylen; static double SunDia = 0.53; // Sun radius degrees static double AirRefr = 34.0 / 60.0; // atmospheric refraction degrees // //----------------------------------------------------------------------------- // End of sunset/sunrise functions //----------------------------------------------------------------------------- /////////////////////////////////////////////////////////////////////////////// // Constructor // CAutomation::CAutomation(void) { m_bDebug = false; m_bQuit = false; m_bEnableAutomation = true; m_zone = 0; m_subzone = 0; // Not possible to save configuration by default m_bWrite = false; // Take me the freedom to use my own place as reference m_longitude = 15.1604167; // Home sweet home m_latitude = 61.7441833; m_bSunRiseEvent = true; m_bSunRiseTwilightEvent = true; m_bSunSetEvent = true; m_bSunSetTwilightEvent = true; m_bCalculatedNoonEvent = true; m_declination = 0.0f; m_daylength = 0.0f; m_SunMaxAltitude = 0.0f; m_bCalulationHasBeenDone = false; // No calculations has been done yet // Set to some early date to indicate that they have not been sent m_civilTwilightSunriseTime_sent = vscpdatetime::dateTimeZero(); m_SunriseTime_sent = vscpdatetime::dateTimeZero(); m_SunsetTime_sent = vscpdatetime::dateTimeZero(); m_civilTwilightSunsetTime_sent = vscpdatetime::dateTimeZero(); m_noonTime_sent = vscpdatetime::dateTimeZero(); m_lastCalculation = vscpdatetime::Now(); vscp_clearVSCPFilter(&m_vscpfilter); // Accept all events sem_init(&m_semSendQueue, 0, 0); sem_init(&m_semReceiveQueue, 0, 0); pthread_mutex_init(&m_mutexSendQueue, NULL); pthread_mutex_init(&m_mutexReceiveQueue, NULL); // Do initial calculations doCalc(); } /////////////////////////////////////////////////////////////////////////////// // Destructor // CAutomation::~CAutomation(void) { close(); sem_destroy(&m_semSendQueue); sem_destroy(&m_semReceiveQueue); pthread_mutex_destroy(&m_mutexSendQueue); pthread_mutex_destroy(&m_mutexReceiveQueue); } // ---------------------------------------------------------------------------- /* XML Setup ========= <?xml version = "1.0" encoding = "UTF-8" ?> <!-- Version 0.0.1 2019-11-05 --> <config debug="true|false" write="true|false" guid="FF:FF:FF:FF:FF:FF:FF:FC:88:99:AA:BB:CC:DD:EE:FF" zone="1" subzone="2" longitude="15.1604167" latitude="61.7441833" enable-sunrise="true|false" enable-sunrise-twilight="true|false" enable-sunset="true|false" enable-sunset-twilight="true|false" enable-noon="true|false" filter="incoming-filter" mask="incoming-mask" /> */ // ---------------------------------------------------------------------------- // int depth_setup_parser = 0; // void // startSetupParser(void* data, const char* name, const char** attr) // { // CAutomation* pObj = (CAutomation*)data; // if (NULL == pObj) // return; // if ((0 == strcmp(name, "config")) && (0 == depth_setup_parser)) { // for (int i = 0; attr[i]; i += 2) { // std::string attribute = attr[i + 1]; // vscp_trim(attribute); // if (0 == strcasecmp(attr[i], "zone")) { // if (!attribute.empty()) { // pObj->m_zone = vscp_readStringValue(attribute); // } // } else if (0 == strcasecmp(attr[i], "subzone")) { // if (!attribute.empty()) { // pObj->m_subzone = vscp_readStringValue(attribute); // } // } else if (0 == strcasecmp(attr[i], "longitude")) { // if (!attribute.empty()) { // pObj->setLongitude(atof(attribute.c_str())); // } // } else if (0 == strcasecmp(attr[i], "latitude")) { // if (!attribute.empty()) { // pObj->setLatitude(atof(attribute.c_str())); // } // } else if (0 == strcasecmp(attr[i], "enable-sunrise")) { // if (!attribute.empty()) { // vscp_makeUpper(attribute); // if (std::string::npos != attribute.find("TRUE")) { // pObj->enableSunRiseEvent(); // } else { // pObj->disableSunRiseEvent(); // } // } // } else if (0 == strcasecmp(attr[i], "enable-sunrise-twilight")) { // if (!attribute.empty()) { // vscp_makeUpper(attribute); // if (std::string::npos != attribute.find("TRUE")) { // pObj->enableSunSetEvent(); // } else { // pObj->disableSunSetEvent(); // } // } // } else if (0 == strcasecmp(attr[i], "enable-sunset")) { // if (!attribute.empty()) { // vscp_makeUpper(attribute); // if (std::string::npos != attribute.find("TRUE")) { // pObj->enableSunRiseTwilightEvent(); // } else { // pObj->disableSunRiseTwilightEvent(); // } // } // } else if (0 == strcasecmp(attr[i], "enable-sunset-twilight")) { // if (!attribute.empty()) { // vscp_makeUpper(attribute); // if (std::string::npos != attribute.find("TRUE")) { // pObj->enableSunSetTwilightEvent(); // } else { // pObj->disableSunSetTwilightEvent(); // } // } // } else if (0 == strcasecmp(attr[i], "enable-noon")) { // if (!attribute.empty()) { // vscp_makeUpper(attribute); // if (std::string::npos != attribute.find("TRUE")) { // pObj->enableCalculatedNoonEvent(); // } else { // pObj->disableCalculatedNoonEvent(); // } // } // } else if (0 == strcasecmp(attr[i], "debug")) { // if (!attribute.empty()) { // vscp_makeUpper(attribute); // if (std::string::npos != attribute.find("TRUE")) { // pObj->m_bDebug = true; // } else { // pObj->m_bDebug = false; // } // } // } else if (0 == strcasecmp(attr[i], "write")) { // if (!attribute.empty()) { // vscp_makeUpper(attribute); // if (std::string::npos != attribute.find("TRUE")) { // pObj->enableWrite(); // } else { // pObj->disableWrite(); // } // } // } else if (0 == strcasecmp(attr[i], "filter")) { // if (!attribute.empty()) { // if (!vscp_readFilterFromString(&pObj->m_vscpfilter, // attribute)) { // syslog(LOG_ERR, // "[vscpl2drv-automation] Unable to read event " // "receive filter."); // } // } // } else if (0 == strcasecmp(attr[i], "mask")) { // if (!attribute.empty()) { // if (!vscp_readMaskFromString(&pObj->m_vscpfilter, // attribute)) { // syslog(LOG_ERR, // "[vscpl2drv-automation] Unable to read event " // "receive mask."); // } // } // } // } // } // depth_setup_parser++; // } // void // endSetupParser(void* data, const char* name) // { // depth_setup_parser--; // } // ---------------------------------------------------------------------------- ////////////////////////////////////////////////////////////////////// // open // bool CAutomation::open(const std::string& path, cguid& guid) { // Set GUID m_guid = guid; // Set path to config file m_path = path; // Read configuration file if (!doLoadConfig()) { syslog(LOG_ERR, "[vscpl2drv-automation] Failed to load configuration file [%s]", path.c_str()); } // start the workerthread if (pthread_create(&m_threadWork, NULL, workerThread, this)) { syslog(LOG_ERR, "[vscpl2drv-automation] Unable to start worker thread."); return false; } if (m_bDebug) { syslog(LOG_DEBUG, "[vscpl2drv-automation] Driver is open."); } return true; } ////////////////////////////////////////////////////////////////////// // close // void CAutomation::close(void) { if (m_bDebug) { syslog(LOG_DEBUG, "[vscpl2drv-automation] Driver requested to closed."); } // Do nothing if already terminated if (m_bQuit) { syslog(LOG_INFO, "[vscpl2drv-automation] Request to close while already closed."); return; } m_bQuit = true; // terminate the thread void* res; int rv = pthread_join(m_threadWork, &res); if (0 != rv) { syslog( LOG_ERR, "[vscpl2drv-automation] pthread_join failed error=%d", rv); } if (NULL != res) { syslog(LOG_ERR, "[vscpl2drv-automation] Worker thread did not returned NULL"); } if (m_bDebug) { syslog(LOG_DEBUG, "[vscpl2drv-automation] Driver closed."); } } /////////////////////////////////////////////////////////////////////////////// // isDaylightSavingTime // int CAutomation::isDaylightSavingTime(void) { time_t rawtime; struct tm* timeinfo; time(&rawtime); timeinfo = localtime(&rawtime); return timeinfo->tm_isdst; } /////////////////////////////////////////////////////////////////////////////// // getTimeZoneDiffHours // int CAutomation::getTimeZoneDiffHours(void) { time_t rawtime; struct tm* timeinfo; struct tm* timeinfo_gmt; int h1, h2; time(&rawtime); timeinfo = localtime(&rawtime); h2 = timeinfo->tm_hour; if (0 == h2) h2 = 24; timeinfo_gmt = gmtime(&rawtime); h1 = timeinfo_gmt->tm_hour; return (h2 - h1); } /////////////////////////////////////////////////////////////////////////////// // FNday // // Get the days to J2000 // h is UT in decimal hours // FNday only works between 1901 to 2099 - see Meeus chapter 7 // double CAutomation::FNday(int y, int m, int d, float h) { long int luku = -7 * (y + (m + 9) / 12) / 4 + 275 * m / 9 + d; // type casting necessary on PC DOS and TClite to avoid overflow luku += (long int)y * 367; return (double)luku - 730531.5 + h / 24.0; }; /////////////////////////////////////////////////////////////////////////////// // FNrange // // the function below returns an angle in the range // 0 to 2*pi // double CAutomation::FNrange(double x) { double b = 0.5 * x / pi; double a = 2.0 * pi * (b - (long)(b)); if (a < 0) a = 2.0 * pi + a; return a; }; /////////////////////////////////////////////////////////////////////////////// // f0 // // Calculating the hourangle // double CAutomation::f0(double lat, double declin) { double fo, dfo; // Correction: different sign at S HS dfo = rads * (0.5 * SunDia + AirRefr); if (lat < 0.0) dfo = -dfo; fo = tan(declin + dfo) * tan(lat * rads); if (fo > 0.99999) fo = 1.0; // to avoid overflow // fo = asin(fo) + pi / 2.0; return fo; }; /////////////////////////////////////////////////////////////////////////////// // f1 // // Calculating the hourangle for twilight times // double CAutomation::f1(double lat, double declin) { double fi, df1; // Correction: different sign at S HS df1 = rads * 6.0; if (lat < 0.0) df1 = -df1; fi = tan(declin + df1) * tan(lat * rads); if (fi > 0.99999) fi = 1.0; // to avoid overflow // fi = asin(fi) + pi / 2.0; return fi; }; /////////////////////////////////////////////////////////////////////////////// // FNsun // // Find the ecliptic longitude of the Sun double CAutomation::FNsun(double d) { // mean longitude of the Sun L = FNrange(280.461 * rads + .9856474 * rads * d); // mean anomaly of the Sun g = FNrange(357.528 * rads + .9856003 * rads * d); // Ecliptic longitude of the Sun return FNrange(L + 1.915 * rads * sin(g) + .02 * rads * sin(2 * g)); }; /////////////////////////////////////////////////////////////////////////////// // convert2HourMinute // // Display decimal hours in hours and minutes // void CAutomation::convert2HourMinute(double floatTime, int* pHours, int* pMinutes) { *pHours = ((int)floatTime) % 24; *pMinutes = ((int)((floatTime - (double)*pHours) * 60)) % 60; }; /////////////////////////////////////////////////////////////////////////////// // calcSun // void CAutomation::doCalc(void) { double year, month, day, hour; double d, lambda; double obliq, alpha, delta, LL, equation, ha, hb, twx; double twilightSunrise, maxAltitude, noonTime, sunsetTime, sunriseTime, twilightSunset; double tzone = 0; degs = 180.0 / pi; rads = pi / 180.0; // get the date and time from the user // read system date and extract the year // First get time vscpdatetime nowLocal = vscpdatetime::Now(); year = nowLocal.getYear(); month = nowLocal.getMonth() + 1; day = nowLocal.getDay(); hour = nowLocal.getHour(); // Set offset from UTC - daytimesaving is taken care of // vscpdatetime::TimeZone ttt( vscpdatetime::Local ); // tzone = ttt.GetOffset()/3600; tzone = vscpdatetime::tzOffset2LocalTime(); // TODO CHECK!!!!!! // Adjust for daylight saving time /*if ( isDaylightSavingTime() ) { tzone = getTimeZoneDiffHours(); }*/ d = FNday(year, month, day, hour); // Use FNsun to find the ecliptic longitude of the Sun lambda = FNsun(d); // Obliquity of the ecliptic obliq = 23.439 * rads - 0.0000004 * rads * d; // Find the RA and DEC of the Sun alpha = atan2(cos(obliq) * sin(lambda), cos(lambda)); delta = asin(sin(obliq) * sin(lambda)); // Find the Equation of Time // in minutes // Correction suggested by David Smith LL = L - alpha; if (L < pi) LL += 2.0 * pi; equation = 1440.0 * (1.0 - LL / pi / 2.0); ha = f0(m_latitude, delta); hb = f1(m_latitude, delta); twx = hb - ha; // length of twilight in radians twx = 12.0 * twx / pi; // length of twilight in hours // Conversion of angle to hours and minutes daylen = degs * ha / 7.5; if (daylen < 0.0001) { daylen = 0.0; } // arctic winter sunriseTime = 12.0 - 12.0 * ha / pi + tzone - m_longitude / 15.0 + equation / 60.0; sunsetTime = 12.0 + 12.0 * ha / pi + tzone - m_longitude / 15.0 + equation / 60.0; noonTime = sunriseTime + 12.0 * ha / pi; maxAltitude = 90.0 + delta * degs - m_latitude; // Correction for S HS suggested by David Smith // to express altitude as degrees from the N horizon if (m_latitude < delta * degs) maxAltitude = 180.0 - maxAltitude; twilightSunrise = sunriseTime - twx; // morning twilight begin twilightSunset = sunsetTime + twx; // evening twilight end if (sunriseTime > 24.0) sunriseTime -= 24.0; if (sunsetTime > 24.0) sunsetTime -= 24.0; if (twilightSunrise > 24.0) twilightSunrise -= 24.0; // 160921 if (twilightSunset > 24.0) twilightSunset -= 24.0; m_declination = delta * degs; m_daylength = daylen; m_SunMaxAltitude = maxAltitude; // Set last calculated time m_lastCalculation = vscpdatetime::Now(); int intHour, intMinute; // Civil Twilight Sunrise convert2HourMinute(twilightSunrise, &intHour, &intMinute); m_civilTwilightSunriseTime = vscpdatetime::Now(); m_civilTwilightSunriseTime.zeroTime(); // Set to midnight m_civilTwilightSunriseTime.setHour(intHour); m_civilTwilightSunriseTime.setMinute(intMinute); // Sunrise convert2HourMinute(sunriseTime, &intHour, &intMinute); m_SunriseTime = vscpdatetime::Now(); m_SunriseTime.zeroTime(); // Set to midnight m_SunriseTime.setHour(intHour); m_SunriseTime.setMinute(intMinute); // Sunset convert2HourMinute(sunsetTime, &intHour, &intMinute); m_SunsetTime = vscpdatetime::Now(); m_SunsetTime.zeroTime(); // Set to midnight m_SunsetTime.setHour(intHour); m_SunsetTime.setMinute(intMinute); // Civil Twilight Sunset convert2HourMinute(twilightSunset, &intHour, &intMinute); m_civilTwilightSunsetTime = vscpdatetime::Now(); m_civilTwilightSunsetTime.zeroTime(); // Set to midnight m_civilTwilightSunsetTime.setHour(intHour); m_civilTwilightSunsetTime.setMinute(intMinute); // NoonTime convert2HourMinute(noonTime, &intHour, &intMinute); m_noonTime = vscpdatetime::Now(); m_noonTime.zeroTime(); // Set to midnight m_noonTime.setHour(intHour); m_noonTime.setMinute(intMinute); } // ---------------------------------------------------------------------------- int depth_hlo_parser = 0; void startHLOParser(void* data, const char* name, const char** attr) { // CHLO* pObj = (CHLO*)data; // if (NULL == pObj) // return; // if ((0 == strcmp(name, "vscp-cmd")) && (0 == depth_setup_parser)) { // for (int i = 0; attr[i]; i += 2) { // std::string attribute = attr[i + 1]; // vscp_trim(attribute); // if (0 == strcasecmp(attr[i], "op")) { // if (!attribute.empty()) { // pObj->m_op = vscp_readStringValue(attribute); // vscp_makeUpper(attribute); // if (attribute == "VSCP-NOOP") { // pObj->m_op = HLO_OP_NOOP; // } else if (attribute == "VSCP-READVAR") { // pObj->m_op = HLO_OP_READ_VAR; // } else if (attribute == "VSCP-WRITEVAR") { // pObj->m_op = HLO_OP_WRITE_VAR; // } else if (attribute == "VSCP-LOAD") { // pObj->m_op = HLO_OP_LOAD; // } else if (attribute == "VSCP-SAVE") { // pObj->m_op = HLO_OP_SAVE; // } else if (attribute == "CALCULATE") { // pObj->m_op = HLO_OP_SAVE; // } else { // pObj->m_op = HLO_OP_UNKNOWN; // } // } // } else if (0 == strcasecmp(attr[i], "name")) { // if (!attribute.empty()) { // vscp_makeUpper(attribute); // pObj->m_name = attribute; // } // } else if (0 == strcasecmp(attr[i], "type")) { // if (!attribute.empty()) { // pObj->m_varType = vscp_readStringValue(attribute); // } // } else if (0 == strcasecmp(attr[i], "value")) { // if (!attribute.empty()) { // if (vscp_base64_std_decode(attribute)) { // pObj->m_value = attribute; // } // } // } else if (0 == strcasecmp(attr[i], "full")) { // if (!attribute.empty()) { // vscp_makeUpper(attribute); // if ("TRUE" == attribute) { // pObj->m_bFull = true; // } else { // pObj->m_bFull = false; // } // } // } // } // } // depth_hlo_parser++; } void endHLOParser(void* data, const char* name) { depth_hlo_parser--; } // ---------------------------------------------------------------------------- /////////////////////////////////////////////////////////////////////////////// // loadConfiguration // bool CAutomation::doLoadConfig(void) { /*FILE* fp; fp = fopen(m_path.c_str(), "r"); if (NULL == fp) { syslog(LOG_ERR, "[vscpl2drv-automation] Failed to open configuration file [%s]", m_path.c_str()); return false; } XML_Parser xmlParser = XML_ParserCreate("UTF-8"); XML_SetUserData(xmlParser, this); XML_SetElementHandler(xmlParser, startSetupParser, endSetupParser); void* buf = XML_GetBuffer(xmlParser, XML_BUFF_SIZE); size_t file_size = 0; file_size = fread(buf, sizeof(char), XML_BUFF_SIZE, fp); fclose(fp); if (XML_STATUS_OK != XML_ParseBuffer(xmlParser, file_size, file_size == 0)) { syslog(LOG_ERR, "[vscpl2drv-automation] Failed parse XML setup."); XML_ParserFree(xmlParser); return false; } XML_ParserFree(xmlParser); */ try { std::ifstream in(m_path, std::ifstream::in); in >> m_j_config; } catch (json::parse_error) { syslog(LOG_ERR, "[vscpl2drv-automation] Failed to parse JSON configuration."); return false; } try { if (m_j_config.contains("debug-enable") && m_j_config["debug-enable"].is_boolean()) { m_bDebug = m_j_config["debug-enable"].get<bool>(); } else { syslog(LOG_ERR, "ReadConfig: Failed to read 'enable-debug'. Default will be used."); } if (m_bDebug) { syslog(LOG_DEBUG, "ReadConfig: 'debug-enable' set to %s", m_bDebug ? "true" : "false"); } } catch (...) { syslog(LOG_ERR, "ReadConfig: Failed to read 'debug-enable'. Default will be used."); } try { if (m_j_config.contains("write-enable") && m_j_config["write-enable"].is_boolean()) { m_bDebug = m_j_config["write-enable"].get<bool>(); } else { syslog(LOG_ERR, "ReadConfig: Failed to read 'write-debug'. Default will be used."); } if (m_bDebug) { syslog(LOG_DEBUG, "ReadConfig: 'write-enable' set to %s", m_bWrite ? "true" : "false"); } } catch (...) { syslog(LOG_ERR, "ReadConfig: Failed to read 'write-enable'. Default will be used."); } try { if (m_j_config.contains("zone") && m_j_config["zone"].is_number()) { m_bDebug = m_j_config["zone"].get<bool>(); } else { syslog(LOG_ERR, "ReadConfig: Failed to read 'zone'. Default will be used."); } if (m_bDebug) { syslog(LOG_DEBUG, "ReadConfig: 'zone' set to %d", m_zone); } } catch (...) { syslog(LOG_ERR, "ReadConfig: Failed to read 'zone'. Default will be used."); } try { if (m_j_config.contains("subzone") && m_j_config["subzone"].is_number()) { m_bDebug = m_j_config["subzone"].get<bool>(); } else { syslog(LOG_ERR, "ReadConfig: Failed to read 'subzone'. Default will be used."); } if (m_bDebug) { syslog(LOG_DEBUG, "ReadConfig: 'subzone' set to %d", m_subzone); } } catch (...) { syslog(LOG_ERR, "ReadConfig: Failed to read 'subzone'. Default will be used."); } try { if (m_j_config.contains("longitude") && m_j_config["longitude"].is_number()) { m_longitude = m_j_config["longitude"].get<bool>(); } else { syslog(LOG_ERR, "ReadConfig: Failed to read 'longitude'. Default will be used."); } if (m_bDebug) { syslog(LOG_DEBUG, "ReadConfig: 'longitude' set to %f", m_longitude); } } catch (...) { syslog(LOG_ERR, "ReadConfig: Failed to read 'longitude'. Default will be used."); } try { if (m_j_config.contains("latitude") && m_j_config["latitude"].is_number()) { m_latitude = m_j_config["latitude"].get<bool>(); } else { syslog(LOG_ERR, "ReadConfig: Failed to read 'latitude'. Default will be used."); } if (m_bDebug) { syslog(LOG_DEBUG, "ReadConfig: 'latitude' set to %f", m_latitude); } } catch (...) { syslog(LOG_ERR, "ReadConfig: Failed to read 'latitude'. Default will be used."); } try { if (m_j_config.contains("sunrise-enable") && m_j_config["sunrise-enable"].is_boolean()) { m_bSunRiseEvent = m_j_config["sunrise-enable"].get<bool>(); } else { syslog(LOG_ERR, "ReadConfig: Failed to read 'sunrise-debug'. Default will be used."); } if (m_bDebug) { syslog(LOG_DEBUG, "ReadConfig: 'sunrise-enable' set to %s", m_bSunRiseEvent ? "true" : "false"); } } catch (...) { syslog(LOG_ERR, "ReadConfig: Failed to read 'sunrise-enable'. Default will be used."); } try { if (m_j_config.contains("sunrise-twilight-enable") && m_j_config["sunrise-twilight-enable"].is_boolean()) { m_bSunRiseTwilightEvent = m_j_config["sunrise-twilight-enable"].get<bool>(); } else { syslog(LOG_ERR, "ReadConfig: Failed to read 'sunrise-twilight-debug'. Default will be used."); } if (m_bDebug) { syslog(LOG_DEBUG, "ReadConfig: 'sunrise-twilight-enable' set to %s", m_bSunRiseTwilightEvent ? "true" : "false"); } } catch (...) { syslog(LOG_ERR, "ReadConfig: Failed to read 'sunrise-twilight-enable'. Default will be used."); } try { if (m_j_config.contains("sunset-enable") && m_j_config["sunset-enable"].is_boolean()) { m_bSunSetEvent = m_j_config["sunset-enable"].get<bool>(); } else { syslog(LOG_ERR, "ReadConfig: Failed to read 'sunset-debug'. Default will be used."); } if (m_bDebug) { syslog(LOG_DEBUG, "ReadConfig: 'sunset-enable' set to %s", m_bSunSetEvent ? "true" : "false"); } } catch (...) { syslog(LOG_ERR, "ReadConfig: Failed to read 'sunset-enable'. Default will be used."); } try { if (m_j_config.contains("sunset-twilight-enable") && m_j_config["sunset-twilight-enable"].is_boolean()) { m_bSunSetTwilightEvent = m_j_config["sunset-twilight-enable"].get<bool>(); } else { syslog(LOG_ERR, "ReadConfig: Failed to read 'sunset-twilight-debug'. Default will be used."); } if (m_bDebug) { syslog(LOG_DEBUG, "ReadConfig: 'sunset-twilight-enable' set to %s", m_bSunSetTwilightEvent ? "true" : "false"); } } catch (...) { syslog(LOG_ERR, "ReadConfig: Failed to read 'sunset-twilight-enable'. Default will be used."); } // if (!readEncryptionKey(m_j_config.value("vscp-key-file", ""))) { // syslog(LOG_ERR, "[vscpl2drv-automation] WARNING!!! Default key will be used."); // // Not secure of course but something... // m_vscpkey = "Carpe diem quam minimum credula postero"; // } return true; } /////////////////////////////////////////////////////////////////////////////// // saveConfiguration // bool CAutomation::doSaveConfig(void) { return true; } /////////////////////////////////////////////////////////////////////////////// // parseHLO // bool CAutomation::parseHLO(uint16_t size, uint8_t* inbuf, CHLO* phlo) { // // Check pointers // if (NULL == inbuf) { // syslog( // LOG_ERR, // "[vscpl2drv-automation] HLO parser: HLO in-buffer pointer is NULL."); // return false; // } // if (NULL == phlo) { // syslog(LOG_ERR, // "[vscpl2drv-automation] HLO parser: HLO obj pointer is NULL."); // return false; // } // if (!size) { // syslog(LOG_ERR, // "[vscpl2drv-automation] HLO parser: HLO buffer size is zero."); // return false; // } // XML_Parser xmlParser = XML_ParserCreate("UTF-8"); // XML_SetUserData(xmlParser, this); // XML_SetElementHandler(xmlParser, startHLOParser, endHLOParser); // void* buf = XML_GetBuffer(xmlParser, XML_BUFF_SIZE); // // Copy in the HLO object // memcpy(buf, inbuf, size); // if (!XML_ParseBuffer(xmlParser, size, size == 0)) { // syslog(LOG_ERR, "[vscpl2drv-automation] Failed parse XML setup."); // XML_ParserFree(xmlParser); // return false; // } // XML_ParserFree(xmlParser); return true; } /////////////////////////////////////////////////////////////////////////////// // handleHLO // bool CAutomation::handleHLO(vscpEvent* pEvent) { json j; // char buf[512]; // Working buffer // vscpEventEx ex; // // Check pointers // if (NULL == pEvent) { // syslog(LOG_ERR, // "[vscpl2drv-automation] HLO handler: NULL event pointer."); // return false; // } // CHLO hlo; // if (!parseHLO(pEvent->sizeData, pEvent->pdata, &hlo)) { // syslog(LOG_ERR, "[vscpl2drv-automation] Failed to parse HLO."); // return false; // } // ex.obid = 0; // ex.head = 0; // ex.timestamp = vscp_makeTimeStamp(); // vscp_setEventExToNow(&ex); // Set time to current time // ex.vscp_class = VSCP_CLASS2_HLO; // ex.vscp_type = VSCP2_TYPE_HLO_RESPONSE; // m_guid.writeGUID(ex.GUID); // switch (hlo.m_op) { // case HLO_OP_NOOP: // // Send positive response // sprintf(buf, // HLO_CMD_REPLY_TEMPLATE, // "noop", // "OK", // "NOOP commaned executed correctly."); // memset(ex.data, 0, sizeof(ex.data)); // ex.sizeData = strlen(buf); // memcpy(ex.data, buf, ex.sizeData); // // Put event in receive queue // return eventExToReceiveQueue(ex); // case HLO_OP_READ_VAR: // if ("SUNRISE" == hlo.m_name) { // sprintf( // buf, // HLO_READ_VAR_REPLY_TEMPLATE, // "sunrise", // "OK", // VSCP_REMOTE_VARIABLE_CODE_DATETIME, // vscp_convertToBase64(getSunriseTime().getISODateTime()).c_str()); // } else if ("SUNSET" == hlo.m_name) { // sprintf( // buf, // HLO_READ_VAR_REPLY_TEMPLATE, // "sunset", // "OK", // VSCP_REMOTE_VARIABLE_CODE_DATETIME, // vscp_convertToBase64(getSunsetTime().getISODateTime()).c_str()); // } else if ("SUNRISE-TWILIGHT" == hlo.m_name) { // sprintf(buf, // HLO_READ_VAR_REPLY_TEMPLATE, // "sunrise-twilight", // "OK", // VSCP_REMOTE_VARIABLE_CODE_DATETIME, // vscp_convertToBase64( // getCivilTwilightSunriseTime().getISODateTime()) // .c_str()); // } else if ("SUNSET-TWILIGHT" == hlo.m_name) { // sprintf( // buf, // HLO_READ_VAR_REPLY_TEMPLATE, // "sunset-twilight", // "OK", // VSCP_REMOTE_VARIABLE_CODE_DATETIME, // vscp_convertToBase64(getCivilTwilightSunsetTime().getISODateTime()) // .c_str()); // } else if ("NOON" == hlo.m_name) { // sprintf(buf, // HLO_READ_VAR_REPLY_TEMPLATE, // "noon", // "OK", // VSCP_REMOTE_VARIABLE_CODE_DATETIME, // vscp_convertToBase64(m_noonTime.getISODateTime()).c_str()); // } else if ("SENT-SUNRISE" == hlo.m_name) { // sprintf(buf, // HLO_READ_VAR_REPLY_TEMPLATE, // "sent-sunrise", // "OK", // VSCP_REMOTE_VARIABLE_CODE_DATETIME, // vscp_convertToBase64(getSentSunriseTime().getISODateTime()) // .c_str()); // } else if ("SENT-SUNSET" == hlo.m_name) { // sprintf(buf, // HLO_READ_VAR_REPLY_TEMPLATE, // "sent-sunset", // "OK", // VSCP_REMOTE_VARIABLE_CODE_DATETIME, // vscp_convertToBase64(getSentSunsetTime().getISODateTime()) // .c_str()); // } else if ("SENT-SUNRISE-TWILIGHT" == hlo.m_name) { // sprintf(buf, // HLO_READ_VAR_REPLY_TEMPLATE, // "sent-sunrise-twilight", // "OK", // VSCP_REMOTE_VARIABLE_CODE_DATETIME, // vscp_convertToBase64( // getSentCivilTwilightSunriseTime().getISODateTime()) // .c_str()); // } else if ("SENT-SUNSET-TWILIGHT" == hlo.m_name) { // sprintf(buf, // HLO_READ_VAR_REPLY_TEMPLATE, // "sent-sunset-twilight", // "OK", // VSCP_REMOTE_VARIABLE_CODE_DATETIME, // vscp_convertToBase64( // getSentCivilTwilightSunsetTime().getISODateTime()) // .c_str()); // } else if ("SENT-SUNRISE-TWILIGHT" == hlo.m_name) { // sprintf(buf, // HLO_READ_VAR_REPLY_TEMPLATE, // "sent-sunrise-twilight", // "OK", // VSCP_REMOTE_VARIABLE_CODE_DATETIME, // vscp_convertToBase64( // getSentCivilTwilightSunriseTime().getISODateTime()) // .c_str()); // } else if ("SENT-NOON" == hlo.m_name) { // sprintf(buf, // HLO_READ_VAR_REPLY_TEMPLATE, // "sent-noon", // "OK", // VSCP_REMOTE_VARIABLE_CODE_DATETIME, // getSentNoonTime().getISODateTime().c_str()); // } else if ("ENABLE-SUNRISE" == hlo.m_name) { // sprintf(buf, // HLO_READ_VAR_REPLY_TEMPLATE, // "enable-sunrise", // "OK", // VSCP_REMOTE_VARIABLE_CODE_BOOLEAN, // vscp_convertToBase64(m_bSunRiseEvent ? std::string("true") // : std::string("false")) // .c_str()); // } else if ("ENABLE-SUNSET" == hlo.m_name) { // sprintf(buf, // HLO_READ_VAR_REPLY_TEMPLATE, // "enable-sunset", // "OK", // VSCP_REMOTE_VARIABLE_CODE_BOOLEAN, // vscp_convertToBase64(m_bSunSetEvent ? std::string("true") // : std::string("false")) // .c_str()); // } else if ("ENABLE-SUNRISE-TWILIGHT" == hlo.m_name) { // sprintf(buf, // HLO_READ_VAR_REPLY_TEMPLATE, // "enable-sunrise-twilight", // "OK", // VSCP_REMOTE_VARIABLE_CODE_BOOLEAN, // vscp_convertToBase64(m_bSunRiseTwilightEvent // ? std::string("true") // : std::string("false")) // .c_str()); // } else if ("ENABLE-SUNSET-TWILIGHT" == hlo.m_name) { // sprintf(buf, // HLO_READ_VAR_REPLY_TEMPLATE, // "enable-sunset-twilight", // "OK", // VSCP_REMOTE_VARIABLE_CODE_BOOLEAN, // vscp_convertToBase64(m_bSunSetTwilightEvent // ? std::string("true") // : std::string("false")) // .c_str()); // } else if ("ENABLE-NOON" == hlo.m_name) { // sprintf(buf, // HLO_READ_VAR_REPLY_TEMPLATE, // "enable-noon", // "OK", // VSCP_REMOTE_VARIABLE_CODE_BOOLEAN, // vscp_convertToBase64(m_bNoonEvent ? std::string("true") // : std::string("false")) // .c_str()); // } else if ("LONGITUDE" == hlo.m_name) { // sprintf(buf, // HLO_READ_VAR_REPLY_TEMPLATE, // "longitude", // "OK", // VSCP_REMOTE_VARIABLE_CODE_DOUBLE, // vscp_convertToBase64(getLongitudeStr()).c_str()); // } else if ("LATITUDE" == hlo.m_name) { // sprintf(buf, // HLO_READ_VAR_REPLY_TEMPLATE, // "latitude", // "OK", // VSCP_REMOTE_VARIABLE_CODE_DOUBLE, // vscp_convertToBase64(getLatitudeStr()).c_str()); // } else if ("ZONE" == hlo.m_name) { // sprintf(buf, // HLO_READ_VAR_REPLY_TEMPLATE, // "zone", // "OK", // VSCP_REMOTE_VARIABLE_CODE_INTEGER, // vscp_convertToBase64(getZoneStr()).c_str()); // } else if ("SUBZONE" == hlo.m_name) { // sprintf(buf, // HLO_READ_VAR_REPLY_TEMPLATE, // "subzone", // "OK", // VSCP_REMOTE_VARIABLE_CODE_INTEGER, // vscp_convertToBase64(getSubZoneStr()).c_str()); // } else if ("DAYLENGTH" == hlo.m_name) { // sprintf(buf, // HLO_READ_VAR_REPLY_TEMPLATE, // "daylength", // "OK", // VSCP_REMOTE_VARIABLE_CODE_DOUBLE, // vscp_convertToBase64(getDayLengthStr()).c_str()); // } else if ("DECLINATION" == hlo.m_name) { // sprintf(buf, // HLO_READ_VAR_REPLY_TEMPLATE, // "declination", // "OK", // VSCP_REMOTE_VARIABLE_CODE_DOUBLE, // vscp_convertToBase64(getDeclinationStr()).c_str()); // } else if ("SUN-MAX-ALTITUDE" == hlo.m_name) { // sprintf(buf, // HLO_READ_VAR_REPLY_TEMPLATE, // "sun-max-altitude", // "OK", // VSCP_REMOTE_VARIABLE_CODE_DOUBLE, // vscp_convertToBase64(getSunMaxAltitudeStr()).c_str()); // } else if ("LAST-CALCULATION" == hlo.m_name) { // sprintf(buf, // HLO_READ_VAR_REPLY_TEMPLATE, // "last-calculation", // "OK", // VSCP_REMOTE_VARIABLE_CODE_DATETIME, // vscp_convertToBase64(getLastCalculation().getISODateTime()) // .c_str()); // } else { // sprintf( // buf, // HLO_READ_VAR_ERR_REPLY_TEMPLATE, // hlo.m_name.c_str(), // ERR_VARIABLE_UNKNOWN, // vscp_convertToBase64(std::string("Unknown variable")).c_str()); // } // break; // case HLO_OP_WRITE_VAR: // if ("SUNRISE" == hlo.m_name) { // // Read Only variable // sprintf(buf, // HLO_READ_VAR_ERR_REPLY_TEMPLATE, // "sunrise", // VSCP_REMOTE_VARIABLE_CODE_BOOLEAN, // "Variable is read only."); // } else if ("SUNSET" == hlo.m_name) { // // Read Only variable // sprintf(buf, // HLO_READ_VAR_ERR_REPLY_TEMPLATE, // "sunset", // VSCP_REMOTE_VARIABLE_CODE_BOOLEAN, // "Variable is read only."); // } else if ("SUNRISE-TWILIGHT" == hlo.m_name) { // // Read Only variable // sprintf(buf, // HLO_READ_VAR_ERR_REPLY_TEMPLATE, // "sunrise-twilight", // VSCP_REMOTE_VARIABLE_CODE_BOOLEAN, // "Variable is read only."); // } else if ("SUNSET-TWILIGHT" == hlo.m_name) { // // Read Only variable // sprintf(buf, // HLO_READ_VAR_ERR_REPLY_TEMPLATE, // "sunset-twilight", // VSCP_REMOTE_VARIABLE_CODE_BOOLEAN, // "Variable is read only."); // } else if ("NOON" == hlo.m_name) { // // Read Only variable // sprintf(buf, // HLO_READ_VAR_ERR_REPLY_TEMPLATE, // "noon", // VSCP_REMOTE_VARIABLE_CODE_BOOLEAN, // "Variable is read only."); // } else if ("SENT-SUNRISE" == hlo.m_name) { // // Read Only variable // sprintf(buf, // HLO_READ_VAR_ERR_REPLY_TEMPLATE, // "sent-sunrise", // ERR_VARIABLE_READ_ONLY, // "Variable is read only."); // } else if ("SENT-SUNSET" == hlo.m_name) { // // Read Only variable // sprintf(buf, // HLO_READ_VAR_ERR_REPLY_TEMPLATE, // "sent-sunset", // ERR_VARIABLE_READ_ONLY, // "Variable is read only."); // } else if ("SENT-SUNRISE-TWILIGHT" == hlo.m_name) { // // Read Only variable // sprintf(buf, // HLO_READ_VAR_ERR_REPLY_TEMPLATE, // "sent-sunrise-twilight", // ERR_VARIABLE_READ_ONLY, // "Variable is read only."); // } else if ("SENT-SUNSET-TWILIGHT" == hlo.m_name) { // // Read Only variable // sprintf(buf, // HLO_READ_VAR_ERR_REPLY_TEMPLATE, // "sent-sunset-twilight", // ERR_VARIABLE_READ_ONLY, // "Variable is read only."); // } else if ("SENT-SUNRISE-TWILIGHT" == hlo.m_name) { // } else if ("SENT-NOON" == hlo.m_name) { // // Read Only variable // sprintf(buf, // HLO_READ_VAR_ERR_REPLY_TEMPLATE, // "sent-noon", // ERR_VARIABLE_READ_ONLY, // "Variable is read only."); // } else if ("ENABLE-SUNRISE" == hlo.m_name) { // if (VSCP_REMOTE_VARIABLE_CODE_BOOLEAN != hlo.m_varType) { // // Wrong variable type // sprintf(buf, // HLO_READ_VAR_ERR_REPLY_TEMPLATE, // "enable-sunrise", // ERR_VARIABLE_WRONG_TYPE, // "Variable type should be boolean."); // } else { // vscp_trim(hlo.m_value); // vscp_makeUpper(hlo.m_value); // if ("TRUE" == hlo.m_value) { // enableSunRiseEvent(); // sprintf(buf, // HLO_READ_VAR_REPLY_TEMPLATE, // "enable-sunrise", // "OK", // VSCP_REMOTE_VARIABLE_CODE_BOOLEAN, // vscp_convertToBase64(isSendSunriseEvent() // ? std::string("true") // : std::string("false")) // .c_str()); // } else { // disableSunRiseEvent(); // sprintf(buf, // HLO_READ_VAR_REPLY_TEMPLATE, // "enable-sunrise", // "OK", // VSCP_REMOTE_VARIABLE_CODE_BOOLEAN, // vscp_convertToBase64(isSendSunriseEvent() // ? std::string("true") // : std::string("false")) // .c_str()); // } // } // } else if ("ENABLE-SUNSET" == hlo.m_name) { // if (VSCP_REMOTE_VARIABLE_CODE_BOOLEAN != hlo.m_varType) { // // Wrong variable type // sprintf(buf, // HLO_READ_VAR_ERR_REPLY_TEMPLATE, // "enable-sunset", // ERR_VARIABLE_WRONG_TYPE, // "Variable type should be boolean."); // } else { // vscp_trim(hlo.m_value); // vscp_makeUpper(hlo.m_value); // if ("TRUE" == hlo.m_value) { // enableSunSetEvent(); // sprintf(buf, // HLO_READ_VAR_REPLY_TEMPLATE, // "enable-sunset", // "OK", // VSCP_REMOTE_VARIABLE_CODE_BOOLEAN, // vscp_convertToBase64(isSendSunsetEvent() // ? std::string("true") // : std::string("false")) // .c_str()); // } else { // disableSunSetEvent(); // sprintf(buf, // HLO_READ_VAR_REPLY_TEMPLATE, // "enable-sunset", // "OK", // VSCP_REMOTE_VARIABLE_CODE_BOOLEAN, // vscp_convertToBase64(isSendSunsetEvent() // ? std::string("true") // : std::string("false")) // .c_str()); // } // } // } else if ("ENABLE-SUNRISE-TWILIGHT" == hlo.m_name) { // if (VSCP_REMOTE_VARIABLE_CODE_BOOLEAN != hlo.m_varType) { // // Wrong variable type // sprintf(buf, // HLO_READ_VAR_ERR_REPLY_TEMPLATE, // "enable-sunrise-twilight", // ERR_VARIABLE_WRONG_TYPE, // "Variable type should be boolean."); // } else { // vscp_trim(hlo.m_value); // vscp_makeUpper(hlo.m_value); // if ("TRUE" == hlo.m_value) { // enableSunRiseTwilightEvent(); // sprintf(buf, // HLO_READ_VAR_REPLY_TEMPLATE, // "enable-sunrise-twilight", // "OK", // VSCP_REMOTE_VARIABLE_CODE_BOOLEAN, // vscp_convertToBase64(isSendSunriseTwilightEvent() // ? std::string("true") // : std::string("false")) // .c_str()); // } else { // disableSunRiseEvent(); // sprintf(buf, // HLO_READ_VAR_REPLY_TEMPLATE, // "enable-sunrise-twilight", // "OK", // VSCP_REMOTE_VARIABLE_CODE_BOOLEAN, // vscp_convertToBase64(isSendSunriseTwilightEvent() // ? std::string("true") // : std::string("false")) // .c_str()); // } // } // } else if ("ENABLE-SUNSET-TWILIGHT" == hlo.m_name) { // if (VSCP_REMOTE_VARIABLE_CODE_BOOLEAN != hlo.m_varType) { // // Wrong variable type // sprintf(buf, // HLO_READ_VAR_ERR_REPLY_TEMPLATE, // "enable-sunset-twilight", // ERR_VARIABLE_WRONG_TYPE, // "Variable type should be boolean."); // } else { // vscp_trim(hlo.m_value); // vscp_makeUpper(hlo.m_value); // if ("TRUE" == hlo.m_value) { // enableSunSetTwilightEvent(); // sprintf(buf, // HLO_READ_VAR_REPLY_TEMPLATE, // "enable-sunset-twilight", // "OK", // VSCP_REMOTE_VARIABLE_CODE_BOOLEAN, // vscp_convertToBase64(isSendSunsetTwilightEvent() // ? std::string("true") // : std::string("false")) // .c_str()); // } else { // disableSunSetTwilightEvent(); // sprintf(buf, // HLO_READ_VAR_REPLY_TEMPLATE, // "enable-sunset-twilight", // "OK", // VSCP_REMOTE_VARIABLE_CODE_BOOLEAN, // vscp_convertToBase64(isSendSunsetTwilightEvent() // ? std::string("true") // : std::string("false")) // .c_str()); // } // } // } else if ("ENABLE-NOON" == hlo.m_name) { // if (VSCP_REMOTE_VARIABLE_CODE_BOOLEAN != hlo.m_varType) { // // Wrong variable type // sprintf(buf, // HLO_READ_VAR_ERR_REPLY_TEMPLATE, // "enable-noon", // ERR_VARIABLE_WRONG_TYPE, // "Variable type should be boolean."); // } else { // vscp_trim(hlo.m_value); // vscp_makeUpper(hlo.m_value); // if ("TRUE" == hlo.m_value) { // enableCalculatedNoonEvent(); // sprintf(buf, // HLO_READ_VAR_REPLY_TEMPLATE, // "enable-noon", // "OK", // VSCP_REMOTE_VARIABLE_CODE_BOOLEAN, // vscp_convertToBase64(isSendCalculatedNoonEvent() // ? std::string("true") // : std::string("false")) // .c_str()); // } else { // disableCalculatedNoonEvent(); // sprintf(buf, // HLO_READ_VAR_REPLY_TEMPLATE, // "enable-sunrise", // "OK", // VSCP_REMOTE_VARIABLE_CODE_BOOLEAN, // vscp_convertToBase64(isSendCalculatedNoonEvent() // ? std::string("true") // : std::string("false")) // .c_str()); // } // } // } else if ("LONGITUDE" == hlo.m_name) { // if (VSCP_REMOTE_VARIABLE_CODE_DOUBLE != hlo.m_varType) { // // Wrong variable type // sprintf(buf, // HLO_READ_VAR_ERR_REPLY_TEMPLATE, // "enable-noon", // ERR_VARIABLE_WRONG_TYPE, // "Variable type should be boolean."); // } // sprintf(buf, // HLO_READ_VAR_REPLY_TEMPLATE, // "longitude", // "OK", // 5, // vscp_convertToBase64(getLongitudeStr()).c_str()); // } else if ("LATITUDE" == hlo.m_name) { // sprintf(buf, // HLO_READ_VAR_REPLY_TEMPLATE, // "latitude", // "OK", // 5, // vscp_convertToBase64(getLatitudeStr()).c_str()); // } else if ("ZONE" == hlo.m_name) { // sprintf(buf, // HLO_READ_VAR_REPLY_TEMPLATE, // "zone", // "OK", // 3, // vscp_convertToBase64(getZoneStr()).c_str()); // } else if ("SUBZONE" == hlo.m_name) { // sprintf(buf, // HLO_READ_VAR_REPLY_TEMPLATE, // "subzone", // "OK", // 3, // vscp_convertToBase64(getSubZoneStr()).c_str()); // } else if ("DAYLENGTH" == hlo.m_name) { // sprintf(buf, // HLO_READ_VAR_REPLY_TEMPLATE, // "daylength", // "OK", // 5, // vscp_convertToBase64(getDayLengthStr()).c_str()); // } else if ("DECLINATION" == hlo.m_name) { // sprintf(buf, // HLO_READ_VAR_REPLY_TEMPLATE, // "declination", // "OK", // 5, // vscp_convertToBase64(getDeclinationStr()).c_str()); // } else if ("SUN-MAX-ALTITUDE" == hlo.m_name) { // sprintf(buf, // HLO_READ_VAR_REPLY_TEMPLATE, // "sun-max-altitude", // "OK", // 5, // vscp_convertToBase64(getSunMaxAltitudeStr()).c_str()); // } else if ("LAST-CALCULATION" == hlo.m_name) { // sprintf(buf, // HLO_READ_VAR_REPLY_TEMPLATE, // "last-calculation", // "OK", // 13, // vscp_convertToBase64(getLastCalculation().getISODateTime()) // .c_str()); // } else { // sprintf( // buf, // HLO_READ_VAR_ERR_REPLY_TEMPLATE, // hlo.m_name.c_str(), // 1, // vscp_convertToBase64(std::string("Unknown variable")).c_str()); // } // break; // case HLO_OP_SAVE: // doSaveConfig(); // break; // case HLO_OP_LOAD: // doLoadConfig(); // break; // case HLO_USER_CALC_ASTRO: // doCalc(); // break; // default: // break; // }; return true; } /////////////////////////////////////////////////////////////////////////////// // eventExToReceiveQueue // bool CAutomation::eventExToReceiveQueue(vscpEventEx& ex) { vscpEvent* pev = new vscpEvent(); if (vscp_convertEventExToEvent(pev, &ex)) { syslog(LOG_ERR, "[vscpl2drv-automation] Failed to convert event from ex to ev."); vscp_deleteEvent(pev); return false; } if (NULL != pev) { if (vscp_doLevel2Filter(pev, &m_vscpfilter)) { pthread_mutex_lock(&m_mutexReceiveQueue); m_receiveList.push_back(pev); sem_post(&m_semReceiveQueue); pthread_mutex_unlock(&m_mutexReceiveQueue); } else { vscp_deleteEvent(pev); } } else { syslog(LOG_ERR, "[vscpl2drv-automation] Unable to allocate event storage."); } return true; } /////////////////////////////////////////////////////////////////////////////// // doWork // bool CAutomation::doWork(void) { vscpEventEx ex; std::string str; vscpdatetime now = vscpdatetime::Now(); // Calculate Sunrise/sunset parameters once a day if (!m_bCalulationHasBeenDone && (0 == vscpdatetime::Now().getHour())) { doCalc(); m_bCalulationHasBeenDone = true; int hours, minutes; convert2HourMinute(getDayLength(), &hours, &minutes); // Send VSCP_CLASS2_VSCPD, Type=30/VSCP2_TYPE_VSCPD_NEW_CALCULATION ex.obid = 0; ex.head = 0; ex.timestamp = vscp_makeTimeStamp(); vscp_setEventExToNow(&ex); // Set time to current time ex.vscp_class = VSCP_CLASS2_VSCPD; ex.vscp_type = VSCP2_TYPE_VSCPD_NEW_CALCULATION; ex.sizeData = 0; m_guid.writeGUID(ex.GUID); // Put event in receive queue return eventExToReceiveQueue(ex); } // Trigger for next noon calculation if (0 != vscpdatetime::Now().getHour()) { m_bCalulationHasBeenDone = false; } // Sunrise Time if ((now.getYear() == m_SunriseTime.getYear()) && (now.getMonth() == m_SunriseTime.getMonth()) && (now.getDay() == m_SunriseTime.getDay()) && (now.getHour() == m_SunriseTime.getHour()) && (now.getMinute() == m_SunriseTime.getMinute())) { m_SunriseTime += SPAN24; // Add 24h's m_SunriseTime_sent = vscpdatetime::Now(); // Send VSCP_CLASS1_INFORMATION, Type=44/VSCP_TYPE_INFORMATION_SUNRISE ex.obid = 0; ex.head = 0; ex.timestamp = vscp_makeTimeStamp(); vscp_setEventExToNow(&ex); // Set time to current time ex.vscp_class = VSCP_CLASS1_INFORMATION; ex.vscp_type = VSCP_TYPE_INFORMATION_SUNRISE; ex.sizeData = 3; m_guid.writeGUID(ex.GUID); ex.data[0] = 0; // index ex.data[1] = m_zone; // zone ex.data[2] = m_subzone; // subzone // Put event in receive queue return eventExToReceiveQueue(ex); } // Civil Twilight Sunrise Time if ((now.getYear() == m_civilTwilightSunriseTime.getYear()) && (now.getMonth() == m_civilTwilightSunriseTime.getMonth()) && (now.getDay() == m_civilTwilightSunriseTime.getDay()) && (now.getHour() == m_civilTwilightSunriseTime.getHour()) && (now.getMinute() == m_civilTwilightSunriseTime.getMinute())) { m_civilTwilightSunriseTime += SPAN24; // Add 24h's m_civilTwilightSunriseTime_sent = vscpdatetime::Now(); // Send VSCP_CLASS1_INFORMATION, // Type=52/VSCP_TYPE_INFORMATION_SUNRISE_TWILIGHT_START ex.obid = 0; ex.head = 0; ex.timestamp = vscp_makeTimeStamp(); vscp_setEventExToNow(&ex); // Set time to current time ex.vscp_class = VSCP_CLASS1_INFORMATION; ex.vscp_type = VSCP_TYPE_INFORMATION_SUNRISE_TWILIGHT_START; ex.sizeData = 3; m_guid.writeGUID(ex.GUID); ex.data[0] = 0; // index ex.data[1] = m_zone; // zone ex.data[2] = m_subzone; // subzone // Put event in receive queue return eventExToReceiveQueue(ex); } // Sunset Time if ((now.getYear() == m_SunsetTime.getYear()) && (now.getMonth() == m_SunsetTime.getMonth()) && (now.getDay() == m_SunsetTime.getDay()) && (now.getHour() == m_SunsetTime.getHour()) && (now.getMinute() == m_SunsetTime.getMinute())) { m_SunsetTime += SPAN24; // Add 24h's m_SunsetTime_sent = vscpdatetime::Now(); // Send VSCP_CLASS1_INFORMATION, Type=45/VSCP_TYPE_INFORMATION_SUNSET ex.obid = 0; ex.head = 0; ex.timestamp = vscp_makeTimeStamp(); vscp_setEventExToNow(&ex); // Set time to current time ex.vscp_class = VSCP_CLASS1_INFORMATION; ex.vscp_type = VSCP_TYPE_INFORMATION_SUNSET; ex.sizeData = 3; m_guid.writeGUID(ex.GUID); ex.data[0] = 0; // index ex.data[1] = m_zone; // zone ex.data[2] = m_subzone; // subzone // Put event in receive queue return eventExToReceiveQueue(ex); } // Civil Twilight Sunset Time if ((now.getYear() == m_civilTwilightSunsetTime.getYear()) && (now.getMonth() == m_civilTwilightSunsetTime.getMonth()) && (now.getDay() == m_civilTwilightSunsetTime.getDay()) && (now.getHour() == m_civilTwilightSunsetTime.getHour()) && (now.getMinute() == m_civilTwilightSunsetTime.getMinute())) { m_civilTwilightSunsetTime += SPAN24; // Add 24h's m_civilTwilightSunsetTime_sent = vscpdatetime::Now(); // Send VSCP_CLASS1_INFORMATION, // Type=53/VSCP_TYPE_INFORMATION_SUNSET_TWILIGHT_START ex.obid = 0; ex.head = 0; ex.timestamp = vscp_makeTimeStamp(); vscp_setEventExToNow(&ex); // Set time to current time ex.vscp_class = VSCP_CLASS1_INFORMATION; ex.vscp_type = VSCP_TYPE_INFORMATION_SUNSET_TWILIGHT_START; ex.sizeData = 3; m_guid.writeGUID(ex.GUID); ex.data[0] = 0; // index ex.data[1] = m_zone; // zone ex.data[2] = m_subzone; // subzone // Put event in receive queue return eventExToReceiveQueue(ex); } // Noon Time if ((now.getYear() == m_noonTime.getYear()) && (now.getMonth() == m_noonTime.getMonth()) && (now.getDay() == m_noonTime.getDay()) && (now.getHour() == m_noonTime.getHour()) && (now.getMinute() == m_noonTime.getMinute())) { m_noonTime += SPAN24; // Add 24h's m_noonTime_sent = vscpdatetime::Now(); // Send VSCP_CLASS1_INFORMATION, // Type=58/VSCP_TYPE_INFORMATION_CALCULATED_NOON ex.obid = 0; ex.head = 0; ex.timestamp = vscp_makeTimeStamp(); vscp_setEventExToNow(&ex); // Set time to current time ex.vscp_class = VSCP_CLASS1_INFORMATION; ex.vscp_type = VSCP_TYPE_INFORMATION_CALCULATED_NOON; ex.sizeData = 3; m_guid.writeGUID(ex.GUID); ex.data[0] = 0; // index ex.data[1] = m_zone; // zone ex.data[2] = m_subzone; // subzone // Put event in receive queue return eventExToReceiveQueue(ex); } return false; } // ---------------------------------------------------------------------------- ////////////////////////////////////////////////////////////////////// // addEvent2SendQueue // bool CAutomation::addEvent2SendQueue(const vscpEvent* pEvent) { pthread_mutex_lock(&m_mutexSendQueue); m_sendList.push_back((vscpEvent*)pEvent); sem_post(&m_semSendQueue); pthread_mutex_unlock(&m_mutexSendQueue); return true; } ////////////////////////////////////////////////////////////////////// // Workerthread - CAutomationWorkerTread ////////////////////////////////////////////////////////////////////// void* workerThread(void* pData) { __attribute__((unused)) fd_set rdfs; __attribute__((unused)) struct timeval tv; CAutomation* pObj = (CAutomation*)pData; if (NULL == pObj) { syslog(LOG_ERR, "[vscpl2drv-automation] No object data supplied for worker " "thread. Terminating"); return NULL; } #if DEBUG syslog(LOG_DEBUG, "[vscpl2drv-automation] CWriteSocketCanTread: Interface: %s\n", ifname); #endif // Do work at least once a second. Check incoming // event right away. while (!pObj->m_bQuit) { // Do the automation work pObj->doWork(); // Check for incoming event int rv; if (-1 == (rv = vscp_sem_wait(&pObj->m_semSendQueue, 1000))) { if (EINTR == errno) { syslog(LOG_INFO, "[vscpl2drv-automation] Interrupted by a signal " "handler. Terminating."); pObj->m_bQuit = true; } else if (EINVAL == errno) { syslog( LOG_ERR, "[vscpl2drv-automation] Invalid semaphore. Terminating."); pObj->m_bQuit = true; } } // Check if there is event(s) for us if (pObj->m_sendList.size()) { // Yes there are event/(s) in the queue // Handle pthread_mutex_lock(&pObj->m_mutexSendQueue); vscpEvent* pEvent = pObj->m_sendList.front(); pObj->m_sendList.pop_front(); pthread_mutex_unlock(&pObj->m_mutexSendQueue); if (NULL == pEvent) { continue; } // Only HLO object event is of interst to us if ((VSCP_CLASS2_HLO == pEvent->vscp_class) && (VSCP2_TYPE_HLO_COMMAND == pEvent->vscp_type) && vscp_isSameGUID(pObj->m_guid.getGUID(), pEvent->GUID) ) { pObj->handleHLO(pEvent); } vscp_deleteEvent(pEvent); pEvent = NULL; } // event to send } // Outer loop return NULL; }
36.33913
125
0.467252
[ "object" ]
956520131a6395030bc74b484e9d50d72ce18d78
458
cpp
C++
leetcode_archived_cpp/LeetCode_581.cpp
Sean10/Algorithm_code
46ff1cb5b81400cbcc324dabdf4298bf7a55e5eb
[ "BSD-3-Clause" ]
null
null
null
leetcode_archived_cpp/LeetCode_581.cpp
Sean10/Algorithm_code
46ff1cb5b81400cbcc324dabdf4298bf7a55e5eb
[ "BSD-3-Clause" ]
7
2021-03-19T04:41:21.000Z
2021-10-19T15:46:36.000Z
leetcode_archived_cpp/LeetCode_581.cpp
Sean10/Algorithm_code
46ff1cb5b81400cbcc324dabdf4298bf7a55e5eb
[ "BSD-3-Clause" ]
null
null
null
class Solution { public: int findUnsortedSubarray(vector<int>& nums) { int begin = -1, end = -2, n = nums.size(), min_ = nums[n-1], max_ = nums[0]; for (int i = 0;i < n; i++) { max_ = max(max_, nums[i]); min_ = min(min_, nums[n-1-i]); if (nums[i] < max_) end = i; if (nums[n-1-i] > min_) begin = n-1-i; } return end-begin+1; } };
26.941176
84
0.419214
[ "vector" ]
9567023268d352083391a760441bd6dd7ed259f3
2,653
cpp
C++
chess-ai/Renderer.cpp
zacholade/chess-ai
cf207023ceb0a2635147e98637dd6be5b1fb5462
[ "MIT" ]
1
2021-03-18T22:37:23.000Z
2021-03-18T22:37:23.000Z
chess-ai/Renderer.cpp
zacholade/chess-ai
cf207023ceb0a2635147e98637dd6be5b1fb5462
[ "MIT" ]
null
null
null
chess-ai/Renderer.cpp
zacholade/chess-ai
cf207023ceb0a2635147e98637dd6be5b1fb5462
[ "MIT" ]
null
null
null
#include "Renderer.h" #include "Constants.h" #include <iostream> Renderer::Renderer(SDL_Renderer* renderer) { this->renderer = renderer; } Renderer::~Renderer() { SDL_DestroyRenderer(renderer); } void Renderer::render( Window* window, Board* board, std::map<const int, SDL_Texture*> textureMap, int Perspective) { // Set the background colour to off black for the window. Uint8 red = 44; Uint8 green = 47; Uint8 blue = 51; SDL_SetRenderDrawColor(renderer, red, green, blue, 255); // Clears the window and sets the background colour to the one specified above. SDL_RenderClear(renderer); renderBoard(window, textureMap[1]); // Loop over all the pieces on the board and draw them in // their corresponding position. Accounting for window size & borders. int file = 0; int rank = 0; int heldPiecePos = board->getHeldBoardPosition(); std::vector<int> boardVec = board->getBoard(); for (int i = 0; i < 64; i++) { // We want the piece held by the mouse to render on top. if (i != heldPiecePos && boardVec[i] != Piece::None) { renderPiece(window, textureMap[boardVec[i]], rank, file); } if (file == 7) { file = 0; rank ++; } else { file++; } } if (heldPiecePos != -1) { renderPieceAtScreenPos(window, textureMap[boardVec[heldPiecePos]], window->getMouseX(), window->getMouseY()); } // We are done drawing to this buffer. Present it. SDL_RenderPresent(renderer); } SDL_Renderer* Renderer::getRenderer() { return renderer; } void Renderer::renderBoard(Window* window, SDL_Texture* texture) { int borderWidth = window->getBorderWidth(); int borderHeight = window->getBorderHeight(); int pieceSize = window->getPieceSize(); // Draw the 8x8 grid board background. SDL_Rect dest; dest.x = borderWidth / 2; dest.y = borderHeight / 2; dest.w = pieceSize * 8; dest.h = dest.w; SDL_RenderCopy(renderer, texture, NULL, &dest); } void Renderer::renderPieceAtScreenPos(Window* window, SDL_Texture* texture, int posX, int posY) { int pieceSize = window->getPieceSize(); SDL_Rect dest; dest.x = posX - (pieceSize / 2); dest.y = posY - (pieceSize / 2); dest.w = pieceSize; dest.h = pieceSize; SDL_RenderCopy(renderer, texture, NULL, &dest); } void Renderer::renderPiece(Window* window, SDL_Texture* texture, int rank, int file) { int borderWidth = window->getBorderWidth(); int borderHeight = window->getBorderHeight(); int pieceSize = window->getPieceSize(); SDL_Rect dest; dest.x = (borderWidth / 2) + (file * pieceSize); dest.y = (borderHeight / 2) + (8 * pieceSize) - ((rank + 1) * pieceSize); dest.w = pieceSize; dest.h = pieceSize; SDL_RenderCopy(renderer, texture, NULL, &dest); }
26.267327
111
0.698832
[ "render", "vector" ]
95692e8d0ab199261b894a8894a55fd1961806c1
1,091
hpp
C++
include/common.hpp
forcecore/CsfStuff
5640aeaa8fd8cd2ef47298e0cdd527251dce1f66
[ "MIT" ]
1
2021-08-01T00:27:29.000Z
2021-08-01T00:27:29.000Z
include/common.hpp
forcecore/CsfStuff
5640aeaa8fd8cd2ef47298e0cdd527251dce1f66
[ "MIT" ]
8
2021-03-14T11:24:51.000Z
2021-03-18T10:08:23.000Z
include/common.hpp
forcecore/CsfStuff
5640aeaa8fd8cd2ef47298e0cdd527251dce1f66
[ "MIT" ]
null
null
null
#pragma once #include <cassert> #include <iostream> #include <string> #include <vector> #ifndef NDEBUG # define ASSERT(condition, message) \ do { \ if (! (condition)) { \ std::cerr << "Assertion `" #condition "` failed in " << __FILE__ \ << " line " << __LINE__ << ": " << message << std::endl; \ assert(condition); \ } \ } while (false) #else # define ASSERT(condition, message) do { } while (false) #endif struct CSFHeader { char magic[4] = {' ', 'F', 'S', 'C'}; // CSF in reverse uint32_t csf_format = 3; uint32_t num_labels; uint32_t num_strings; uint32_t unused; uint32_t lang_code; }; struct LabelHeader { char magic[4] = {' ', 'L', 'B', 'L'}; uint32_t num_string_pairs = 1; uint32_t length; }; struct StrHeader { char magic[4]; uint32_t length; }; class Entry { public: std::string label; std::string str; std::string extra_data; }; void write_entry_to_str(FILE *fp, const Entry &entry); std::vector<Entry> read_entries(const std::string &fname);
20.203704
80
0.589368
[ "vector" ]
95708bc246077b62be1700adeeeaf4c1e83bedd3
1,066
cc
C++
packages/MC/mc/Fission_Matrix_Solver.pt.cc
GCZhang/Profugus
d4d8fe295a92a257b26b6082224226ca1edbff5d
[ "BSD-2-Clause" ]
19
2015-06-04T09:02:41.000Z
2021-04-27T19:32:55.000Z
packages/MC/mc/Fission_Matrix_Solver.pt.cc
GCZhang/Profugus
d4d8fe295a92a257b26b6082224226ca1edbff5d
[ "BSD-2-Clause" ]
null
null
null
packages/MC/mc/Fission_Matrix_Solver.pt.cc
GCZhang/Profugus
d4d8fe295a92a257b26b6082224226ca1edbff5d
[ "BSD-2-Clause" ]
5
2016-10-05T20:48:28.000Z
2021-06-21T12:00:54.000Z
//----------------------------------*-C++-*----------------------------------// /*! * \file MC/mc/Fission_Matrix_Solver.pt.cc * \author Thomas M. Evans * \date Mon Dec 08 17:18:34 2014 * \brief Fission_Matrix_Solver member definitions. * \note Copyright (C) 2014 Oak Ridge National Laboratory, UT-Battelle, LLC. */ //---------------------------------------------------------------------------// #include "solvers/LinAlgTypedefs.hh" #include "Fission_Matrix_Solver.t.hh" #include "geometry/RTK_Geometry.hh" #include "geometry/Mesh_Geometry.hh" namespace profugus { template class Fission_Matrix_Solver<Core,EpetraTypes>; template class Fission_Matrix_Solver<Core,TpetraTypes>; template class Fission_Matrix_Solver<Mesh_Geometry,EpetraTypes>; template class Fission_Matrix_Solver<Mesh_Geometry,TpetraTypes>; } // end namespace profugus //---------------------------------------------------------------------------// // end of Fission_Matrix_Solver.pt.cc //---------------------------------------------------------------------------//
36.758621
79
0.5394
[ "geometry" ]
9576e8c536e789011d1351e2a7d64f2e823c47f1
8,847
hpp
C++
performance_test/src/utilities/cpu_usage_tracker.hpp
RoverRobotics-forks/performance_test
1e59823b4058bbb8aabdb4c06e42a5ffdae6aaa1
[ "Apache-2.0" ]
null
null
null
performance_test/src/utilities/cpu_usage_tracker.hpp
RoverRobotics-forks/performance_test
1e59823b4058bbb8aabdb4c06e42a5ffdae6aaa1
[ "Apache-2.0" ]
null
null
null
performance_test/src/utilities/cpu_usage_tracker.hpp
RoverRobotics-forks/performance_test
1e59823b4058bbb8aabdb4c06e42a5ffdae6aaa1
[ "Apache-2.0" ]
null
null
null
// Copyright 2017 Apex.AI, Inc. // // 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. #ifndef UTILITIES__CPU_USAGE_TRACKER_HPP_ #define UTILITIES__CPU_USAGE_TRACKER_HPP_ #include <sys/times.h> #include <sys/types.h> #include <unistd.h> #include <fstream> #include <utility> #include <string> #include <vector> #ifdef PERFORMANCE_TEST_ODB_FOR_SQL_ENABLED #include <odb/core.hxx> #endif namespace performance_test { struct CpuInfo { CpuInfo(uint32_t cpu_cores, float_t cpu_usage) : m_cpu_cores(cpu_cores), m_cpu_usage(cpu_usage) {} #ifdef PERFORMANCE_TEST_ODB_FOR_SQL_ENABLED CpuInfo() {} #endif uint32_t cpu_cores() const { return m_cpu_cores; } float_t cpu_usage() const { return m_cpu_usage; } private: #ifdef PERFORMANCE_TEST_ODB_FOR_SQL_ENABLED friend class odb::access; #endif uint32_t m_cpu_cores; float_t m_cpu_usage; }; /// Calculate the CPU usage for the running experiment in the performance test class CPUsageTracker { public: CPUsageTracker() : proc_stat_file("/proc/stat", std::ifstream::in) {} /** * \brief Computes the CPU usage % as (process_active_time/total_cpu_time)*100 * This throws an exception if the total time is not updated * */ CpuInfo get_cpu_usage() { // get process cpu times from http://man7.org/linux/man-pages/man2/times.2.html const auto retval = times(&m_process_cpu_times); if (retval == -1) { throw std::runtime_error("Could not get process CPU times."); } // compute total process time const int64_t process_active_time = m_process_cpu_times.tms_cstime + m_process_cpu_times .tms_cutime + m_process_cpu_times.tms_stime + m_process_cpu_times.tms_utime; // get total CPU times from http://man7.org/linux/man-pages/man5/proc.5.html const auto bundle = read_total_cpu_times(); const int64_t cpu_total_time = bundle.first; float_t cpu_usage_local{}; // active time and total time are valid if ((process_active_time > 0) && (cpu_total_time > 0) && (cpu_total_time >= process_active_time)) { // The CPU times should always be incrementing if ((process_active_time >= m_prev_active_time) && (cpu_total_time >= m_prev_total_time)) { // The diff should never be negative const int64_t active_time_diff = process_active_time - m_prev_active_time; const int64_t total_time_diff = cpu_total_time - m_prev_total_time; // compute CPU usage if (active_time_diff != 0) { // if the active time diff is non zero if (total_time_diff != 0) { // if the total time diff is non zero cpu_usage_local = (static_cast<float_t>(active_time_diff) / static_cast<float_t>(total_time_diff)) * 100.0F; } else { // when the total time diff is 0 // this should never happen throw std::runtime_error("get_cpu_usage: CPU times are not updated!"); } } else { if (total_time_diff != 0) { // when the active time diff is 0 and total time diff is non 0 // CPU if completely idle (ideal case) cpu_usage_local = 0.0F; } else { // when the total time diff is 0 // this should never happen throw std::runtime_error("get_cpu_usage: CPU times are not updated!"); } } // update previous times m_prev_active_time = process_active_time; m_prev_total_time = cpu_total_time; CpuInfo cpu_info_local{bundle.second, cpu_usage_local}; return cpu_info_local; } else { throw std::invalid_argument("get_cpu_usage: time travelled backwards."); } } else { throw std::invalid_argument("get_cpu_usage: process_active_time > cpu_total_time"); } } private: /** * \brief Class for specifying CPU Time states. * * The class CpuTimeState is used for specifying the index from which to parse * the specific CPU time from `/proc/stat` output. * * e.g. user nice system idle iowait irq softirq steal guest guest_nice * cpu 4705 356 584 3699 23 23 0 0 0 0 */ class CpuTimeState { public: /** * \brief Overloaded istream operator to parse contents of `/proc/stat` file */ explicit CpuTimeState(std::istream & stream) { stream >> m_cpu_label >> m_cs_user >> m_cs_nice >> m_cs_system >> m_cs_idle >> m_cs_iowait >> m_cs_irq >> m_cs_softirq >> m_cs_steal; } /** * \brief Calculates the total cpu time since boot */ int64_t compute_total_cpu_time() const { return m_cs_user + m_cs_nice + m_cs_system + m_cs_idle + m_cs_iowait + m_cs_irq + m_cs_softirq + m_cs_steal; } int64_t cs_user() const { return m_cs_user; } int64_t cs_nice() const { return m_cs_nice; } int64_t cs_system() const { return m_cs_system; } int64_t cs_idle() const { return m_cs_idle; } int64_t cs_iowait() const { return m_cs_iowait; } int64_t cs_irq() const { return m_cs_irq; } int64_t cs_softirq() const { return m_cs_softirq; } int64_t cs_steal() const { return m_cs_steal; } int64_t cs_guest() const { return m_cs_guest; } int64_t cs_guest_nice() const { return m_cs_guest_nice; } std::string cpu_label() const { return m_cpu_label; } private: /// Time spent in user mode int64_t m_cs_user{}; /// Time spent in user mode with low priority ("nice") int64_t m_cs_nice{}; /// Time spent in system mode int64_t m_cs_system{}; /// Time spent in idle task int64_t m_cs_idle{}; /// Time waiting for I/O to complete int64_t m_cs_iowait{}; /// Time spent in servicing interrupts int64_t m_cs_irq{}; /// Time spent in servicing soft irq's int64_t m_cs_softirq{}; /// Time spent in other OS (stolen time) int64_t m_cs_steal{}; /// Time spent for running virtual CPU for guest OS int64_t m_cs_guest{}; /// Time spent for running virtual CPU with nice prio for guest OS int64_t m_cs_guest_nice{}; /// Cpu label (cpu 0 ,cpu 1 ..) std::string m_cpu_label{}; }; int64_t m_prev_active_time{}; int64_t m_prev_total_time{}; tms m_process_cpu_times; std::ifstream proc_stat_file; /** * \brief Vector for storing cpu information * * This vector is used to store the cpu label (cpu 0, cpu1 ..etc) along with the cpu ticks in * cpu_time_array for different CPU usages as defined by CpuTimeState struct above. * */ std::vector<CpuTimeState> m_entries{}; /** * \brief Reads the total cpu time. * * This function parses the output of /proc/stat which contains information on cpu time spent * since boot. It computes the total CPU time since boot as well as counts the number of CPU * cores and returns a bundle of both. * */ std::pair<int64_t, uint32_t> read_total_cpu_times() { std::string line; const std::string cpu_string("cpu"); const std::size_t cpu_string_len = cpu_string.size(); int64_t cpu_total_time {}; uint32_t num_cpu_cores {}; while (std::getline(proc_stat_file, line)) { // cpu stats line found if (!line.compare(0, cpu_string_len, cpu_string)) { std::istringstream ss(line); // store entry CpuTimeState entry(ss); // count the number of cpu cores if (entry.cpu_label().size() > cpu_string_len) { ++num_cpu_cores; } // read times m_entries.push_back(entry); } } // compute cpu total time // Guest and Guest_nice are not included in the total time calculation since they are // already accounted in user and nice. cpu_total_time = m_entries[0].compute_total_cpu_time(); // Clear entries vector for next iteration m_entries.clear(); // Reset the eof file flag and move file pointer to beginning for next read proc_stat_file.clear(); proc_stat_file.seekg(0, std::ifstream::beg); std::pair<int64_t, uint32_t> bundle {cpu_total_time, num_cpu_cores}; return bundle; } }; } // namespace performance_test #endif // UTILITIES__CPU_USAGE_TRACKER_HPP_
27.475155
94
0.657511
[ "vector" ]
d2ebe5db2d872e008eaba9d2c3131b208c67a8f6
27,304
cpp
C++
Engine/DataStructure/GridUniform3D.cpp
jmhong-simulation/LithopiaOpen
49c4c0863714ee11730e4807eb10c1e1ebb520f1
[ "MIT" ]
8
2017-06-01T07:00:10.000Z
2021-12-16T11:01:29.000Z
Engine/DataStructure/GridUniform3D.cpp
jmhong-simulation/LithopiaOpen
49c4c0863714ee11730e4807eb10c1e1ebb520f1
[ "MIT" ]
null
null
null
Engine/DataStructure/GridUniform3D.cpp
jmhong-simulation/LithopiaOpen
49c4c0863714ee11730e4807eb10c1e1ebb520f1
[ "MIT" ]
null
null
null
// The Lithopia project initiated by Jeong-Mo Hong for 3D Printing Community. // Copyright (c) 2015 Jeong-Mo Hong - All Rights Reserved. // This file is subject to the terms and conditions defined in // file 'LICENSE.txt', which is part of this source code package. #include "GridUniform3D.h" #include "Array1D.h" GridUniform3D::GridUniform3D() {} GridUniform3D::GridUniform3D(const int& i_start_input, const int& j_start_input, const int& k_start_input, const int& i_res_input, const int& j_res_input, const int& k_res_input, const T& x_min_input, const T& y_min_input, const T& z_min_input, const T& x_max_input, const T& y_max_input, const T& z_max_input) { initialize(i_start_input, j_start_input, k_start_input, i_res_input, j_res_input, k_res_input, x_min_input, y_min_input, z_min_input, x_max_input, y_max_input, z_max_input); } GridUniform3D::GridUniform3D(const TV_INT& ijk_start_input, const TV_INT& ijk_res_input, const TV& xyz_min_input, const TV& xyz_max_input) { initialize(ijk_start_input.i_, ijk_start_input.j_, ijk_start_input.k_, ijk_res_input.i_, ijk_res_input.j_, ijk_res_input.k_, xyz_min_input.x_, xyz_min_input.y_, xyz_min_input.z_, xyz_max_input.x_, xyz_max_input.y_, xyz_max_input.z_); } GridUniform3D::GridUniform3D(const GridUniform3D& grid_input) { initialize(grid_input.i_start_, grid_input.j_start_, grid_input.k_start_, grid_input.i_res_, grid_input.j_res_, grid_input.k_res_, grid_input.x_min_, grid_input.y_min_, grid_input.z_min_, grid_input.x_max_, grid_input.y_max_, grid_input.z_max_); } GridUniform3D::GridUniform3D(const BOX_3D<T>& bb, const TV_INT& res) { initialize(0, 0, 0, res.x_, res.y_, res.z_, bb.x_min_, bb.y_min_, bb.z_min_, bb.x_max_, bb.y_max_, bb.z_max_); } GridUniform3D::~GridUniform3D(void) {} void GridUniform3D::initialize(const int& i_start_input, const int& j_start_input, const int& k_start_input, const int& i_res_input, const int& j_res_input, const int& k_res_input, const T& x_min_input, const T& y_min_input, const T& z_min_input, const T& x_max_input, const T& y_max_input, const T& z_max_input) { i_start_ = i_start_input; j_start_ = j_start_input; k_start_ = k_start_input; i_res_ = i_res_input; j_res_ = j_res_input; k_res_ = k_res_input; x_min_ = x_min_input; y_min_ = y_min_input; z_min_ = z_min_input; x_max_ = x_max_input; y_max_ = y_max_input; z_max_ = z_max_input; i_end_ = i_start_ + i_res_ - 1; j_end_ = j_start_ + j_res_ - 1; k_end_ = k_start_ + k_res_ - 1; dx_ = (x_max_ - x_min_) / (T)i_res_; dy_ = (y_max_ - y_min_) / (T)j_res_; dz_ = (z_max_ - z_min_) / (T)k_res_; one_over_dx_ = (T)1 / dx_; one_over_dy_ = (T)1 / dy_; one_over_dz_ = (T)1 / dz_; one_over_2dx_ = (T)0.5 / dx_; one_over_2dy_ = (T)0.5 / dy_; one_over_2dz_ = (T)0.5 / dz_; ij_res_ = i_res_*j_res_; ijk_res_ = ij_res_*k_res_; } void GridUniform3D::initialize(const TV_INT& start_input, const TV_INT& res_input, const TV& min_input, const TV& max_input) { initialize(start_input.i_, start_input.j_, start_input.k_, res_input.i_, res_input.j_, res_input.k_, min_input.x_, min_input.y_, min_input.z_, max_input.x_, max_input.y_, max_input.z_); } void GridUniform3D::initialize(const GridUniform3D& grid_input) { initialize(grid_input.i_start_, grid_input.j_start_, grid_input.k_start_, grid_input.i_res_, grid_input.j_res_, grid_input.k_res_, grid_input.x_min_, grid_input.y_min_, grid_input.z_min_, grid_input.x_max_, grid_input.y_max_, grid_input.z_max_); } void GridUniform3D::InitializeDualGrid(GridUniform3D& dual_grid_input) { dual_grid_input.initialize(i_start_, j_start_, k_start_, i_res_ - 1, j_res_ - 1, k_res_ - 1, x_min_ + (T)0.5*dx_, y_min_ + (T)0.5*dy_, z_min_ + (T)0.5*dz_, x_max_ - (T)0.5*dx_, y_max_ - (T)0.5*dy_, z_max_ - (T)0.5*dz_); } void GridUniform3D::initialize(const GridUniform3D& grid_input, const T& resolution_scale) { initialize(grid_input.i_start_, grid_input.j_start_, grid_input.k_start_, (int)((T)grid_input.i_res_*resolution_scale), (int)((T)grid_input.j_res_*resolution_scale), (int)((T)grid_input.k_res_*resolution_scale), grid_input.x_min_, grid_input.y_min_, grid_input.z_min_, grid_input.x_max_, grid_input.y_max_, grid_input.z_max_); } void GridUniform3D::initialize(const GridUniform3D& grid_input, const TV_INT& resolution_scale) { initialize(grid_input.i_start_, grid_input.j_start_, grid_input.k_start_, grid_input.i_res_*resolution_scale.x_, grid_input.j_res_*resolution_scale.y_, grid_input.k_res_*resolution_scale.z_, grid_input.x_min_, grid_input.y_min_, grid_input.z_min_, grid_input.x_max_, grid_input.y_max_, grid_input.z_max_); } void GridUniform3D::initialize(const BOX& box_input, const int& max_res) { const TV edge_length = box_input.GetEdgeLengths(); if (edge_length.z_ >= edge_length.x_ && edge_length.z_ >= edge_length.y_) { const int z_res = max_res; const T dz = edge_length.z_ / (T)z_res; const int y_res = (int)ceil(edge_length.y_ / dz); const int x_res = (int)ceil(edge_length.x_ / dz); const TV corrected_max(box_input.x_min_ + (T)x_res*dz, box_input.y_min_ + (T)y_res*dz, box_input.z_min_ + (T)z_res*dz); // to make dx_ = dy_ = dz_ initialize(0, 0, 0, x_res, y_res, z_res, box_input.x_min_, box_input.y_min_, box_input.z_min_, corrected_max.x_, corrected_max.y_, corrected_max.z_); } else if (edge_length.y_ >= edge_length.x_) { const int y_res = max_res; const T dy = edge_length.y_ / (T)y_res; const int z_res = (int)ceil(edge_length.z_ / dy); const int x_res = (int)ceil(edge_length.x_ / dy); const TV corrected_max(box_input.x_min_ + (T)x_res*dy, box_input.y_min_ + (T)y_res*dy, box_input.z_min_ + (T)z_res*dy); // to make dx_ = dy_ = dz_ initialize(0, 0, 0, x_res, y_res, z_res, box_input.x_min_, box_input.y_min_, box_input.z_min_, corrected_max.x_, corrected_max.y_, corrected_max.z_); } else { const int x_res = max_res; const T dx = edge_length.x_ / (T)x_res; const int z_res = (int)ceil(edge_length.z_ / dx); const int y_res = (int)ceil(edge_length.y_ / dx); const TV corrected_max(box_input.x_min_ + (T)x_res*dx, box_input.y_min_ + (T)y_res*dx, box_input.z_min_ + (T)z_res*dx); // to make dx_ = dy_ = dz_ initialize(0, 0, 0, x_res, y_res, z_res, box_input.x_min_, box_input.y_min_, box_input.z_min_, corrected_max.x_, corrected_max.y_, corrected_max.z_); } } void GridUniform3D::initialize(const BOX& box_input, const T& dx_input) { const TV edge_length = box_input.GetEdgeLengths(); const int x_res = (int)ceil(edge_length.x_ / dx_input); const int y_res = (int)ceil(edge_length.y_ / dx_input); const int z_res = (int)ceil(edge_length.z_ / dx_input); const TV corrected_max(box_input.x_min_ + (T)x_res*dx_input, box_input.y_min_ + (T)y_res*dx_input, box_input.z_min_ + (T)z_res*dx_input); // to make dx_ = dy_ = dz_ initialize(0, 0, 0, x_res, y_res, z_res, box_input.x_min_, box_input.y_min_, box_input.z_min_, corrected_max.x_, corrected_max.y_, corrected_max.z_); } void GridUniform3D::initialize(const BOX& box_input, const int& i_res, const int& j_res, const int& k_res) { initialize(0, 0, 0, i_res, j_res, k_res, box_input.x_min_, box_input.y_min_, box_input.z_min_, box_input.x_max_, box_input.y_max_, box_input.z_max_); } // void InitializeFromBlock(const SCRIPT_BLOCK& block) // { // const T resolution_scale = block.GetFloat("resolution_scale", (T)1); // const TV_INT start = block.GetInt3("start_indices"); // const TV_INT res = block.GetInt3("base_grid_resolution"); // const TV_INT res_scaled((int)((T)res.x_*resolution_scale), (int)((T)res.y_*resolution_scale), (int)((T)res.z_*resolution_scale)); // const TV min = block.GetVector3("base_grid_min"); // const TV max = block.GetVector3("base_grid_max"); // // Initialize(start.i_, start.j_, start.k_, res_scaled.i_, res_scaled.j_, res_scaled.k_, min.i_, min.j_, min.k_, max.i_, max.j_, max.k_); // } void GridUniform3D::scaleRes(const T scale) { initialize(i_start_, j_start_, k_start_, (int)((T)i_res_*scale), (int)((T)j_res_*scale), (int)((T)k_res_*scale), x_min_, y_min_, z_min_, x_max_, y_max_, z_max_); } GridUniform3D GridUniform3D::getPartialGrid(const BOX_3D<int>& partial_ix_box) const { const TV partial_min = getCellMin(partial_ix_box.i_start_, partial_ix_box.j_start_, partial_ix_box.k_start_); const TV partial_max = getCellMin(partial_ix_box.i_end_, partial_ix_box.j_end_, partial_ix_box.k_end_); return GridUniform3D(partial_ix_box.i_start_, partial_ix_box.j_start_, partial_ix_box.k_start_, partial_ix_box.i_end_ - partial_ix_box.i_start_ + 1, partial_ix_box.j_end_ - partial_ix_box.j_start_ + 1, partial_ix_box.k_end_ - partial_ix_box.k_start_ + 1, partial_min.x_, partial_min.y_, partial_min.z_, partial_max.x_, partial_max.y_, partial_max.z_); } TV_INT GridUniform3D::getClampedIndex(const int& i, const int& j, const int& k) const { return TV_INT(CLAMP(i, i_start_, i_end_), CLAMP(j, j_start_, j_end_), CLAMP(k, k_start_, k_end_)); } TV_INT GridUniform3D::getClampedIndex(const TV_INT& ix) const { return TV_INT(CLAMP(ix.i_, i_start_, i_end_), CLAMP(ix.j_, j_start_, j_end_), CLAMP(ix.k_, k_start_, k_end_)); } void GridUniform3D::getClampStartEndIndices(int& l_start, int& m_start, int& n_start, int& l_end, int& m_end, int& n_end) { l_start = MAX2(l_start, i_start_); m_start = MAX2(m_start, j_start_); n_start = MAX2(n_start, k_start_); l_end = MIN2(l_end, i_end_); m_end = MIN2(m_end, j_end_); n_end = MIN2(n_end, k_end_); } int GridUniform3D::get1DIndex(const int& i, const int& j, const int& k) const { return (i - i_start_) + (j - j_start_)*i_res_ + (k - k_start_)*i_res_*j_res_; } TV_INT GridUniform3D::get3DIndex(const int& index_1d) const { const int n = index_1d / ij_res_; const int n_ij_res = n*ij_res_; const int m = (index_1d - n_ij_res) / i_res_; const int l = index_1d - i_res_*m - n_ij_res; return TV_INT(l, m, n); } int GridUniform3D::getClampedIndexI(const int& i) const { return CLAMP(i, i_start_, i_end_); } int GridUniform3D::getClampedIndexJ(const int& j) const { return CLAMP(j, j_start_, j_end_); } int GridUniform3D::getClampedIndexK(const int& k) const { return CLAMP(k, k_start_, k_end_); } TV GridUniform3D::getCellCenter(const int& i, const int& j, const int& k) const { return TV(x_min_ + ((T)0.5 + (T)(i - i_start_))*dx_, y_min_ + ((T)0.5 + (T)(j - j_start_))*dy_, z_min_ + ((T)0.5 + (T)(k - k_start_))*dz_); } TV GridUniform3D::getCellCenter(const TV_INT& ix) const { return TV(x_min_ + ((T)0.5 + (T)(ix.i_ - i_start_))*dx_, y_min_ + ((T)0.5 + (T)(ix.j_ - j_start_))*dy_, z_min_ + ((T)0.5 + (T)(ix.k_ - k_start_))*dz_); } void GridUniform3D::getCenter(const int& i, const int& j, const int& k, TV& position) { position.x_ = x_min_ + ((T)0.5 + (T)(i - i_start_))*dx_; position.y_ = y_min_ + ((T)0.5 + (T)(j - j_start_))*dy_; position.z_ = z_min_ + ((T)0.5 + (T)(k - k_start_))*dz_; } void GridUniform3D::getCenter(const TV_INT& ix, TV& position) const { position.x_ = x_min_ + ((T)0.5 + (T)(ix.i_ - i_start_))*dx_; position.y_ = y_min_ + ((T)0.5 + (T)(ix.j_ - j_start_))*dy_; position.z_ = z_min_ + ((T)0.5 + (T)(ix.k_ - k_start_))*dz_; } TV_INT GridUniform3D::getCell(const TV& position) const // return a cell index contains the position { return TV_INT(i_start_ + (int)(floor((position.x_ - x_min_)*one_over_dx_)), j_start_ + (int)(floor((position.y_ - y_min_)*one_over_dy_)), k_start_ + (int)(floor((position.z_ - z_min_)*one_over_dz_))); } void GridUniform3D::getCell(const TV& position, TV_INT& index) const // return a cell index contains the position { index.i_ = i_start_ + (int)(floor((position.x_ - x_min_)*one_over_dx_)); index.j_ = j_start_ + (int)(floor((position.y_ - y_min_)*one_over_dy_)); index.k_ = k_start_ + (int)(floor((position.z_ - z_min_)*one_over_dz_)); } void GridUniform3D::getCell(const TV& position, int& i, int& j, int& k) const // return a cell index contains the position { i = i_start_ + (int)(floor((position.x_ - x_min_)*one_over_dx_)); j = j_start_ + (int)(floor((position.y_ - y_min_)*one_over_dy_)); k = k_start_ + (int)(floor((position.z_ - z_min_)*one_over_dz_)); assert(i >= i_start_ && i <= i_end_); assert(j >= j_start_ && j <= j_end_); assert(k >= k_start_ && k <= k_end_); } void GridUniform3D::getCell(const T& x, const T& y, const T& z, int& i, int& j, int& k) const // return a cell index contains the position { i = i_start_ + (int)(floor((x - x_min_)*one_over_dx_)); j = j_start_ + (int)(floor((y - y_min_)*one_over_dy_)); k = k_start_ + (int)(floor((z - z_min_)*one_over_dz_)); assert(i >= i_start_ && i <= i_end_); assert(j >= j_start_ && j <= j_end_); assert(k >= k_start_ && k <= k_end_); } TV_INT GridUniform3D::getClampedCell(const TV& position) const { TV_INT index(i_start_ + (int)(floor((position.x_ - x_min_)*one_over_dx_)), j_start_ + (int)(floor((position.y_ - y_min_)*one_over_dy_)), k_start_ + (int)(floor((position.z_ - z_min_)*one_over_dz_))); index.i_ = CLAMP(index.i_, i_start_, i_end_); index.j_ = CLAMP(index.j_, j_start_, j_end_); index.k_ = CLAMP(index.k_, k_start_, k_end_); return index; } void GridUniform3D::getClampedCell(const TV& position, TV_INT& index) const { index.assign(i_start_ + (int)floor((position.x_ - x_min_)*one_over_dx_), j_start_ + (int)floor((position.y_ - y_min_)*one_over_dy_), k_start_ + (int)floor((position.z_ - z_min_)*one_over_dz_)); index.i_ = CLAMP(index.i_, i_start_, i_end_); index.j_ = CLAMP(index.j_, j_start_, j_end_); index.k_ = CLAMP(index.k_, k_start_, k_end_); } void GridUniform3D::getClampedCell(const TV& position, int& i, int& j, int& k) const { i = i_start_ + (int)floor((position.x_ - x_min_)*one_over_dx_); j = j_start_ + (int)floor((position.y_ - y_min_)*one_over_dy_); k = k_start_ + (int)floor((position.z_ - z_min_)*one_over_dz_); assert(i_start_ < i_end_); assert(j_start_ < j_end_); assert(k_start_ < k_end_); if (i < i_start_) i = i_start_; else if (i > i_end_) i = i_end_; if (j < j_start_) j = j_start_; else if (j > j_end_) j = j_end_; if (k < k_start_) k = k_start_; else if (k > k_end_) k = k_end_; } TV_INT GridUniform3D::getLeftBottomCell(const TV& position) const //TODO check performance compared to no return value functions. { return TV_INT(i_start_ + (int)floor((position.x_ - x_min_)*one_over_dx_ - (T)0.5), j_start_ + (int)floor((position.y_ - y_min_)*one_over_dy_ - (T)0.5), k_start_ + (int)floor((position.z_ - z_min_)*one_over_dz_ - (T)0.5)); } TV_INT GridUniform3D::getRightTopCell(const TV& position) const { return TV_INT(i_start_ + (int)floor((position.x_ - x_min_)*one_over_dx_ + (T)0.5), j_start_ + (int)floor((position.y_ - y_min_)*one_over_dy_ + (T)0.5), k_start_ + (int)floor((position.z_ - z_min_)*one_over_dz_ + (T)0.5)); } void GridUniform3D::getLeftBottomCell(const TV& position, int& i, int& j, int& k) const { i = i_start_ + (int)floor((position.x_ - x_min_)*one_over_dx_ - (T)0.5); j = j_start_ + (int)floor((position.y_ - y_min_)*one_over_dy_ - (T)0.5); k = k_start_ + (int)floor((position.z_ - z_min_)*one_over_dz_ - (T)0.5); } void GridUniform3D::getLeftBottomCell(const T& x, const T& y, const T& z, int& i, int& j, int& k) const { i = i_start_ + (int)floor((x - x_min_)*one_over_dx_ - (T)0.5); j = j_start_ + (int)floor((y - y_min_)*one_over_dy_ - (T)0.5); k = k_start_ + (int)floor((z - z_min_)*one_over_dz_ - (T)0.5); } void GridUniform3D::getLeftBottomCell(const TV& position, TV_INT& ix) const { return getLeftBottomCell(position, ix.i_, ix.j_, ix.k_); } bool GridUniform3D::isInside(const TV& position) const { if (position.x_ <= x_min_) return false; else if (position.x_ >= x_max_) return false; else if (position.y_ <= y_min_) return false; else if (position.y_ >= y_max_) return false; else if (position.z_ <= z_min_) return false; else if (position.z_ >= z_max_) return false; return true; } bool GridUniform3D::isInside(const TV& position, const T& width) const { if (position.x_ <= x_min_ + width) return false; else if (position.x_ >= x_max_ - width) return false; else if (position.y_ <= y_min_ + width) return false; else if (position.y_ >= y_max_ - width) return false; else if (position.z_ <= z_min_ + width) return false; else if (position.z_ >= z_max_ - width) return false; return true; } bool GridUniform3D::isInside(const int& i, const int& j, const int& k) const { if (i < i_start_) return false; else if (i > i_end_) return false; else if (j < j_start_) return false; else if (j > j_end_) return false; else if (k < k_start_) return false; else if (k > k_end_) return false; else return true; } bool GridUniform3D::isInside(const TV_INT& ix) const { if (ix.i_ < i_start_) return false; else if (ix.i_ > i_end_) return false; else if (ix.j_ < j_start_) return false; else if (ix.j_ > j_end_) return false; else if (ix.k_ < k_start_) return false; else if (ix.k_ > k_end_) return false; else return true; } bool GridUniform3D::isInside(const TV_INT& ix, const int& inner_width) const { if (ix.i_ < i_start_ + inner_width) return false; else if (ix.i_ > i_end_ - inner_width) return false; else if (ix.j_ < j_start_ + inner_width) return false; else if (ix.j_ > j_end_ - inner_width) return false; else if (ix.k_ < k_start_ + inner_width) return false; else if (ix.k_ > k_end_ - inner_width) return false; else return true; } bool GridUniform3D::isInsideI(const int & i) // check if i_start_ <= i <= i_end_ { if (i < i_start_) return false; else if (i > i_end_) return false; return true; } bool GridUniform3D::isInsideJ(const int & j) // check if j_start_ <= j <= j_end_ { if (j < j_start_) return false; else if (j > j_end_) return false; return true; } bool GridUniform3D::isInsideK(const int & k) // check if k_start_ <= k <= k_end_ { if (k < k_start_) return false; else if (k > k_end_) return false; return true; } GridUniform3D GridUniform3D::getCellGrid() const // returns cell grid when this is a node grid { return GridUniform3D(i_start_, j_start_, k_start_, i_res_ - 1, j_res_ - 1, k_res_ - 1, x_min_ + (T)0.5*dx_, y_min_ + (T)0.5*dy_, z_min_ + (T)0.5*dz_, x_max_ - (T)0.5*dx_, y_max_ - (T)0.5*dy_, z_max_ - (T)0.5*dz_); } GridUniform3D GridUniform3D::getUFaceGrid() const { return GridUniform3D(i_start_, j_start_, k_start_, i_res_ + 1, j_res_, k_res_, x_min_ - (T)0.5*dx_, y_min_, z_min_, x_max_ + (T)0.5*dx_, y_max_, z_max_); } GridUniform3D GridUniform3D::getVFaceGrid() const { return GridUniform3D(i_start_, j_start_, k_start_, i_res_, j_res_ + 1, k_res_, x_min_, y_min_ - (T)0.5*dy_, z_min_, x_max_, y_max_ + (T)0.5*dy_, z_max_); } GridUniform3D GridUniform3D::getWFaceGrid() const { return GridUniform3D(i_start_, j_start_, k_start_, i_res_, j_res_, k_res_ + 1, x_min_, y_min_, z_min_ - (T)0.5*dz_, x_max_, y_max_, z_max_ + (T)0.5*dz_); } GridUniform3D GridUniform3D::getXEdgeGrid() const { return GridUniform3D(i_start_, j_start_, k_start_, i_res_, j_res_ + 1, k_res_ + 1, x_min_, y_min_ - (T)0.5*dy_, z_min_ - (T)0.5*dz_, x_max_, y_max_ + (T)0.5*dy_, z_max_ + (T)0.5*dz_); } GridUniform3D GridUniform3D::getYEdgeGrid() const { return GridUniform3D(i_start_, j_start_, k_start_, i_res_ + 1, j_res_, k_res_ + 1, x_min_ - (T)0.5*dx_, y_min_, z_min_ - (T)0.5*dz_, x_max_ + (T)0.5*dx_, y_max_, z_max_ + (T)0.5*dz_); } GridUniform3D GridUniform3D::getZEdgeGrid() const { return GridUniform3D(i_start_, j_start_, k_start_, i_res_ + 1, j_res_ + 1, k_res_, x_min_ - (T)0.5*dx_, y_min_ - (T)0.5*dy_, z_min_, x_max_ + (T)0.5*dx_, y_max_ + (T)0.5*dy_, z_max_); } GridUniform3D GridUniform3D::getEnlarged(const int& width) const { return GridUniform3D(i_start_ - width, j_start_ - width, k_start_ - width, i_res_ + 2 * width, j_res_ + 2 * width, k_res_ + 2 * width, x_min_ - (T)width*dx_, y_min_ - (T)width*dy_, z_min_ - (T)width*dz_, x_max_ + (T)width*dx_, y_max_ + (T)width*dy_, z_max_ + (T)width*dz_); } void GridUniform3D::enlarge(const int& width) { initialize(i_start_ - width, j_start_ - width, k_start_ - width, i_res_ + 2 * width, j_res_ + 2 * width, k_res_ + 2 * width, x_min_ - (T)width*dx_, y_min_ - (T)width*dy_, z_min_ - (T)width*dz_, x_max_ + (T)width*dx_, y_max_ + (T)width*dy_, z_max_ + (T)width*dz_); } void GridUniform3D::operator = (const GridUniform3D& grid_input) { initialize(grid_input); } void GridUniform3D::translate(const TV& deviation) { x_min_ += deviation.x_; y_min_ += deviation.y_; z_min_ += deviation.z_; x_max_ += deviation.x_; y_max_ += deviation.y_; z_max_ += deviation.z_; } void GridUniform3D::scaleToBox(const BOX& box) { TV_INT ix_min = getClampedCell(box.GetMin()); TV_INT ix_max = getClampedCell(box.GetMax()); ix_min = getClampedIndex(ix_min - TV_INT(2, 2, 2)); ix_max = getClampedIndex(ix_max + TV_INT(2, 2, 2)); TV cell_center_min = getCellCenter(ix_min); TV cell_center_max = getCellCenter(ix_max); i_start_ = ix_min.i_; j_start_ = ix_min.j_; k_start_ = ix_min.k_; i_end_ = ix_max.i_; j_end_ = ix_max.j_; k_end_ = ix_max.k_; x_min_ = cell_center_min.x_ - dx_*(T)0.5; y_min_ = cell_center_min.y_ - dy_*(T)0.5; z_min_ = cell_center_min.z_ - dz_*(T)0.5; x_max_ = cell_center_max.x_ + dx_*(T)0.5; y_max_ = cell_center_max.y_ + dy_*(T)0.5; z_max_ = cell_center_max.z_ + dz_*(T)0.5; } int GridUniform3D::getNumAllCells() const { return i_res_ * j_res_ * k_res_; } bool GridUniform3D::operator == (const GridUniform3D& grid) // for debugging only (not optimized) { for (int d = 0; d < 3; ++d) { if (res_[d] != grid.res_[d]) return false; if (ix_start_[d] != grid.ix_start_[d]) return false; if (ix_end_[d] != grid.ix_end_[d]) return false; if (min_[d] != grid.min_[d]) return false; if (max_[d] != grid.max_[d]) return false; } return true; } TV GridUniform3D::getMin() const { return TV(x_min_, y_min_, z_min_); } TV GridUniform3D::getMax() const { return TV(x_max_, y_max_, z_max_); } BOX_3D<int> GridUniform3D::getIXBox() const { return BOX_3D<int>(i_start_, j_start_, k_start_, i_end_, j_end_, k_end_); } BOX_3D<T> GridUniform3D::getMimMax() const { return BOX_3D<T>(getMin(), getMax()); } TV GridUniform3D::getCellMin(const int& i, const int& j, const int& k) const { const TV center = getCellCenter(i, j, k); return TV(center.x_ - 0.5f*dx_, center.y_ - 0.5f*dy_, center.z_ - 0.5f*dz_); } TV GridUniform3D::getCellMax(const int& i, const int& j, const int& k) const { const TV center = getCellCenter(i, j, k); return TV(center.x_ + 0.5f*dx_, center.y_ + 0.5f*dy_, center.z_ + 0.5f*dz_); } BOX_3D<T> GridUniform3D::getCellMinMax(const int& i, const int& j, const int& k) const { return BOX_3D<T>(getCellMin(i, j, k), getCellMax(i, j, k)); } void GridUniform3D::extend(const int width) { initialize(i_start_ - width, j_start_ - width, k_start_ - width, i_res_ + 2 * width, j_res_ + 2 * width, k_res_ + 2 * width, x_min_ - (T)width*dx_, y_min_ - (T)width*dy_, z_min_ - (T)width*dz_, x_max_ + (T)width*dx_, y_max_ + (T)width*dy_, z_max_ + (T)width*dz_); } void GridUniform3D::splitInMaxDirection(const int& num_threads, Array1D<GridUniform3D>& partial_grids) { // give priority to z and y direction in order to utilize the memory coherency if(num_threads <= k_res_) splitInZDirection(num_threads, partial_grids); else if(k_res_ >= j_res_ && k_res_ >= i_res_) splitInZDirection(num_threads, partial_grids); else if(j_res_ >= i_res_) splitInYDirection(num_threads, partial_grids); else splitInXDirection(num_threads, partial_grids); } void GridUniform3D::splitInXDirection(const int& num_threads, Array1D<GridUniform3D>& partial_grids) { partial_grids.initialize(num_threads); const int quotient = i_res_/num_threads; const int remainder = i_res_%num_threads; int i_start_p = i_start_; T x_min_p = x_min_; for(int t = 0; t < num_threads; t++) { const int i_res_p = (t < remainder) ? (quotient + 1) : (quotient); const T x_max_p = dx_*(T)i_res_p + x_min_p; partial_grids[t].initialize(i_start_p, j_start_, k_start_, i_res_p, j_res_, k_res_, x_min_p, y_min_, z_min_, x_max_p, y_max_, z_max_); i_start_p += i_res_p; x_min_p = x_max_p; } } void GridUniform3D::splitInYDirection(const int& num_threads, Array1D<GridUniform3D>& partial_grids) { partial_grids.initialize(num_threads); const int quotient = j_res_/num_threads; const int remainder = j_res_%num_threads; int j_start_p = j_start_; T y_min_p = y_min_; for(int t = 0; t < num_threads; t++) { const int j_res_p = (t < remainder) ? (quotient + 1) : (quotient); const T y_max_p = dy_*(T)j_res_p + y_min_p; partial_grids[t].initialize(i_start_, j_start_p, k_start_, i_res_, j_res_p, k_res_, x_min_, y_min_p, z_min_, x_max_, y_max_p, z_max_); j_start_p += j_res_p; y_min_p = y_max_p; } } void GridUniform3D::splitInZDirection(const int& num_threads, Array1D<GridUniform3D>& partial_grids) { partial_grids.initialize(num_threads); const int quotient = k_res_/num_threads; const int remainder = k_res_%num_threads; int k_start_p = k_start_; T z_min_p = z_min_; for(int t = 0; t < num_threads; t++) { const int k_res_p = (t < remainder) ? (quotient + 1) : (quotient); const T z_max_p = dz_*(T)k_res_p + z_min_p; partial_grids[t].initialize(i_start_, j_start_, k_start_p, i_res_, j_res_, k_res_p, x_min_, y_min_, z_min_p, x_max_, y_max_, z_max_p); k_start_p += k_res_p; z_min_p = z_max_p; } } void GridUniform3D::splitInZDirectionPartially(const int& num_threads, Array1D<GridUniform3D>& partial_grids) { partial_grids.initialize(num_threads); int i_idx = i_end_ - i_start_ + 1; int j_idx = j_end_ - j_start_ + 1; int k_idx = k_end_ - k_start_ + 1; const int quotient = k_idx / num_threads; const int remainder = k_idx % num_threads; int k_start_p = k_start_; T z_min_p = z_min_; for(int t = 0; t < num_threads; t++) { const int k_res_p = (t < remainder) ? (quotient + 1) : (quotient); const T z_max_p = dz_*(T)k_res_p + z_min_p; partial_grids[t].initialize(i_start_, j_start_, k_start_p, i_idx, j_idx, k_res_p, x_min_, y_min_, z_min_p, x_max_, y_max_, z_max_p); k_start_p += k_res_p; z_min_p = z_max_p; } } int GridUniform3D::recommendMaxMultigridLevel(const int& lowest_level_res) { int min_res = MIN3(i_res_, j_res_, k_res_); int max_level = 0; while(true)// find max_evel { max_level++; min_res /= 2; if(min_res < lowest_level_res) break; } return max_level; } T GridUniform3D::getTrilinearWeight(const TV& deviation) const { // assert ( (T)1 - ABS(deviation.x_) * one_over_dx_ >= (T)0) // assert ( (T)1 - ABS(deviation.x_) * one_over_dx_ <= (T)1) return MAX2((T)0, ((T)1 - ABS(deviation.x_) * one_over_dx_) * ((T)1 - ABS(deviation.y_) * one_over_dy_) * ((T)1 - ABS(deviation.z_) * one_over_dz_)); }
38.134078
235
0.693671
[ "3d" ]
d2edd72704d13a272d26b9dceae3dea627909f5d
25,301
cpp
C++
MeshTools/FECVDDecimationModifier.cpp
chunkeey/FEBioStudio
f342d4ac2bc3581db792373c4265454109af92b3
[ "MIT" ]
null
null
null
MeshTools/FECVDDecimationModifier.cpp
chunkeey/FEBioStudio
f342d4ac2bc3581db792373c4265454109af92b3
[ "MIT" ]
null
null
null
MeshTools/FECVDDecimationModifier.cpp
chunkeey/FEBioStudio
f342d4ac2bc3581db792373c4265454109af92b3
[ "MIT" ]
null
null
null
/*This file is part of the FEBio Studio source code and is licensed under the MIT license listed below. See Copyright-FEBio-Studio.txt for details. Copyright (c) 2020 University of Utah, The Trustees of Columbia University in the City of New York, and others. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.*/ #include "stdafx.h" #include "FECVDDecimationModifier.h" #include <MeshLib/FENodeFaceList.h> #include <MeshLib/FENodeNodeList.h> #include "FEFillHole.h" #include <GeomLib/GObject.h> #include <MeshLib/MeshMetrics.h> #include <MeshLib/MeshTools.h> #include <MeshLib/FESurfaceMesh.h> #include "FEFixMesh.h" #include <algorithm> #include <stack> //----------------------------------------------------------------------------- //! Constructor FECVDDecimationModifier::FECVDDecimationModifier() : FESurfaceModifier("CVD Decimation") { AddDoubleParam(0.1, "scale", "scale"); m_gradient = 0.0; m_bcvd = false; } //----------------------------------------------------------------------------- // We need a simple random number generator for creating the seeds. The C rand() // function won't do since it only generates numbers less than 32K. int randi(int nmax) { static unsigned int nseed = 47856987; nseed = 789789812*nseed + 38569741 + rand(); return (int)(nseed%nmax); } //----------------------------------------------------------------------------- //! Create the decimate mesh. //! \todo This implementation will only work with closed surfaces. FESurfaceMesh* FECVDDecimationModifier::Apply(FESurfaceMesh* pm) { // make sure this is a triangle mesh if (pm->IsType(FE_FACE_TRI3) == false) { FESurfaceModifier::SetError("Invalid mesh type"); return 0; } // some sanity checks if (MeshTools::IsMeshClosed(*pm) == false) { FESurfaceModifier::SetError("Mesh is not closed."); return 0; } // do the initialization if (Initialize(pm) == false) return 0; // Minimize energy if (Minimize(pm) == false) return 0; // create the new mesh // we can create either the clustered mesh or the final decimated mesh FESurfaceMesh* pnew = 0; if (m_bcvd) { // partition mesh based on cluster assingments pnew = CalculateCVD(pm); } else { // triangulate the decimation pnew = Triangulate2(pm); // make sure we have a mesh if (pnew == 0) return 0; // next, we use the auto-mesher to reconstruct all faces, edges and nodes pnew->RebuildMesh(); FEFixMesh fix; // TODO: I noticed that this algorithm can create duplicate elements. I'm not sure yet if // this is a bug or if there is something fishy about this algorithm. In any case, // for now I will explicitly check for duplicate elements and remove duplicates. Even // this may not fix all problems, since sometimes duplicate elements can have different // winding. // remove duplicate faces fix.RemoveDuplicateFaces(pnew); // TODO: Another problem I found is that some elements become non-manifold, meaning that // one or two edges don't have any neighbors. If the origianl mesh is closed, then // the decimated mesh must be closed as well. (Off course, this assumes that the original // mesh is closed. Perhaps I can find another criteria for non-manifold). fix.RemoveNonManifoldFaces(pnew); // TODO: Some elements can be wound in the wrong direction. So, we try to find those elements // and invert them. fix.FixElementWinding(pnew); // TODO: These operations can create holes in the mesh. therefore we fill all holes. FEFillHole fill; fill.FillAllHoles(pnew); } // All done! return pnew; } //----------------------------------------------------------------------------- //! This function initializes the CVD algorithm. Cluster data is allocated and //! initialized. We also build the edge list, that is the list with the boundary //! edges between clusters. //! \todo I need to create a better random seeding algorithm. If the scale is close //! to one, this algorithm may take a while to finish. bool FECVDDecimationModifier::Initialize(FESurfaceMesh* pm) { // nodes on original mesh int N0 = pm->Nodes(); // decimation percentage double pct = GetFloatValue(0); // target number of clusters/vertices int NC = (int) (pct*N0); if (NC < 4) NC = 4; // allocate cluster data // number of clusters equals number of target nodes // plus one, the "null" cluster m_Cluster.resize(NC + 1); // assign all triangles to the "null" cluster int T0 = pm->Faces(); m_tag.assign(T0, 0); // assign NC random triangles to a cluster // TODO: make a better algorithm int MAX_TRIES = 2*T0; int ntries = 0; int nc = 0; while (nc < NC) { int n = randi(T0); if (m_tag[n] == 0) m_tag[n] = ++nc; ntries++; if (ntries > MAX_TRIES) return FESurfaceModifier::SetError("Seeding failed"); } // calculate the "rho" value (here, the area) and gamma (centroid) for each face m_rho.resize(T0); m_gamma.resize(T0); vec3d r[3]; //Creating a node node list FENodeNodeList NNL(pm); for (int i=0; i<T0; ++i) { FEFace& fi = pm->Face(i); // get the nodal coordinates r[0] = pm->Node(fi.n[0]).r; r[1] = pm->Node(fi.n[1]).r; r[2] = pm->Node(fi.n[2]).r; // assign the centroid m_gamma[i] = (r[0] + r[1] + r[2]) / 3.0; // calculate rho m_rho[i] = area_triangle(r); // gradient weighting if (m_gradient > 0.0) { double curvature1 = 0; double curvature2 = 0; for (int j = 0; j < 3; j++) { //normal vector to the jth node of the face //step -1 vec3d p = fi.m_nn[j]; vec3d r0 = pm->Node(fi.n[j]).r; //step -2 vec3d r1 = vec3d(1.f - p.x*p.x, -p.y*p.x, -p.x*p.z); r1.Normalize(); vec3d r3 = p; vec3d r2 = r3 ^ r1; mat3d R; R[0][0] = r1.x; R[0][1] = r1.y; R[0][2] = r1.z; R[1][0] = r2.x; R[1][1] = r2.y; R[1][2] = r2.z; R[2][0] = r3.x; R[2][1] = r3.y; R[2][2] = r3.z; //step -3 int current_node = fi.n[j]; vector<vec3d> x; x.reserve(NNL.Valence(current_node)); for (int k = 0; k < NNL.Valence(current_node); k++) x.push_back(pm->Node(NNL.Node(current_node, k)).r); vector<vec3d> y; y.resize(x.size()); int nn = (int)x.size(); //step 4 // map coordinates for (int k = 0; k < nn; ++k) { vec3d tmp = x[k] - r0; y[k] = R * tmp; } //step 5 //Prepare linear system of equations. matrix RR(nn, 3); vector<double> r(nn); for (int k = 0; k < nn; ++k) { vec3d& p = y[k]; RR[k][0] = p.x*p.x; RR[k][1] = p.x*p.y; RR[k][2] = p.y*p.y; r[k] = p.z; } // solve for quadric coefficients vector<double> q(3); RR.lsq_solve(q, r); double a = q[0], b = q[1], c = q[2]; //step 6 //get the curvature double k1 = a + c + sqrt((a - c)*(a - c) + b * b); double k2 = a + c - sqrt((a - c)*(a - c) + b * b); curvature1 += k1; curvature2 += k2; } curvature1 /= 3.0; curvature2 /= 3.0; // calculate rho and gamma m_rho[i] *= pow(sqrt(curvature1 * curvature1 + curvature2 * curvature2), m_gradient); } // make sure rho is positive if (m_rho[i] <= 0.0) return FESurfaceModifier::SetError("Zero triangle area encountered"); } // now, calculate the sgamma and srho for each cluster for (int i=0; i<T0; ++i) { int nc = m_tag[i]; if (nc > 0) { m_Cluster[nc].m_srho += m_rho[i]; m_Cluster[nc].m_sgamma += m_gamma[i]*m_rho[i]; m_Cluster[nc].m_val++; } else m_Cluster[0].m_val++; } // build the edge list m_Edge.clear(); for (int i=0; i<T0; ++i) { FEFace& fi = pm->Face(i); for (int j=0; j<3; ++j) { int nj = fi.m_nbr[j]; // this algorithm currently only works with closed surfaces // so all neighbors must be assigned if (nj < 0) return FESurfaceModifier::SetError("Mesh is not closed"); if (m_tag[i] < m_tag[nj]) { EDGE e; e.face[0] = i; e.face[1] = nj; if (i == nj) return FESurfaceModifier::SetError("Invalid mesh connectivity"); e.node[0] = fi.n[j]; e.node[1] = fi.n[(j+1)%3]; m_Edge.push_back(e); } } } return true; } //----------------------------------------------------------------------------- // This function assigns face to a new cluster bool FECVDDecimationModifier::Swap(FEFace& face, int nface, int ncluster) { if (m_tag[nface] == ncluster) return false; int oldCluster = m_tag[nface]; m_tag[nface] = ncluster; // make sure the cluster will not dissappear if ((oldCluster != 0) && (m_Cluster[oldCluster].m_val == 1)) return true; m_Cluster[oldCluster].m_val--; assert((oldCluster == 0) || (m_Cluster[oldCluster].m_val > 0)); assert(m_Cluster[oldCluster].m_val >= 0); m_Cluster[ncluster].m_val++; for (int j=0; j<3; ++j) { int nj = face.m_nbr[j]; assert(nj >= 0); if (m_tag[nj] == oldCluster) { EDGE ed; ed.face[0] = nface; ed.face[1] = nj; if (nface == nj) return false; ed.node[0] = face.n[j]; ed.node[1] = face.n[(j+1)%3]; m_Edge.push_front(ed); } } return true; } //----------------------------------------------------------------------------- //! Update clustering to minimize energy bool FECVDDecimationModifier::Minimize(FESurfaceMesh* pm) { bool bconv = false; const int MAX_ITER = 50000; int niter = 0; do { // let's be optimistic bconv = true; // loop over all edges list<EDGE>::iterator it; for (it = m_Edge.begin(); it != m_Edge.end();) { EDGE& e = *it; // faces int m = e.face[0]; int n = e.face[1]; assert(m != n); // clusters int k = m_tag[m]; int l = m_tag[n]; if (k == l) { it = m_Edge.erase(it); bconv = false; } else { Cluster& Ck = m_Cluster[k]; Cluster& Cl = m_Cluster[l]; // case 1 - no change double L1 = (Ck.m_sgamma*Ck.m_sgamma) / Ck.m_srho + (Cl.m_sgamma*Cl.m_sgamma) / Cl.m_srho; // case 2 - face m to Cl vec3d g0k = Ck.m_sgamma - m_gamma[m] * m_rho[m]; double r0k = Ck.m_srho - m_rho[m]; vec3d g0l = Cl.m_sgamma + m_gamma[m] * m_rho[m]; double r0l = Cl.m_srho + m_rho[m]; double L2 = (g0k*g0k) / r0k + (g0l*g0l) / r0l; // case 3 - face n to Ck vec3d g1k = Ck.m_sgamma + m_gamma[n] * m_rho[n]; double r1k = Ck.m_srho + m_rho[n]; vec3d g1l = Cl.m_sgamma - m_gamma[n] * m_rho[n]; double r1l = Cl.m_srho - m_rho[n]; double L3 = (g1k*g1k) / r1k + (g1l*g1l) / r1l; if ((k == 0) || ((l!=0) && (L2 > L1) && (L2 > L3))) { // case 2 wins Ck.m_srho = r0k; Ck.m_sgamma = g0k; Cl.m_srho = r0l; Cl.m_sgamma = g0l; if (Swap(pm->Face(m), m, l) == false) return FESurfaceModifier::SetError("Error during minimization"); else it = m_Edge.erase(it); bconv = false; } else if ((l == 0) || ((L3 > L1) && (L3 > L2))) { // case 3 wins Ck.m_srho = r1k; Ck.m_sgamma = g1k; Cl.m_srho = r1l; Cl.m_sgamma = g1l; if (Swap(pm->Face(n), n, k) == false) return FESurfaceModifier::SetError("Error during minimization"); else it = m_Edge.erase(it); bconv = false; } else { // case 1 wins // no change ++it; } } } if (bconv) { // In some cases, (really bad meshes) a few elements will not have // been assigned to a cluster. If this happens, we just return an // error and the user needs to clean up the mesh before decimating int NF = pm->Faces(); for (int i=0; i<NF; ++i) { if (m_tag[i] == 0) return FESurfaceModifier::SetError("Error during minimization");; } // build the cluster's fid array for (int i = 0; i < m_Cluster.size(); ++i) m_Cluster[i].m_fid.clear(); for (int i = 0; i < pm->Faces(); ++i) { Cluster& C = m_Cluster[m_tag[i]]; C.m_fid.push_back(i); } // check one-connectedness of clusters pm->TagAllFaces(-1); for (int i = 1; i < m_Cluster.size(); ++i) { Cluster& Ci = m_Cluster[i]; // keep track of components and max-area component int nc = 0; int imax = -1; double amax = 0.0; for (int j = 0; j < Ci.m_fid.size(); ++j) { int facej = Ci.m_fid[j]; if (pm->Face(facej).m_ntag == -1) { double am = 0.0; std::stack<int> S; S.push(facej); while (S.empty() == false) { int nface = S.top(); S.pop(); FEFace& face = pm->Face(nface); face.m_ntag = nc; am += m_rho[nface]; for (int k = 0; k < 3; ++k) { int nk = face.m_nbr[k]; if ((pm->Face(nk).m_ntag == -1) && (m_tag[nk] == i)) { pm->Face(nk).m_ntag = nc; S.push(nk); } } } if ((imax == -1) || (am > amax)) { imax = nc; amax = am; } nc++; } } if (nc > 1) { for (int j = 0; j < Ci.m_fid.size(); ++j) { int facej = Ci.m_fid[j]; if (pm->Face(facej).m_ntag != imax) { m_tag[facej] = 0; m_Cluster[0].m_val++; Ci.m_srho -= m_rho[facej]; Ci.m_sgamma -= m_gamma[facej] * m_rho[facej]; Ci.m_val--; } } bconv = false; } } } niter++; } while ((bconv == false)&&(niter < MAX_ITER)); if (niter >= MAX_ITER) return FESurfaceModifier::SetError("Error during minimization"); return true; } //----------------------------------------------------------------------------- bool FECVDDecimationModifier::NODE::AttachToCluster(int n) { for (int i=0; i<nc; ++i) { if (c[i] == n) return true; } if(nc>=MAX_CLUSTERS-1) return false; c[nc++] = n; return true; } //----------------------------------------------------------------------------- // TODO: The case n==6 has other ways to get tesselated. I only implemented a few FESurfaceMesh* FECVDDecimationModifier::Triangulate(FESurfaceMesh* pm) { int N = pm->Nodes(); vector<NODE> Node; Node.resize(N); for (int i=0; i<N; ++i) { Node[i].nc = 0; } FENodeFaceList NFL; NFL.BuildSorted(pm); for (int i=0; i<pm->Faces(); ++i) pm->Face(i).m_ntag = i; for (int i=0; i<N; ++i) { int nval = NFL.Valence(i); for (int j=0; j<nval; ++j) { if (Node[i].AttachToCluster(m_tag[NFL.Face(i, j)->m_ntag]) == false) return 0; } } // number of nodes equals number of clusters int nodes = (int) m_Cluster.size() - 1; // count the number of triangles int faces = 0; for (int i=0; i<N; ++i) { NODE& nd = Node[i]; if (nd.nc == 3) faces++; else if (nd.nc == 4) faces += 2; else if (nd.nc == 5) faces += 3; else if (nd.nc == 6) faces += 4; } // create a new mesh FESurfaceMesh* pnew = new FESurfaceMesh; pnew->Create(nodes, 0, faces); // calculate the node positions for (int i=0; i<nodes; ++i) { FENode& nd = pnew->Node(i); Cluster& Ci = m_Cluster[i+1]; assert(Ci.faces() > 0); nd.r = Ci.m_sgamma / Ci.m_srho; } // create the connectivity faces = 0; for (int i=0; i<N; ++i) { NODE& nd = Node[i]; if (nd.nc == 3) { FEFace& face = pnew->Face(faces++); face.SetType(FE_FACE_TRI3); face.n[0] = nd.c[0]-1; assert(nd.c[0] > 0); face.n[1] = nd.c[1]-1; assert(nd.c[1] > 0); face.n[2] = nd.c[2]-1; assert(nd.c[2] > 0); } else if (nd.nc == 4) { vec3d r[4]; r[0] = pnew->Node(nd.c[0]-1).r; r[1] = pnew->Node(nd.c[1]-1).r; r[2] = pnew->Node(nd.c[2]-1).r; r[3] = pnew->Node(nd.c[3]-1).r; vec3d ra0[3] = {r[0], r[1], r[2]}, ra1[3] = {r[2], r[3], r[0]}; double A0 = area_triangle(ra0); double A1 = area_triangle(ra1); double Amin = (A0 < A1 ? A0 : A1); vec3d rb0[3] = {r[3], r[0], r[1]}, rb1[3] = {r[1], r[2], r[3]}; double B0 = area_triangle(rb0); double B1 = area_triangle(rb1); double Bmin = (B0 < B1 ? B0 : B1); if (Amin >= Bmin) { FEFace& f0 = pnew->Face(faces++); f0.SetType(FE_FACE_TRI3); f0.n[0] = nd.c[0]-1; assert(nd.c[0] > 0); f0.n[1] = nd.c[1]-1; assert(nd.c[1] > 0); f0.n[2] = nd.c[2]-1; assert(nd.c[2] > 0); FEFace& f1 = pnew->Face(faces++); f1.SetType(FE_FACE_TRI3); f1.n[0] = nd.c[2]-1; assert(nd.c[2] > 0); f1.n[1] = nd.c[3]-1; assert(nd.c[3] > 0); f1.n[2] = nd.c[0]-1; assert(nd.c[0] > 0); } else { FEFace& f0 = pnew->Face(faces++); f0.SetType(FE_FACE_TRI3); f0.n[0] = nd.c[3]-1; assert(nd.c[3] > 0); f0.n[1] = nd.c[0]-1; assert(nd.c[0] > 0); f0.n[2] = nd.c[1]-1; assert(nd.c[1] > 0); FEFace& f1 = pnew->Face(faces++); f1.SetType(FE_FACE_TRI3); f1.n[0] = nd.c[1]-1; assert(nd.c[1] > 0); f1.n[1] = nd.c[2]-1; assert(nd.c[2] > 0); f1.n[2] = nd.c[3]-1; assert(nd.c[3] > 0); } } else if (nd.nc == 5) { vec3d r[5]; r[0] = pnew->Node(nd.c[0]-1).r; r[1] = pnew->Node(nd.c[1]-1).r; r[2] = pnew->Node(nd.c[2]-1).r; r[3] = pnew->Node(nd.c[3]-1).r; r[4] = pnew->Node(nd.c[4]-1).r; const int LUT[5][3][3] = { {{0,1,2},{2,3,4},{0,2,4}},{{0,1,4},{1,2,4},{2,3,4}},{{0,1,2},{0,2,3},{0,3,4}}, {{3,4,0},{0,1,3},{1,2,3}},{{0,1,4},{1,3,4},{1,2,3}}}; double Amax = 0; int imax = 0; for (int i=0; i<5; ++i) { vec3d ra0[3] = {r[LUT[i][0][0]], r[LUT[i][0][1]], r[LUT[i][0][2]]}; vec3d ra1[3] = {r[LUT[i][1][0]], r[LUT[i][1][1]], r[LUT[i][1][2]]}; vec3d ra2[3] = {r[LUT[i][2][0]], r[LUT[i][2][1]], r[LUT[i][2][2]]}; double A0 = area_triangle(ra0); double A1 = area_triangle(ra1); double A2 = area_triangle(ra2); double Amin = min(min(A0,A1),A2); if (Amin > Amax) { imax = i; Amax = Amin; } } FEFace& f0 = pnew->Face(faces++); f0.SetType(FE_FACE_TRI3); f0.n[0] = nd.c[LUT[imax][0][0]]-1; assert(nd.c[LUT[imax][0][0]] > 0); f0.n[1] = nd.c[LUT[imax][0][1]]-1; assert(nd.c[LUT[imax][0][1]] > 0); f0.n[2] = nd.c[LUT[imax][0][2]]-1; assert(nd.c[LUT[imax][0][2]] > 0); FEFace& f1 = pnew->Face(faces++); f1.SetType(FE_FACE_TRI3); f1.n[0] = nd.c[LUT[imax][1][0]]-1; assert(nd.c[LUT[imax][1][0]] > 0); f1.n[1] = nd.c[LUT[imax][1][1]]-1; assert(nd.c[LUT[imax][1][1]] > 0); f1.n[2] = nd.c[LUT[imax][1][2]]-1; assert(nd.c[LUT[imax][1][2]] > 0); FEFace& f2 = pnew->Face(faces++); f2.SetType(FE_FACE_TRI3); f2.n[0] = nd.c[LUT[imax][2][0]]-1; assert(nd.c[LUT[imax][2][0]] > 0); f2.n[1] = nd.c[LUT[imax][2][1]]-1; assert(nd.c[LUT[imax][2][1]] > 0); f2.n[2] = nd.c[LUT[imax][2][2]]-1; assert(nd.c[LUT[imax][2][2]] > 0); } else if (nd.nc == 6) { vec3d r[6]; r[0] = pnew->Node(nd.c[0]-1).r; r[1] = pnew->Node(nd.c[1]-1).r; r[2] = pnew->Node(nd.c[2]-1).r; r[3] = pnew->Node(nd.c[3]-1).r; r[4] = pnew->Node(nd.c[4]-1).r; r[5] = pnew->Node(nd.c[5]-1).r; const int LUT[8][4][3] = { {{0,1,5},{1,2,3},{3,4,5},{1,3,5}}, {{0,1,2},{2,3,4},{4,5,0},{0,2,4}}, {{0,1,2},{0,2,3},{0,3,5},{3,4,5}}, {{0,1,2},{0,2,5},{2,3,5},{3,4,5}}, {{0,1,5},{1,2,5},{2,4,5},{2,3,4}}, {{0,1,5},{1,4,5},{1,2,4},{2,3,4}}, {{0,4,5},{0,3,4},{0,1,3},{1,2,3}}, {{0,4,5},{0,1,4},{1,3,4},{1,2,3}}}; double Amax = 0, Amin; int imax = 0; for (int i=0; i<8; ++i) { vec3d ra0[3] = {r[LUT[i][0][0]], r[LUT[i][0][1]], r[LUT[i][0][2]]}; vec3d ra1[3] = {r[LUT[i][1][0]], r[LUT[i][1][1]], r[LUT[i][1][2]]}; vec3d ra2[3] = {r[LUT[i][2][0]], r[LUT[i][2][1]], r[LUT[i][2][2]]}; vec3d ra3[3] = {r[LUT[i][3][0]], r[LUT[i][3][1]], r[LUT[i][3][2]]}; double A0 = area_triangle(ra0); Amin = A0; double A1 = area_triangle(ra1); if (A1 < Amin) Amin = A1; double A2 = area_triangle(ra2); if (A2 < Amin) Amin = A2; double A3 = area_triangle(ra3); if (A3 < Amin) Amin = A3; if (Amin > Amax) { imax = i; Amax = Amin; } } FEFace& f0 = pnew->Face(faces++); f0.SetType(FE_FACE_TRI3); f0.n[0] = nd.c[LUT[imax][0][0]]-1; assert(nd.c[LUT[imax][0][0]] > 0); f0.n[1] = nd.c[LUT[imax][0][1]]-1; assert(nd.c[LUT[imax][0][1]] > 0); f0.n[2] = nd.c[LUT[imax][0][2]]-1; assert(nd.c[LUT[imax][0][2]] > 0); FEFace& f1 = pnew->Face(faces++); f1.SetType(FE_FACE_TRI3); f1.n[0] = nd.c[LUT[imax][1][0]]-1; assert(nd.c[LUT[imax][1][0]] > 0); f1.n[1] = nd.c[LUT[imax][1][1]]-1; assert(nd.c[LUT[imax][1][1]] > 0); f1.n[2] = nd.c[LUT[imax][1][2]]-1; assert(nd.c[LUT[imax][1][2]] > 0); FEFace& f2 = pnew->Face(faces++); f2.SetType(FE_FACE_TRI3); f2.n[0] = nd.c[LUT[imax][2][0]]-1; assert(nd.c[LUT[imax][2][0]] > 0); f2.n[1] = nd.c[LUT[imax][2][1]]-1; assert(nd.c[LUT[imax][2][1]] > 0); f2.n[2] = nd.c[LUT[imax][2][2]]-1; assert(nd.c[LUT[imax][2][2]] > 0); FEFace& f3 = pnew->Face(faces++); f3.SetType(FE_FACE_TRI3); f3.n[0] = nd.c[LUT[imax][3][0]]-1; assert(nd.c[LUT[imax][3][0]] > 0); f3.n[1] = nd.c[LUT[imax][3][1]]-1; assert(nd.c[LUT[imax][3][1]] > 0); f3.n[2] = nd.c[LUT[imax][3][2]]-1; assert(nd.c[LUT[imax][3][2]] > 0); } } return pnew; } //----------------------------------------------------------------------------- FESurfaceMesh* FECVDDecimationModifier::Triangulate2(FESurfaceMesh* pm) { // let's build the node data int N = pm->Nodes(); vector<NODE> Node; Node.resize(N); for (int i=0; i<N; ++i) { Node[i].nc = 0; } // find all clusters a node belongs to FENodeFaceList NFL; if (NFL.BuildSorted(pm) == false) return 0; for (int i=0; i<pm->Faces(); ++i) pm->Face(i).m_ntag = i; for (int i=0; i<N; ++i) { int nval = NFL.Valence(i); for (int j=0; j<nval; ++j) { if (Node[i].AttachToCluster(m_tag[NFL.Face(i, j)->m_ntag]) == false) return 0; } } // build the cluster's fid array for (int i = 0; i < m_Cluster.size(); ++i) m_Cluster[i].m_fid.clear(); for (int i=0; i<pm->Faces(); ++i) { Cluster& C = m_Cluster[m_tag[i]]; C.m_fid.push_back(i); } // number of nodes for decimanted mesh equals number of clusters int nodes = (int) m_Cluster.size() - 1; // create a new mesh FESurfaceMesh* pnew = new FESurfaceMesh; pnew->Create(nodes, 0, 0); // calculate the node positions for (int i=0; i<nodes; ++i) { FENode& nd = pnew->Node(i); Cluster& Ci = m_Cluster[i+1]; //nd.r = Ci.m_sgamma / Ci.m_srho;//change here //original point vec3d po = Ci.m_sgamma / Ci.m_srho; vec3d po_1 = vec3d(0,0,0); //projection of po on one of the faces //find projection of this center back to original surface of the mesh int flag = 0; double thickness = 0; for (int j =0 ;j<Ci.faces() ;j++) { FEFace& fj = pm->Face(Ci.m_fid[j]); vec3d p[3]; p[0] = pm->Node(fj.n[0]).r;//p1 p[1] = pm->Node(fj.n[1]).r;//p2 p[2] = pm->Node(fj.n[2]).r;//p3 vec3d u = p[1] - p[0]; //p2 - p1 vec3d v = p[2] - p[0]; //p3 - p1 vec3d n = u ^ v;//u x v vec3d w = po - p[0]; //po - p1 double n_2 = n * n; //n^2 vec3d u_X_w = u ^ w;//u x w double gama = (u_X_w * n)/n_2; vec3d w_X_v = w ^ v;//w x v double beta = (w_X_v * n)/n_2; double alpha = 1 - gama - beta; if (alpha <= 1 && alpha >= 0 && beta <= 1 && beta >= 0 && gama <= 1 && gama >= 0 ) { po_1 = (p[0] * alpha) + (p[1] * beta) + (p[2] * gama); flag = 1; break; } } if (flag == 0) nd.r = po; else nd.r = po_1; } // list of triangles FEFillHole fill; vector<FEFillHole::FACE> tri_list; tri_list.reserve(nodes); // loop over all nodes for (int i=0; i<N; ++i) { NODE& nd = Node[i]; if (nd.nc == 3) { FEFillHole::FACE f; f.n[0] = nd.c[0]-1; assert(nd.c[0] > 0); f.n[1] = nd.c[1]-1; assert(nd.c[1] > 0); f.n[2] = nd.c[2]-1; assert(nd.c[2] > 0); tri_list.push_back(f); } else if (nd.nc > 3) { FEFillHole::EdgeRing ring; vec3d temp; for (int j=0; j<nd.nc; ++j) ring.add(nd.c[j]-1, pnew->Node(nd.c[j]-1).r,temp); vector<FEFillHole::FACE> tri; fill.DivideRing(ring, tri); // append to the tri_list tri_list.insert(tri_list.end(), tri.begin(), tri.end()); } } // count the faces int faces = (int) tri_list.size(); pnew->Create(0, 0, faces); // build the elements for (int i=0; i<faces; ++i) { FEFace& face = pnew->Face(i); FEFillHole::FACE& fi = tri_list[i]; face.SetType(FE_FACE_TRI3); face.m_gid = 0; face.n[0] = fi.n[0]; face.n[1] = fi.n[1]; face.n[2] = fi.n[2]; } return pnew; } //----------------------------------------------------------------------------- FESurfaceMesh* FECVDDecimationModifier::CalculateCVD(FESurfaceMesh* pm) { FESurfaceMesh* pnew = new FESurfaceMesh(*pm); int N = pnew->Faces(); for (int i=0; i<N; ++i) { FEFace& f = pnew->Face(i); f.m_gid = m_tag[i]; } pnew->RebuildMesh(0.0); return pnew; }
27.059893
107
0.55567
[ "mesh", "vector" ]
d2eecca6d8aa3c23d730776e3edb7b95f636fafb
2,463
cpp
C++
applications/ParticlesEditor/src/Render/RenderObserverFactory.cpp
AluminiumRat/mtt
3052f8ad0ffabead05a1033e1d714a61e77d0aa8
[ "MIT" ]
null
null
null
applications/ParticlesEditor/src/Render/RenderObserverFactory.cpp
AluminiumRat/mtt
3052f8ad0ffabead05a1033e1d714a61e77d0aa8
[ "MIT" ]
null
null
null
applications/ParticlesEditor/src/Render/RenderObserverFactory.cpp
AluminiumRat/mtt
3052f8ad0ffabead05a1033e1d714a61e77d0aa8
[ "MIT" ]
null
null
null
#include <mtt/editorLib/Render/CrossRenderObserver.h> #include <Render/BlockerRenderObserver.h> #include <Render/EmitterRenderObserver.h> #include <Render/FieldRenderObserver.h> #include <Render/FluidModificatorObserver.h> #include <Render/ObserverWithIcon.h> #include <Render/RenderObserverFactory.h> #define ICON_SIZE 32 RenderObserverFactory::RenderObserverFactory(mtt::CommonEditData& commonData) : PEVisitorT(commonData) { } void RenderObserverFactory::visitBlockerObject(BlockerObject& object) { setResult(std::make_unique<BlockerRenderObserver>(object, commonData())); } void RenderObserverFactory::visitEmitterObject(EmitterObject& object) { setResult(std::make_unique<EmitterRenderObserver>(object, commonData())); } void RenderObserverFactory::visitFrameObject(FrameObject& object) { setResult(std::make_unique<mtt::CrossRenderObserver>(object, commonData())); } void RenderObserverFactory::visitGravityModificator(GravityModificator& object) { setResult(std::make_unique<ObserverWithIcon>( object, commonData(), ":/particlesEditor/gravity.png", ICON_SIZE)); } void RenderObserverFactory::visitGasSource(GasSource& object) { setResult(std::make_unique<FluidModificatorObserver>( object, ":/particlesEditor/source.png", commonData())); } void RenderObserverFactory::visitHeaterObject(HeaterObject& object) { setResult(std::make_unique<FluidModificatorObserver>( object, ":/particlesEditor/heater.png", commonData())); } void RenderObserverFactory::visitParticleField(ParticleField& object) { setResult(std::make_unique<FieldRenderObserver>(object, commonData())); } void RenderObserverFactory::visitVisibilityControlObject( VisibilityControlObject& object) { setResult(std::make_unique<ObserverWithIcon>( object, commonData(), ":/particlesEditor/visibilityControl.png", ICON_SIZE)); }
34.690141
80
0.596833
[ "render", "object" ]
d2fe94221428da37bd7e17d02a49234fd2ecae71
1,028
cpp
C++
acmicpc.net/source/14863.cpp
tdm1223/Algorithm
994149afffa21a81e38b822afcfc01f677d9e430
[ "MIT" ]
7
2019-06-26T07:03:32.000Z
2020-11-21T16:12:51.000Z
acmicpc.net/source/14863.cpp
tdm1223/Algorithm
994149afffa21a81e38b822afcfc01f677d9e430
[ "MIT" ]
null
null
null
acmicpc.net/source/14863.cpp
tdm1223/Algorithm
994149afffa21a81e38b822afcfc01f677d9e430
[ "MIT" ]
9
2019-02-28T03:34:54.000Z
2020-12-18T03:02:40.000Z
// 14863. 서울에서 경산까지 // 2019.05.22 // 다이나믹 프로그래밍 #include<vector> #include<algorithm> #include<iostream> using namespace std; int visit[101][100001]; // arr[i][0~4]:구간 i를 0:도보로 이동 걸리는 시간 1: 이때 모금액 // arr[i][0~4]:구간 i를 2:자전거로 이동 걸리는 시간 3: 이때 모금액 int arr[101][4]; int d[101][100001]; // d[i][j] : 도시 i까지 j이내의 시간에 이동하면서 벌 수 있는 최대 금액 int main() { int n, k; cin >> n >> k; int ans = 0; for (int i = 0; i < n; i++) { for (int j = 0; j < 4; j++) { cin >> arr[i][j]; } } visit[0][0] = 1; for (int i = 0; i<n; i++) { for (int j = 0; j <= k; j++) { if (visit[i][j] == 0) { continue; } if (j + arr[i][0] <= k) { d[i + 1][j + arr[i][0]] = max(d[i + 1][j + arr[i][0]], d[i][j] + arr[i][1]); visit[i + 1][j + arr[i][0]] = 1; } if (j + arr[i][2] <= k) { d[i + 1][j + arr[i][2]] = max(d[i + 1][j + arr[i][2]], d[i][j] + arr[i][3]); visit[i + 1][j + arr[i][2]] = 1; } } } for (int i = 0; i <= k; i++) { ans = max(ans, d[n][i]); } cout << ans << endl; return 0; }
18.690909
80
0.448444
[ "vector" ]
9603e142570fd25274b27b28e8eee88b0baf2abb
2,718
cpp
C++
plugins/archvis/src/MSMRenderTaskDataSource.cpp
tobiasrau/megamol
ce7b0b5337a9c52822f5f88a61cec1cc7ddbe39e
[ "BSD-3-Clause" ]
null
null
null
plugins/archvis/src/MSMRenderTaskDataSource.cpp
tobiasrau/megamol
ce7b0b5337a9c52822f5f88a61cec1cc7ddbe39e
[ "BSD-3-Clause" ]
null
null
null
plugins/archvis/src/MSMRenderTaskDataSource.cpp
tobiasrau/megamol
ce7b0b5337a9c52822f5f88a61cec1cc7ddbe39e
[ "BSD-3-Clause" ]
null
null
null
#include "MSMRenderTaskDataSource.h" #include "mesh/CallGPUMaterialData.h" #include "mesh/GPUMeshCollection.h" #include "mesh/CallGPUMeshData.h" #include "mesh/CallGPURenderTaskData.h" #include "MSMDataCall.h" megamol::archvis::MSMRenderTaskDataSource::MSMRenderTaskDataSource() : m_MSM_callerSlot("getMSM", "Connects the "), m_MSM_hash(0) { this->m_MSM_callerSlot.SetCompatibleCall<MSMDataCallDescription>(); this->MakeSlotAvailable(&this->m_MSM_callerSlot); } megamol::archvis::MSMRenderTaskDataSource::~MSMRenderTaskDataSource(){ } bool megamol::archvis::MSMRenderTaskDataSource::getDataCallback(core::Call& caller) { mesh::CallGPURenderTaskData* rtc = dynamic_cast<mesh::CallGPURenderTaskData*>(&caller); if (rtc == NULL) return false; mesh::CallGPUMaterialData* mtlc = this->m_material_callerSlot.CallAs<mesh::CallGPUMaterialData>(); if (mtlc == NULL) return false; if (!(*mtlc)(0)) return false; mesh::CallGPUMeshData* mc = this->m_mesh_callerSlot.CallAs<mesh::CallGPUMeshData>(); if (mc == NULL) return false; if (!(*mc)(0)) return false; auto gpu_mtl_storage = mtlc->getMaterialStorage(); auto gpu_mesh_storage = mc->getGPUMeshes(); if (gpu_mtl_storage == nullptr) return false; if (gpu_mesh_storage == nullptr) return false; MSMDataCall* msm_call = this->m_MSM_callerSlot.CallAs<MSMDataCall>(); if (msm_call == NULL) return false; if (!(*msm_call)(0)) return false; if (this->m_MSM_hash == msm_call->DataHash()) { return true; } m_gpu_render_tasks->clear(); for (auto& sub_mesh : gpu_mesh_storage->getSubMeshData()) { auto const& gpu_batch_mesh = gpu_mesh_storage->getMeshes()[sub_mesh.batch_index].mesh; auto const& shader = gpu_mtl_storage->getMaterials().front().shader_program; std::vector<glowl::DrawElementsCommand> draw_commands(1, sub_mesh.sub_mesh_draw_command); std::vector<vislib::math::Matrix<GLfloat, 4, vislib::math::COLUMN_MAJOR>> object_transform(1000); typedef std::vector<vislib::math::Matrix<GLfloat, 4, vislib::math::COLUMN_MAJOR>> PerTaskData; GLfloat scale = 1.0f; object_transform[0].SetAt(0, 0, scale); object_transform[0].SetAt(1, 1, scale); object_transform[0].SetAt(2, 2, scale); object_transform[0].SetAt(3, 3, 1.0f); object_transform[9].SetAt(0, 3, 0.0f); object_transform[9].SetAt(1, 3, 0.0f); object_transform[9].SetAt(2, 3, 0.0f); m_gpu_render_tasks->addRenderTasks(shader, gpu_batch_mesh, draw_commands, object_transform); } rtc->setRenderTaskData(m_gpu_render_tasks); this->m_MSM_hash = msm_call->DataHash(); return true; }
33.555556
105
0.699411
[ "mesh", "vector" ]
96043ac7fff646cd013d1cadb164422d7942305c
3,763
hh
C++
include/ftk/basic/shared_union_find.hh
hguo/FTT
f1d5387d6353cf2bd165c51fc717eb5d6b2675ef
[ "MIT" ]
19
2018-11-01T02:15:17.000Z
2022-03-28T16:55:00.000Z
include/ftk/basic/shared_union_find.hh
hguo/FTT
f1d5387d6353cf2bd165c51fc717eb5d6b2675ef
[ "MIT" ]
12
2019-04-14T12:49:41.000Z
2021-10-20T03:59:21.000Z
include/ftk/basic/shared_union_find.hh
hguo/FTT
f1d5387d6353cf2bd165c51fc717eb5d6b2675ef
[ "MIT" ]
9
2019-02-08T19:40:46.000Z
2021-06-15T00:31:09.000Z
#ifndef _FTK_SHARED_UNION_FIND_H #define _FTK_SHARED_UNION_FIND_H #include <ftk/config.hh> #include <vector> #include <map> #include <set> #include <iostream> // TBD // Complete thread-safe add function // Add unit test. // Union-find algorithm with shared-memory parallelism // All elements need to be added by invoking the add function at the initialization stage. // This prograpm cannot be used for distributed-memory parallelism. // This program assumes all elements are stored on the same memory. // Reference // Paper: "A Randomized Concurrent Algorithm for Disjoint Set Union" namespace ftk { template <class IdType=std::string> struct shared_union_find { shared_union_find() : eles(), id2parent(), sz() { } // // Initialization // // Add and initialize elements // void add(IdType i) { // eles.insert(i); // // id2parent[i] = i; // id2parent.insert(std::make_pair (i, i)); // sz[i] = 1; // } // Operations // Compare-and-swap // Reference: https://en.wikipedia.org/wiki/Compare-and-swap bool CAS(std::pair<const IdType, IdType> ele_parent, IdType old_parent, IdType new_parent) { if(ele_parent->second != old_parent) { return false; } ele_parent->second = new_parent; return true; } // Union by size // Return wehther i and j are in the same set. bool unite(IdType i, IdType j) { // if(!has(i) || !has(j)) { // throw "No such element. "; // return false ; // } IdType u = i; IdType v = j; while(true) { u = find(u); v = find(v); if(u < v) { if(CAS(id2parent.find(u), u, v)) { return false; } } else if (u == v) { return true; } else { if(CAS(id2parent.find(v), v, u)) { return false; } } } } // // Queries bool has(IdType i) { return eles.find(i) != eles.end(); } // IdType parent(IdType i) { // if(!has(i)) { // throw "No such element. "; // } // // return id2parent[i]; // return id2parent.find(i)->second; // } // Find the root of an element. // If the element is not in the data structure, return the element itself. // Path compression by path halving method IdType find(IdType i) { // if(!has(i)) { // throw "No such element. "; // } IdType u = i; while(true) { IdType v = id2parent.find(u)->second; IdType w = id2parent.find(v)->second; if(v == w) { return v; } else { CAS(id2parent.find(u), v, w); u = id2parent.find(u)->second; } } } // bool is_root(IdType i) { // if(!has(i)) { // throw "No such element. "; // } // return i == id2parent[i]; // } bool same_set(IdType i, IdType j) { if(!has(i) || !has(j)) { throw "No such element. "; } IdType u = i; IdType v = j; while(true) { u = find(u); v = find(v); if(u == v) { return true; } if(u == id2parent.find(u)->second) { return false; } } } // std::vector<std::set<IdType>> get_sets() { // std::map<IdType, std::set<IdType>> root2set; // for(auto ite = eles.begin(); ite != eles.end(); ++ite) { // IdType root = find(*ite); // root2set[root].insert(*ite); // } // std::vector<std::set<IdType>> results; // for(auto ite = root2set.begin(); ite != root2set.end(); ++ite) { // // if(is_root(*ite)) // results.push_back(ite->second); // } // return results; // } public: std::set<IdType> eles; private: // Use HashMap to support sparse union-find std::map<IdType, IdType> id2parent; std::map<IdType, size_t> sz; }; } #endif
20.905556
94
0.55275
[ "vector" ]
96050560ce8ce61c2a2d1d4c066c09d0b132c5f1
358,931
cpp
C++
HCTC-PARS-FINAL/360 Panorama PARS FINAL/Temp/StagingArea/Data/il2cppOutput/Il2CppCompilerCalculateTypeValues_13Table.cpp
Eiris/HCTC-PARS-FINAL
d90e11d4bb09a9ab6ab94e1808e6607847cd5150
[ "MIT" ]
null
null
null
HCTC-PARS-FINAL/360 Panorama PARS FINAL/Temp/StagingArea/Data/il2cppOutput/Il2CppCompilerCalculateTypeValues_13Table.cpp
Eiris/HCTC-PARS-FINAL
d90e11d4bb09a9ab6ab94e1808e6607847cd5150
[ "MIT" ]
null
null
null
HCTC-PARS-FINAL/360 Panorama PARS FINAL/Temp/StagingArea/Data/il2cppOutput/Il2CppCompilerCalculateTypeValues_13Table.cpp
Eiris/HCTC-PARS-FINAL
d90e11d4bb09a9ab6ab94e1808e6607847cd5150
[ "MIT" ]
null
null
null
#include "il2cpp-config.h" #ifndef _MSC_VER # include <alloca.h> #else # include <malloc.h> #endif #include <cstring> #include <string.h> #include <stdio.h> #include <cmath> #include <limits> #include <assert.h> #include <stdint.h> #include "il2cpp-class-internals.h" #include "codegen/il2cpp-codegen.h" #include "il2cpp-object-internals.h" // System.Collections.Specialized.ListDictionary struct ListDictionary_t1624492310; // System.Collections.Specialized.HybridDictionary struct HybridDictionary_t4070033136; // System.Collections.IDictionaryEnumerator struct IDictionaryEnumerator_t1693217257; // System.Collections.IEnumerable struct IEnumerable_t1941168011; // System.Collections.IEnumerator struct IEnumerator_t1853284238; // System.UInt32[] struct UInt32U5BU5D_t2770800703; // System.Security.Cryptography.RandomNumberGenerator struct RandomNumberGenerator_t386037858; // Mono.Math.BigInteger struct BigInteger_t2902905090; // System.IntPtr[] struct IntPtrU5BU5D_t4013366056; // System.String struct String_t; // System.Collections.IDictionary struct IDictionary_t1363984059; // System.Xml.XmlReaderBinarySupport struct XmlReaderBinarySupport_t1809665003; // System.Xml.XmlReaderSettings struct XmlReaderSettings_t2186285234; // System.Collections.Hashtable struct Hashtable_t1853889766; // System.Collections.ArrayList struct ArrayList_t2718874744; // System.Type struct Type_t; // System.Xml.XmlReader struct XmlReader_t3121518892; // System.Xml.Schema.ValidationEventHandler struct ValidationEventHandler_t791314227; // System.Void struct Void_t1185182177; // System.Char[] struct CharU5BU5D_t3528271667; // System.Reflection.MethodInfo struct MethodInfo_t; // System.DelegateData struct DelegateData_t1677132599; // System.Xml.Schema.XmlSchemaObject struct XmlSchemaObject_t1315720168; // System.Xml.XmlNameTable struct XmlNameTable_t71772148; // System.Xml.XmlResolver struct XmlResolver_t626023767; // System.Xml.Schema.XmlSchemaObjectTable struct XmlSchemaObjectTable_t2546974348; // System.Xml.Schema.XmlSchemaCompilationSettings struct XmlSchemaCompilationSettings_t2218765537; // System.Xml.Serialization.XmlSerializerNamespaces struct XmlSerializerNamespaces_t2702737953; // System.Xml.Schema.XmlSchemaPatternFacet struct XmlSchemaPatternFacet_t3316004401; // System.String[] struct StringU5BU5D_t1281789340; // System.Xml.XmlNode[] struct XmlNodeU5BU5D_t3728671178; // System.Xml.Schema.XmlSchemaSimpleType struct XmlSchemaSimpleType_t2678868104; // System.Xml.Schema.XmlSchemaAttribute struct XmlSchemaAttribute_t2797257020; // System.Xml.Schema.XmlSchemaElement struct XmlSchemaElement_t427880856; // System.Xml.Schema.XmlSchemaType struct XmlSchemaType_t2033747345; // System.Text.StringBuilder struct StringBuilder_t; // Mono.Xml.Schema.XsdAnySimpleType struct XsdAnySimpleType_t1257864485; // Mono.Xml.Schema.XsdString struct XsdString_t3049094358; // Mono.Xml.Schema.XsdNormalizedString struct XsdNormalizedString_t3260789355; // Mono.Xml.Schema.XsdToken struct XsdToken_t1239036978; // Mono.Xml.Schema.XsdLanguage struct XsdLanguage_t1876291273; // Mono.Xml.Schema.XsdNMToken struct XsdNMToken_t834691671; // Mono.Xml.Schema.XsdNMTokens struct XsdNMTokens_t4246953255; // Mono.Xml.Schema.XsdName struct XsdName_t2755146808; // Mono.Xml.Schema.XsdNCName struct XsdNCName_t3943159043; // Mono.Xml.Schema.XsdID struct XsdID_t34704195; // Mono.Xml.Schema.XsdIDRef struct XsdIDRef_t2913612829; // Mono.Xml.Schema.XsdIDRefs struct XsdIDRefs_t16099206; // Mono.Xml.Schema.XsdEntity struct XsdEntity_t3956505874; // Mono.Xml.Schema.XsdEntities struct XsdEntities_t1477210398; // Mono.Xml.Schema.XsdNotation struct XsdNotation_t2827634056; // Mono.Xml.Schema.XsdDecimal struct XsdDecimal_t1288601093; // Mono.Xml.Schema.XsdInteger struct XsdInteger_t2044766898; // Mono.Xml.Schema.XsdLong struct XsdLong_t1324632828; // Mono.Xml.Schema.XsdInt struct XsdInt_t33917785; // Mono.Xml.Schema.XsdShort struct XsdShort_t3489811876; // Mono.Xml.Schema.XsdByte struct XsdByte_t2221093920; // Mono.Xml.Schema.XsdNonNegativeInteger struct XsdNonNegativeInteger_t308064234; // Mono.Xml.Schema.XsdPositiveInteger struct XsdPositiveInteger_t1704031413; // Mono.Xml.Schema.XsdUnsignedLong struct XsdUnsignedLong_t1409593434; // Mono.Xml.Schema.XsdUnsignedInt struct XsdUnsignedInt_t72105793; // Mono.Xml.Schema.XsdUnsignedShort struct XsdUnsignedShort_t3654069686; // Mono.Xml.Schema.XsdUnsignedByte struct XsdUnsignedByte_t2304219558; // Mono.Xml.Schema.XsdNonPositiveInteger struct XsdNonPositiveInteger_t1029055398; // Mono.Xml.Schema.XsdNegativeInteger struct XsdNegativeInteger_t2178753546; // Mono.Xml.Schema.XsdFloat struct XsdFloat_t3181928905; // Mono.Xml.Schema.XsdDouble struct XsdDouble_t3324344982; // Mono.Xml.Schema.XsdBase64Binary struct XsdBase64Binary_t3360383190; // Mono.Xml.Schema.XsdBoolean struct XsdBoolean_t380164876; // Mono.Xml.Schema.XsdAnyURI struct XsdAnyURI_t2755748070; // Mono.Xml.Schema.XsdDuration struct XsdDuration_t1555973170; // Mono.Xml.Schema.XsdDateTime struct XsdDateTime_t2563698975; // Mono.Xml.Schema.XsdDate struct XsdDate_t1417753656; // Mono.Xml.Schema.XsdTime struct XsdTime_t3558487088; // Mono.Xml.Schema.XsdHexBinary struct XsdHexBinary_t882812470; // Mono.Xml.Schema.XsdQName struct XsdQName_t2385631467; // Mono.Xml.Schema.XsdGYearMonth struct XsdGYearMonth_t3399073121; // Mono.Xml.Schema.XsdGMonthDay struct XsdGMonthDay_t2605134399; // Mono.Xml.Schema.XsdGYear struct XsdGYear_t3316212116; // Mono.Xml.Schema.XsdGMonth struct XsdGMonth_t3913018815; // Mono.Xml.Schema.XsdGDay struct XsdGDay_t293490745; // Mono.Xml.Schema.XdtAnyAtomicType struct XdtAnyAtomicType_t269366253; // Mono.Xml.Schema.XdtUntypedAtomic struct XdtUntypedAtomic_t1388131523; // Mono.Xml.Schema.XdtDayTimeDuration struct XdtDayTimeDuration_t268779858; // Mono.Xml.Schema.XdtYearMonthDuration struct XdtYearMonthDuration_t1503718519; // System.Collections.Generic.Dictionary`2<System.String,System.Int32> struct Dictionary_2_t2736202052; // System.Xml.Schema.XmlSchemaAnnotation struct XmlSchemaAnnotation_t2553753397; // System.Xml.XmlAttribute[] struct XmlAttributeU5BU5D_t1490365106; // System.Xml.Schema.XmlSchema struct XmlSchema_t3742557897; // System.Xml.XmlNodeChangedEventArgs struct XmlNodeChangedEventArgs_t2486095928; // System.IAsyncResult struct IAsyncResult_t767004451; // System.AsyncCallback struct AsyncCallback_t3962456242; // System.Xml.Schema.ValidationEventArgs struct ValidationEventArgs_t2784773869; // System.Xml.XmlQualifiedName struct XmlQualifiedName_t2760654312; // System.Xml.Schema.XmlSchemaDatatype struct XmlSchemaDatatype_t322714710; // System.Xml.Schema.XmlSchemaObjectCollection struct XmlSchemaObjectCollection_t1064819932; // System.Xml.Schema.XmlSchemaXPath struct XmlSchemaXPath_t3156455507; // Mono.Xml.Schema.XsdIdentitySelector struct XsdIdentitySelector_t574258590; // System.Xml.XmlNamespaceManager struct XmlNamespaceManager_t418790500; // Mono.Xml.Schema.XsdIdentityPath[] struct XsdIdentityPathU5BU5D_t2466178853; // Mono.Xml.Schema.XsdIdentityPath struct XsdIdentityPath_t991900844; // System.Xml.Schema.XmlSchemaGroupBase struct XmlSchemaGroupBase_t3631079376; // System.Xml.Schema.XmlSchemaGroup struct XmlSchemaGroup_t1441741786; // System.Xml.Schema.XmlSchemaContent struct XmlSchemaContent_t1040349258; // System.Xml.Schema.XmlSchemaAnyAttribute struct XmlSchemaAnyAttribute_t963227996; // System.Xml.Schema.XmlSchemaSimpleTypeContent struct XmlSchemaSimpleTypeContent_t599285223; // System.Text.RegularExpressions.Regex[] struct RegexU5BU5D_t1561692752; // System.Xml.XmlQualifiedName[] struct XmlQualifiedNameU5BU5D_t1471530361; // System.Object[] struct ObjectU5BU5D_t2843939325; // System.Xml.Schema.XmlSchemaSimpleType[] struct XmlSchemaSimpleTypeU5BU5D_t1394089049; // System.Xml.Schema.XmlSchemaContentModel struct XmlSchemaContentModel_t602185179; // System.Xml.Schema.XmlSchemaParticle struct XmlSchemaParticle_t3828501457; // System.Xml.Schema.XmlSchemaIdentityConstraint struct XmlSchemaIdentityConstraint_t297318432; #ifndef RUNTIMEOBJECT_H #define RUNTIMEOBJECT_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Object #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // RUNTIMEOBJECT_H #ifndef U3CMODULEU3E_T692745527_H #define U3CMODULEU3E_T692745527_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // <Module> struct U3CModuleU3E_t692745527 { public: public: }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // U3CMODULEU3E_T692745527_H #ifndef XMLSERIALIZERNAMESPACES_T2702737953_H #define XMLSERIALIZERNAMESPACES_T2702737953_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Xml.Serialization.XmlSerializerNamespaces struct XmlSerializerNamespaces_t2702737953 : public RuntimeObject { public: // System.Collections.Specialized.ListDictionary System.Xml.Serialization.XmlSerializerNamespaces::namespaces ListDictionary_t1624492310 * ___namespaces_0; public: inline static int32_t get_offset_of_namespaces_0() { return static_cast<int32_t>(offsetof(XmlSerializerNamespaces_t2702737953, ___namespaces_0)); } inline ListDictionary_t1624492310 * get_namespaces_0() const { return ___namespaces_0; } inline ListDictionary_t1624492310 ** get_address_of_namespaces_0() { return &___namespaces_0; } inline void set_namespaces_0(ListDictionary_t1624492310 * value) { ___namespaces_0 = value; Il2CppCodeGenWriteBarrier((&___namespaces_0), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // XMLSERIALIZERNAMESPACES_T2702737953_H #ifndef PRIMEGENERATORBASE_T446028867_H #define PRIMEGENERATORBASE_T446028867_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // Mono.Math.Prime.Generator.PrimeGeneratorBase struct PrimeGeneratorBase_t446028867 : public RuntimeObject { public: public: }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // PRIMEGENERATORBASE_T446028867_H #ifndef PRIMALITYTESTS_T1538473976_H #define PRIMALITYTESTS_T1538473976_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // Mono.Math.Prime.PrimalityTests struct PrimalityTests_t1538473976 : public RuntimeObject { public: public: }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // PRIMALITYTESTS_T1538473976_H #ifndef XMLSCHEMAOBJECTTABLE_T2546974348_H #define XMLSCHEMAOBJECTTABLE_T2546974348_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Xml.Schema.XmlSchemaObjectTable struct XmlSchemaObjectTable_t2546974348 : public RuntimeObject { public: // System.Collections.Specialized.HybridDictionary System.Xml.Schema.XmlSchemaObjectTable::table HybridDictionary_t4070033136 * ___table_0; public: inline static int32_t get_offset_of_table_0() { return static_cast<int32_t>(offsetof(XmlSchemaObjectTable_t2546974348, ___table_0)); } inline HybridDictionary_t4070033136 * get_table_0() const { return ___table_0; } inline HybridDictionary_t4070033136 ** get_address_of_table_0() { return &___table_0; } inline void set_table_0(HybridDictionary_t4070033136 * value) { ___table_0 = value; Il2CppCodeGenWriteBarrier((&___table_0), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // XMLSCHEMAOBJECTTABLE_T2546974348_H #ifndef KERNEL_T1402667220_H #define KERNEL_T1402667220_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // Mono.Math.BigInteger/Kernel struct Kernel_t1402667220 : public RuntimeObject { public: public: }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // KERNEL_T1402667220_H #ifndef XMLSCHEMAOBJECTTABLEENUMERATOR_T1321079153_H #define XMLSCHEMAOBJECTTABLEENUMERATOR_T1321079153_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Xml.Schema.XmlSchemaObjectTable/XmlSchemaObjectTableEnumerator struct XmlSchemaObjectTableEnumerator_t1321079153 : public RuntimeObject { public: // System.Collections.IDictionaryEnumerator System.Xml.Schema.XmlSchemaObjectTable/XmlSchemaObjectTableEnumerator::xenum RuntimeObject* ___xenum_0; // System.Collections.IEnumerable System.Xml.Schema.XmlSchemaObjectTable/XmlSchemaObjectTableEnumerator::tmp RuntimeObject* ___tmp_1; public: inline static int32_t get_offset_of_xenum_0() { return static_cast<int32_t>(offsetof(XmlSchemaObjectTableEnumerator_t1321079153, ___xenum_0)); } inline RuntimeObject* get_xenum_0() const { return ___xenum_0; } inline RuntimeObject** get_address_of_xenum_0() { return &___xenum_0; } inline void set_xenum_0(RuntimeObject* value) { ___xenum_0 = value; Il2CppCodeGenWriteBarrier((&___xenum_0), value); } inline static int32_t get_offset_of_tmp_1() { return static_cast<int32_t>(offsetof(XmlSchemaObjectTableEnumerator_t1321079153, ___tmp_1)); } inline RuntimeObject* get_tmp_1() const { return ___tmp_1; } inline RuntimeObject** get_address_of_tmp_1() { return &___tmp_1; } inline void set_tmp_1(RuntimeObject* value) { ___tmp_1 = value; Il2CppCodeGenWriteBarrier((&___tmp_1), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // XMLSCHEMAOBJECTTABLEENUMERATOR_T1321079153_H #ifndef XMLSCHEMAOBJECTENUMERATOR_T503074204_H #define XMLSCHEMAOBJECTENUMERATOR_T503074204_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Xml.Schema.XmlSchemaObjectEnumerator struct XmlSchemaObjectEnumerator_t503074204 : public RuntimeObject { public: // System.Collections.IEnumerator System.Xml.Schema.XmlSchemaObjectEnumerator::ienum RuntimeObject* ___ienum_0; public: inline static int32_t get_offset_of_ienum_0() { return static_cast<int32_t>(offsetof(XmlSchemaObjectEnumerator_t503074204, ___ienum_0)); } inline RuntimeObject* get_ienum_0() const { return ___ienum_0; } inline RuntimeObject** get_address_of_ienum_0() { return &___ienum_0; } inline void set_ienum_0(RuntimeObject* value) { ___ienum_0 = value; Il2CppCodeGenWriteBarrier((&___ienum_0), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // XMLSCHEMAOBJECTENUMERATOR_T503074204_H #ifndef BIGINTEGER_T2902905090_H #define BIGINTEGER_T2902905090_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // Mono.Math.BigInteger struct BigInteger_t2902905090 : public RuntimeObject { public: // System.UInt32 Mono.Math.BigInteger::length uint32_t ___length_0; // System.UInt32[] Mono.Math.BigInteger::data UInt32U5BU5D_t2770800703* ___data_1; public: inline static int32_t get_offset_of_length_0() { return static_cast<int32_t>(offsetof(BigInteger_t2902905090, ___length_0)); } inline uint32_t get_length_0() const { return ___length_0; } inline uint32_t* get_address_of_length_0() { return &___length_0; } inline void set_length_0(uint32_t value) { ___length_0 = value; } inline static int32_t get_offset_of_data_1() { return static_cast<int32_t>(offsetof(BigInteger_t2902905090, ___data_1)); } inline UInt32U5BU5D_t2770800703* get_data_1() const { return ___data_1; } inline UInt32U5BU5D_t2770800703** get_address_of_data_1() { return &___data_1; } inline void set_data_1(UInt32U5BU5D_t2770800703* value) { ___data_1 = value; Il2CppCodeGenWriteBarrier((&___data_1), value); } }; struct BigInteger_t2902905090_StaticFields { public: // System.UInt32[] Mono.Math.BigInteger::smallPrimes UInt32U5BU5D_t2770800703* ___smallPrimes_2; // System.Security.Cryptography.RandomNumberGenerator Mono.Math.BigInteger::rng RandomNumberGenerator_t386037858 * ___rng_3; public: inline static int32_t get_offset_of_smallPrimes_2() { return static_cast<int32_t>(offsetof(BigInteger_t2902905090_StaticFields, ___smallPrimes_2)); } inline UInt32U5BU5D_t2770800703* get_smallPrimes_2() const { return ___smallPrimes_2; } inline UInt32U5BU5D_t2770800703** get_address_of_smallPrimes_2() { return &___smallPrimes_2; } inline void set_smallPrimes_2(UInt32U5BU5D_t2770800703* value) { ___smallPrimes_2 = value; Il2CppCodeGenWriteBarrier((&___smallPrimes_2), value); } inline static int32_t get_offset_of_rng_3() { return static_cast<int32_t>(offsetof(BigInteger_t2902905090_StaticFields, ___rng_3)); } inline RandomNumberGenerator_t386037858 * get_rng_3() const { return ___rng_3; } inline RandomNumberGenerator_t386037858 ** get_address_of_rng_3() { return &___rng_3; } inline void set_rng_3(RandomNumberGenerator_t386037858 * value) { ___rng_3 = value; Il2CppCodeGenWriteBarrier((&___rng_3), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // BIGINTEGER_T2902905090_H #ifndef LOCALE_T4128636108_H #define LOCALE_T4128636108_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // Locale struct Locale_t4128636108 : public RuntimeObject { public: public: }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // LOCALE_T4128636108_H #ifndef MODULUSRING_T596511505_H #define MODULUSRING_T596511505_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // Mono.Math.BigInteger/ModulusRing struct ModulusRing_t596511505 : public RuntimeObject { public: // Mono.Math.BigInteger Mono.Math.BigInteger/ModulusRing::mod BigInteger_t2902905090 * ___mod_0; // Mono.Math.BigInteger Mono.Math.BigInteger/ModulusRing::constant BigInteger_t2902905090 * ___constant_1; public: inline static int32_t get_offset_of_mod_0() { return static_cast<int32_t>(offsetof(ModulusRing_t596511505, ___mod_0)); } inline BigInteger_t2902905090 * get_mod_0() const { return ___mod_0; } inline BigInteger_t2902905090 ** get_address_of_mod_0() { return &___mod_0; } inline void set_mod_0(BigInteger_t2902905090 * value) { ___mod_0 = value; Il2CppCodeGenWriteBarrier((&___mod_0), value); } inline static int32_t get_offset_of_constant_1() { return static_cast<int32_t>(offsetof(ModulusRing_t596511505, ___constant_1)); } inline BigInteger_t2902905090 * get_constant_1() const { return ___constant_1; } inline BigInteger_t2902905090 ** get_address_of_constant_1() { return &___constant_1; } inline void set_constant_1(BigInteger_t2902905090 * value) { ___constant_1 = value; Il2CppCodeGenWriteBarrier((&___constant_1), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // MODULUSRING_T596511505_H #ifndef VALIDATIONHANDLER_T3551360050_H #define VALIDATIONHANDLER_T3551360050_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Xml.Schema.ValidationHandler struct ValidationHandler_t3551360050 : public RuntimeObject { public: public: }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // VALIDATIONHANDLER_T3551360050_H #ifndef EXCEPTION_T_H #define EXCEPTION_T_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Exception struct Exception_t : public RuntimeObject { public: // System.IntPtr[] System.Exception::trace_ips IntPtrU5BU5D_t4013366056* ___trace_ips_0; // System.Exception System.Exception::inner_exception Exception_t * ___inner_exception_1; // System.String System.Exception::message String_t* ___message_2; // System.String System.Exception::help_link String_t* ___help_link_3; // System.String System.Exception::class_name String_t* ___class_name_4; // System.String System.Exception::stack_trace String_t* ___stack_trace_5; // System.String System.Exception::_remoteStackTraceString String_t* ____remoteStackTraceString_6; // System.Int32 System.Exception::remote_stack_index int32_t ___remote_stack_index_7; // System.Int32 System.Exception::hresult int32_t ___hresult_8; // System.String System.Exception::source String_t* ___source_9; // System.Collections.IDictionary System.Exception::_data RuntimeObject* ____data_10; public: inline static int32_t get_offset_of_trace_ips_0() { return static_cast<int32_t>(offsetof(Exception_t, ___trace_ips_0)); } inline IntPtrU5BU5D_t4013366056* get_trace_ips_0() const { return ___trace_ips_0; } inline IntPtrU5BU5D_t4013366056** get_address_of_trace_ips_0() { return &___trace_ips_0; } inline void set_trace_ips_0(IntPtrU5BU5D_t4013366056* value) { ___trace_ips_0 = value; Il2CppCodeGenWriteBarrier((&___trace_ips_0), value); } inline static int32_t get_offset_of_inner_exception_1() { return static_cast<int32_t>(offsetof(Exception_t, ___inner_exception_1)); } inline Exception_t * get_inner_exception_1() const { return ___inner_exception_1; } inline Exception_t ** get_address_of_inner_exception_1() { return &___inner_exception_1; } inline void set_inner_exception_1(Exception_t * value) { ___inner_exception_1 = value; Il2CppCodeGenWriteBarrier((&___inner_exception_1), value); } inline static int32_t get_offset_of_message_2() { return static_cast<int32_t>(offsetof(Exception_t, ___message_2)); } inline String_t* get_message_2() const { return ___message_2; } inline String_t** get_address_of_message_2() { return &___message_2; } inline void set_message_2(String_t* value) { ___message_2 = value; Il2CppCodeGenWriteBarrier((&___message_2), value); } inline static int32_t get_offset_of_help_link_3() { return static_cast<int32_t>(offsetof(Exception_t, ___help_link_3)); } inline String_t* get_help_link_3() const { return ___help_link_3; } inline String_t** get_address_of_help_link_3() { return &___help_link_3; } inline void set_help_link_3(String_t* value) { ___help_link_3 = value; Il2CppCodeGenWriteBarrier((&___help_link_3), value); } inline static int32_t get_offset_of_class_name_4() { return static_cast<int32_t>(offsetof(Exception_t, ___class_name_4)); } inline String_t* get_class_name_4() const { return ___class_name_4; } inline String_t** get_address_of_class_name_4() { return &___class_name_4; } inline void set_class_name_4(String_t* value) { ___class_name_4 = value; Il2CppCodeGenWriteBarrier((&___class_name_4), value); } inline static int32_t get_offset_of_stack_trace_5() { return static_cast<int32_t>(offsetof(Exception_t, ___stack_trace_5)); } inline String_t* get_stack_trace_5() const { return ___stack_trace_5; } inline String_t** get_address_of_stack_trace_5() { return &___stack_trace_5; } inline void set_stack_trace_5(String_t* value) { ___stack_trace_5 = value; Il2CppCodeGenWriteBarrier((&___stack_trace_5), value); } inline static int32_t get_offset_of__remoteStackTraceString_6() { return static_cast<int32_t>(offsetof(Exception_t, ____remoteStackTraceString_6)); } inline String_t* get__remoteStackTraceString_6() const { return ____remoteStackTraceString_6; } inline String_t** get_address_of__remoteStackTraceString_6() { return &____remoteStackTraceString_6; } inline void set__remoteStackTraceString_6(String_t* value) { ____remoteStackTraceString_6 = value; Il2CppCodeGenWriteBarrier((&____remoteStackTraceString_6), value); } inline static int32_t get_offset_of_remote_stack_index_7() { return static_cast<int32_t>(offsetof(Exception_t, ___remote_stack_index_7)); } inline int32_t get_remote_stack_index_7() const { return ___remote_stack_index_7; } inline int32_t* get_address_of_remote_stack_index_7() { return &___remote_stack_index_7; } inline void set_remote_stack_index_7(int32_t value) { ___remote_stack_index_7 = value; } inline static int32_t get_offset_of_hresult_8() { return static_cast<int32_t>(offsetof(Exception_t, ___hresult_8)); } inline int32_t get_hresult_8() const { return ___hresult_8; } inline int32_t* get_address_of_hresult_8() { return &___hresult_8; } inline void set_hresult_8(int32_t value) { ___hresult_8 = value; } inline static int32_t get_offset_of_source_9() { return static_cast<int32_t>(offsetof(Exception_t, ___source_9)); } inline String_t* get_source_9() const { return ___source_9; } inline String_t** get_address_of_source_9() { return &___source_9; } inline void set_source_9(String_t* value) { ___source_9 = value; Il2CppCodeGenWriteBarrier((&___source_9), value); } inline static int32_t get_offset_of__data_10() { return static_cast<int32_t>(offsetof(Exception_t, ____data_10)); } inline RuntimeObject* get__data_10() const { return ____data_10; } inline RuntimeObject** get_address_of__data_10() { return &____data_10; } inline void set__data_10(RuntimeObject* value) { ____data_10 = value; Il2CppCodeGenWriteBarrier((&____data_10), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // EXCEPTION_T_H #ifndef VALUETYPE_T3640485471_H #define VALUETYPE_T3640485471_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.ValueType struct ValueType_t3640485471 : public RuntimeObject { public: public: }; #ifdef __clang__ #pragma clang diagnostic pop #endif // Native definition for P/Invoke marshalling of System.ValueType struct ValueType_t3640485471_marshaled_pinvoke { }; // Native definition for COM marshalling of System.ValueType struct ValueType_t3640485471_marshaled_com { }; #endif // VALUETYPE_T3640485471_H #ifndef ATTRIBUTE_T861562559_H #define ATTRIBUTE_T861562559_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Attribute struct Attribute_t861562559 : public RuntimeObject { public: public: }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // ATTRIBUTE_T861562559_H #ifndef XMLREADER_T3121518892_H #define XMLREADER_T3121518892_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Xml.XmlReader struct XmlReader_t3121518892 : public RuntimeObject { public: // System.Xml.XmlReaderBinarySupport System.Xml.XmlReader::binary XmlReaderBinarySupport_t1809665003 * ___binary_0; // System.Xml.XmlReaderSettings System.Xml.XmlReader::settings XmlReaderSettings_t2186285234 * ___settings_1; public: inline static int32_t get_offset_of_binary_0() { return static_cast<int32_t>(offsetof(XmlReader_t3121518892, ___binary_0)); } inline XmlReaderBinarySupport_t1809665003 * get_binary_0() const { return ___binary_0; } inline XmlReaderBinarySupport_t1809665003 ** get_address_of_binary_0() { return &___binary_0; } inline void set_binary_0(XmlReaderBinarySupport_t1809665003 * value) { ___binary_0 = value; Il2CppCodeGenWriteBarrier((&___binary_0), value); } inline static int32_t get_offset_of_settings_1() { return static_cast<int32_t>(offsetof(XmlReader_t3121518892, ___settings_1)); } inline XmlReaderSettings_t2186285234 * get_settings_1() const { return ___settings_1; } inline XmlReaderSettings_t2186285234 ** get_address_of_settings_1() { return &___settings_1; } inline void set_settings_1(XmlReaderSettings_t2186285234 * value) { ___settings_1 = value; Il2CppCodeGenWriteBarrier((&___settings_1), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // XMLREADER_T3121518892_H #ifndef CODEIDENTIFIER_T2202687290_H #define CODEIDENTIFIER_T2202687290_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Xml.Serialization.CodeIdentifier struct CodeIdentifier_t2202687290 : public RuntimeObject { public: public: }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // CODEIDENTIFIER_T2202687290_H #ifndef TYPETRANSLATOR_T3446962748_H #define TYPETRANSLATOR_T3446962748_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Xml.Serialization.TypeTranslator struct TypeTranslator_t3446962748 : public RuntimeObject { public: public: }; struct TypeTranslator_t3446962748_StaticFields { public: // System.Collections.Hashtable System.Xml.Serialization.TypeTranslator::nameCache Hashtable_t1853889766 * ___nameCache_0; // System.Collections.Hashtable System.Xml.Serialization.TypeTranslator::primitiveTypes Hashtable_t1853889766 * ___primitiveTypes_1; // System.Collections.Hashtable System.Xml.Serialization.TypeTranslator::primitiveArrayTypes Hashtable_t1853889766 * ___primitiveArrayTypes_2; // System.Collections.Hashtable System.Xml.Serialization.TypeTranslator::nullableTypes Hashtable_t1853889766 * ___nullableTypes_3; public: inline static int32_t get_offset_of_nameCache_0() { return static_cast<int32_t>(offsetof(TypeTranslator_t3446962748_StaticFields, ___nameCache_0)); } inline Hashtable_t1853889766 * get_nameCache_0() const { return ___nameCache_0; } inline Hashtable_t1853889766 ** get_address_of_nameCache_0() { return &___nameCache_0; } inline void set_nameCache_0(Hashtable_t1853889766 * value) { ___nameCache_0 = value; Il2CppCodeGenWriteBarrier((&___nameCache_0), value); } inline static int32_t get_offset_of_primitiveTypes_1() { return static_cast<int32_t>(offsetof(TypeTranslator_t3446962748_StaticFields, ___primitiveTypes_1)); } inline Hashtable_t1853889766 * get_primitiveTypes_1() const { return ___primitiveTypes_1; } inline Hashtable_t1853889766 ** get_address_of_primitiveTypes_1() { return &___primitiveTypes_1; } inline void set_primitiveTypes_1(Hashtable_t1853889766 * value) { ___primitiveTypes_1 = value; Il2CppCodeGenWriteBarrier((&___primitiveTypes_1), value); } inline static int32_t get_offset_of_primitiveArrayTypes_2() { return static_cast<int32_t>(offsetof(TypeTranslator_t3446962748_StaticFields, ___primitiveArrayTypes_2)); } inline Hashtable_t1853889766 * get_primitiveArrayTypes_2() const { return ___primitiveArrayTypes_2; } inline Hashtable_t1853889766 ** get_address_of_primitiveArrayTypes_2() { return &___primitiveArrayTypes_2; } inline void set_primitiveArrayTypes_2(Hashtable_t1853889766 * value) { ___primitiveArrayTypes_2 = value; Il2CppCodeGenWriteBarrier((&___primitiveArrayTypes_2), value); } inline static int32_t get_offset_of_nullableTypes_3() { return static_cast<int32_t>(offsetof(TypeTranslator_t3446962748_StaticFields, ___nullableTypes_3)); } inline Hashtable_t1853889766 * get_nullableTypes_3() const { return ___nullableTypes_3; } inline Hashtable_t1853889766 ** get_address_of_nullableTypes_3() { return &___nullableTypes_3; } inline void set_nullableTypes_3(Hashtable_t1853889766 * value) { ___nullableTypes_3 = value; Il2CppCodeGenWriteBarrier((&___nullableTypes_3), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // TYPETRANSLATOR_T3446962748_H #ifndef COLLECTIONBASE_T2727926298_H #define COLLECTIONBASE_T2727926298_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Collections.CollectionBase struct CollectionBase_t2727926298 : public RuntimeObject { public: // System.Collections.ArrayList System.Collections.CollectionBase::list ArrayList_t2718874744 * ___list_0; public: inline static int32_t get_offset_of_list_0() { return static_cast<int32_t>(offsetof(CollectionBase_t2727926298, ___list_0)); } inline ArrayList_t2718874744 * get_list_0() const { return ___list_0; } inline ArrayList_t2718874744 ** get_address_of_list_0() { return &___list_0; } inline void set_list_0(ArrayList_t2718874744 * value) { ___list_0 = value; Il2CppCodeGenWriteBarrier((&___list_0), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // COLLECTIONBASE_T2727926298_H #ifndef XMLENUMATTRIBUTE_T106705320_H #define XMLENUMATTRIBUTE_T106705320_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Xml.Serialization.XmlEnumAttribute struct XmlEnumAttribute_t106705320 : public Attribute_t861562559 { public: // System.String System.Xml.Serialization.XmlEnumAttribute::name String_t* ___name_0; public: inline static int32_t get_offset_of_name_0() { return static_cast<int32_t>(offsetof(XmlEnumAttribute_t106705320, ___name_0)); } inline String_t* get_name_0() const { return ___name_0; } inline String_t** get_address_of_name_0() { return &___name_0; } inline void set_name_0(String_t* value) { ___name_0 = value; Il2CppCodeGenWriteBarrier((&___name_0), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // XMLENUMATTRIBUTE_T106705320_H #ifndef XMLIGNOREATTRIBUTE_T1428424057_H #define XMLIGNOREATTRIBUTE_T1428424057_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Xml.Serialization.XmlIgnoreAttribute struct XmlIgnoreAttribute_t1428424057 : public Attribute_t861562559 { public: public: }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // XMLIGNOREATTRIBUTE_T1428424057_H #ifndef XMLNAMESPACEDECLARATIONSATTRIBUTE_T966425202_H #define XMLNAMESPACEDECLARATIONSATTRIBUTE_T966425202_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Xml.Serialization.XmlNamespaceDeclarationsAttribute struct XmlNamespaceDeclarationsAttribute_t966425202 : public Attribute_t861562559 { public: public: }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // XMLNAMESPACEDECLARATIONSATTRIBUTE_T966425202_H #ifndef XMLROOTATTRIBUTE_T2306097217_H #define XMLROOTATTRIBUTE_T2306097217_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Xml.Serialization.XmlRootAttribute struct XmlRootAttribute_t2306097217 : public Attribute_t861562559 { public: // System.String System.Xml.Serialization.XmlRootAttribute::elementName String_t* ___elementName_0; // System.Boolean System.Xml.Serialization.XmlRootAttribute::isNullable bool ___isNullable_1; // System.String System.Xml.Serialization.XmlRootAttribute::ns String_t* ___ns_2; public: inline static int32_t get_offset_of_elementName_0() { return static_cast<int32_t>(offsetof(XmlRootAttribute_t2306097217, ___elementName_0)); } inline String_t* get_elementName_0() const { return ___elementName_0; } inline String_t** get_address_of_elementName_0() { return &___elementName_0; } inline void set_elementName_0(String_t* value) { ___elementName_0 = value; Il2CppCodeGenWriteBarrier((&___elementName_0), value); } inline static int32_t get_offset_of_isNullable_1() { return static_cast<int32_t>(offsetof(XmlRootAttribute_t2306097217, ___isNullable_1)); } inline bool get_isNullable_1() const { return ___isNullable_1; } inline bool* get_address_of_isNullable_1() { return &___isNullable_1; } inline void set_isNullable_1(bool value) { ___isNullable_1 = value; } inline static int32_t get_offset_of_ns_2() { return static_cast<int32_t>(offsetof(XmlRootAttribute_t2306097217, ___ns_2)); } inline String_t* get_ns_2() const { return ___ns_2; } inline String_t** get_address_of_ns_2() { return &___ns_2; } inline void set_ns_2(String_t* value) { ___ns_2 = value; Il2CppCodeGenWriteBarrier((&___ns_2), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // XMLROOTATTRIBUTE_T2306097217_H #ifndef XMLSCHEMAOBJECTCOLLECTION_T1064819932_H #define XMLSCHEMAOBJECTCOLLECTION_T1064819932_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Xml.Schema.XmlSchemaObjectCollection struct XmlSchemaObjectCollection_t1064819932 : public CollectionBase_t2727926298 { public: public: }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // XMLSCHEMAOBJECTCOLLECTION_T1064819932_H #ifndef XMLANYELEMENTATTRIBUTE_T4038919363_H #define XMLANYELEMENTATTRIBUTE_T4038919363_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Xml.Serialization.XmlAnyElementAttribute struct XmlAnyElementAttribute_t4038919363 : public Attribute_t861562559 { public: // System.Int32 System.Xml.Serialization.XmlAnyElementAttribute::order int32_t ___order_0; public: inline static int32_t get_offset_of_order_0() { return static_cast<int32_t>(offsetof(XmlAnyElementAttribute_t4038919363, ___order_0)); } inline int32_t get_order_0() const { return ___order_0; } inline int32_t* get_address_of_order_0() { return &___order_0; } inline void set_order_0(int32_t value) { ___order_0 = value; } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // XMLANYELEMENTATTRIBUTE_T4038919363_H #ifndef XMLATTRIBUTEATTRIBUTE_T2511360870_H #define XMLATTRIBUTEATTRIBUTE_T2511360870_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Xml.Serialization.XmlAttributeAttribute struct XmlAttributeAttribute_t2511360870 : public Attribute_t861562559 { public: // System.String System.Xml.Serialization.XmlAttributeAttribute::attributeName String_t* ___attributeName_0; // System.String System.Xml.Serialization.XmlAttributeAttribute::dataType String_t* ___dataType_1; public: inline static int32_t get_offset_of_attributeName_0() { return static_cast<int32_t>(offsetof(XmlAttributeAttribute_t2511360870, ___attributeName_0)); } inline String_t* get_attributeName_0() const { return ___attributeName_0; } inline String_t** get_address_of_attributeName_0() { return &___attributeName_0; } inline void set_attributeName_0(String_t* value) { ___attributeName_0 = value; Il2CppCodeGenWriteBarrier((&___attributeName_0), value); } inline static int32_t get_offset_of_dataType_1() { return static_cast<int32_t>(offsetof(XmlAttributeAttribute_t2511360870, ___dataType_1)); } inline String_t* get_dataType_1() const { return ___dataType_1; } inline String_t** get_address_of_dataType_1() { return &___dataType_1; } inline void set_dataType_1(String_t* value) { ___dataType_1 = value; Il2CppCodeGenWriteBarrier((&___dataType_1), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // XMLATTRIBUTEATTRIBUTE_T2511360870_H #ifndef XMLELEMENTATTRIBUTE_T17472343_H #define XMLELEMENTATTRIBUTE_T17472343_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Xml.Serialization.XmlElementAttribute struct XmlElementAttribute_t17472343 : public Attribute_t861562559 { public: // System.String System.Xml.Serialization.XmlElementAttribute::elementName String_t* ___elementName_0; // System.Type System.Xml.Serialization.XmlElementAttribute::type Type_t * ___type_1; // System.Int32 System.Xml.Serialization.XmlElementAttribute::order int32_t ___order_2; public: inline static int32_t get_offset_of_elementName_0() { return static_cast<int32_t>(offsetof(XmlElementAttribute_t17472343, ___elementName_0)); } inline String_t* get_elementName_0() const { return ___elementName_0; } inline String_t** get_address_of_elementName_0() { return &___elementName_0; } inline void set_elementName_0(String_t* value) { ___elementName_0 = value; Il2CppCodeGenWriteBarrier((&___elementName_0), value); } inline static int32_t get_offset_of_type_1() { return static_cast<int32_t>(offsetof(XmlElementAttribute_t17472343, ___type_1)); } inline Type_t * get_type_1() const { return ___type_1; } inline Type_t ** get_address_of_type_1() { return &___type_1; } inline void set_type_1(Type_t * value) { ___type_1 = value; Il2CppCodeGenWriteBarrier((&___type_1), value); } inline static int32_t get_offset_of_order_2() { return static_cast<int32_t>(offsetof(XmlElementAttribute_t17472343, ___order_2)); } inline int32_t get_order_2() const { return ___order_2; } inline int32_t* get_address_of_order_2() { return &___order_2; } inline void set_order_2(int32_t value) { ___order_2 = value; } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // XMLELEMENTATTRIBUTE_T17472343_H #ifndef XMLSCHEMAREADER_T1164558392_H #define XMLSCHEMAREADER_T1164558392_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Xml.Schema.XmlSchemaReader struct XmlSchemaReader_t1164558392 : public XmlReader_t3121518892 { public: // System.Xml.XmlReader System.Xml.Schema.XmlSchemaReader::reader XmlReader_t3121518892 * ___reader_2; // System.Xml.Schema.ValidationEventHandler System.Xml.Schema.XmlSchemaReader::handler ValidationEventHandler_t791314227 * ___handler_3; // System.Boolean System.Xml.Schema.XmlSchemaReader::hasLineInfo bool ___hasLineInfo_4; public: inline static int32_t get_offset_of_reader_2() { return static_cast<int32_t>(offsetof(XmlSchemaReader_t1164558392, ___reader_2)); } inline XmlReader_t3121518892 * get_reader_2() const { return ___reader_2; } inline XmlReader_t3121518892 ** get_address_of_reader_2() { return &___reader_2; } inline void set_reader_2(XmlReader_t3121518892 * value) { ___reader_2 = value; Il2CppCodeGenWriteBarrier((&___reader_2), value); } inline static int32_t get_offset_of_handler_3() { return static_cast<int32_t>(offsetof(XmlSchemaReader_t1164558392, ___handler_3)); } inline ValidationEventHandler_t791314227 * get_handler_3() const { return ___handler_3; } inline ValidationEventHandler_t791314227 ** get_address_of_handler_3() { return &___handler_3; } inline void set_handler_3(ValidationEventHandler_t791314227 * value) { ___handler_3 = value; Il2CppCodeGenWriteBarrier((&___handler_3), value); } inline static int32_t get_offset_of_hasLineInfo_4() { return static_cast<int32_t>(offsetof(XmlSchemaReader_t1164558392, ___hasLineInfo_4)); } inline bool get_hasLineInfo_4() const { return ___hasLineInfo_4; } inline bool* get_address_of_hasLineInfo_4() { return &___hasLineInfo_4; } inline void set_hasLineInfo_4(bool value) { ___hasLineInfo_4 = value; } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // XMLSCHEMAREADER_T1164558392_H #ifndef XMLANYATTRIBUTEATTRIBUTE_T1449326428_H #define XMLANYATTRIBUTEATTRIBUTE_T1449326428_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Xml.Serialization.XmlAnyAttributeAttribute struct XmlAnyAttributeAttribute_t1449326428 : public Attribute_t861562559 { public: public: }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // XMLANYATTRIBUTEATTRIBUTE_T1449326428_H #ifndef INTPTR_T_H #define INTPTR_T_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.IntPtr struct IntPtr_t { public: // System.Void* System.IntPtr::m_value void* ___m_value_0; public: inline static int32_t get_offset_of_m_value_0() { return static_cast<int32_t>(offsetof(IntPtr_t, ___m_value_0)); } inline void* get_m_value_0() const { return ___m_value_0; } inline void** get_address_of_m_value_0() { return &___m_value_0; } inline void set_m_value_0(void* value) { ___m_value_0 = value; } }; struct IntPtr_t_StaticFields { public: // System.IntPtr System.IntPtr::Zero intptr_t ___Zero_1; public: inline static int32_t get_offset_of_Zero_1() { return static_cast<int32_t>(offsetof(IntPtr_t_StaticFields, ___Zero_1)); } inline intptr_t get_Zero_1() const { return ___Zero_1; } inline intptr_t* get_address_of_Zero_1() { return &___Zero_1; } inline void set_Zero_1(intptr_t value) { ___Zero_1 = value; } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // INTPTR_T_H #ifndef ENUM_T4135868527_H #define ENUM_T4135868527_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Enum struct Enum_t4135868527 : public ValueType_t3640485471 { public: public: }; struct Enum_t4135868527_StaticFields { public: // System.Char[] System.Enum::split_char CharU5BU5D_t3528271667* ___split_char_0; public: inline static int32_t get_offset_of_split_char_0() { return static_cast<int32_t>(offsetof(Enum_t4135868527_StaticFields, ___split_char_0)); } inline CharU5BU5D_t3528271667* get_split_char_0() const { return ___split_char_0; } inline CharU5BU5D_t3528271667** get_address_of_split_char_0() { return &___split_char_0; } inline void set_split_char_0(CharU5BU5D_t3528271667* value) { ___split_char_0 = value; Il2CppCodeGenWriteBarrier((&___split_char_0), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif // Native definition for P/Invoke marshalling of System.Enum struct Enum_t4135868527_marshaled_pinvoke { }; // Native definition for COM marshalling of System.Enum struct Enum_t4135868527_marshaled_com { }; #endif // ENUM_T4135868527_H #ifndef GUID_T_H #define GUID_T_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Guid struct Guid_t { public: // System.Int32 System.Guid::_a int32_t ____a_0; // System.Int16 System.Guid::_b int16_t ____b_1; // System.Int16 System.Guid::_c int16_t ____c_2; // System.Byte System.Guid::_d uint8_t ____d_3; // System.Byte System.Guid::_e uint8_t ____e_4; // System.Byte System.Guid::_f uint8_t ____f_5; // System.Byte System.Guid::_g uint8_t ____g_6; // System.Byte System.Guid::_h uint8_t ____h_7; // System.Byte System.Guid::_i uint8_t ____i_8; // System.Byte System.Guid::_j uint8_t ____j_9; // System.Byte System.Guid::_k uint8_t ____k_10; public: inline static int32_t get_offset_of__a_0() { return static_cast<int32_t>(offsetof(Guid_t, ____a_0)); } inline int32_t get__a_0() const { return ____a_0; } inline int32_t* get_address_of__a_0() { return &____a_0; } inline void set__a_0(int32_t value) { ____a_0 = value; } inline static int32_t get_offset_of__b_1() { return static_cast<int32_t>(offsetof(Guid_t, ____b_1)); } inline int16_t get__b_1() const { return ____b_1; } inline int16_t* get_address_of__b_1() { return &____b_1; } inline void set__b_1(int16_t value) { ____b_1 = value; } inline static int32_t get_offset_of__c_2() { return static_cast<int32_t>(offsetof(Guid_t, ____c_2)); } inline int16_t get__c_2() const { return ____c_2; } inline int16_t* get_address_of__c_2() { return &____c_2; } inline void set__c_2(int16_t value) { ____c_2 = value; } inline static int32_t get_offset_of__d_3() { return static_cast<int32_t>(offsetof(Guid_t, ____d_3)); } inline uint8_t get__d_3() const { return ____d_3; } inline uint8_t* get_address_of__d_3() { return &____d_3; } inline void set__d_3(uint8_t value) { ____d_3 = value; } inline static int32_t get_offset_of__e_4() { return static_cast<int32_t>(offsetof(Guid_t, ____e_4)); } inline uint8_t get__e_4() const { return ____e_4; } inline uint8_t* get_address_of__e_4() { return &____e_4; } inline void set__e_4(uint8_t value) { ____e_4 = value; } inline static int32_t get_offset_of__f_5() { return static_cast<int32_t>(offsetof(Guid_t, ____f_5)); } inline uint8_t get__f_5() const { return ____f_5; } inline uint8_t* get_address_of__f_5() { return &____f_5; } inline void set__f_5(uint8_t value) { ____f_5 = value; } inline static int32_t get_offset_of__g_6() { return static_cast<int32_t>(offsetof(Guid_t, ____g_6)); } inline uint8_t get__g_6() const { return ____g_6; } inline uint8_t* get_address_of__g_6() { return &____g_6; } inline void set__g_6(uint8_t value) { ____g_6 = value; } inline static int32_t get_offset_of__h_7() { return static_cast<int32_t>(offsetof(Guid_t, ____h_7)); } inline uint8_t get__h_7() const { return ____h_7; } inline uint8_t* get_address_of__h_7() { return &____h_7; } inline void set__h_7(uint8_t value) { ____h_7 = value; } inline static int32_t get_offset_of__i_8() { return static_cast<int32_t>(offsetof(Guid_t, ____i_8)); } inline uint8_t get__i_8() const { return ____i_8; } inline uint8_t* get_address_of__i_8() { return &____i_8; } inline void set__i_8(uint8_t value) { ____i_8 = value; } inline static int32_t get_offset_of__j_9() { return static_cast<int32_t>(offsetof(Guid_t, ____j_9)); } inline uint8_t get__j_9() const { return ____j_9; } inline uint8_t* get_address_of__j_9() { return &____j_9; } inline void set__j_9(uint8_t value) { ____j_9 = value; } inline static int32_t get_offset_of__k_10() { return static_cast<int32_t>(offsetof(Guid_t, ____k_10)); } inline uint8_t get__k_10() const { return ____k_10; } inline uint8_t* get_address_of__k_10() { return &____k_10; } inline void set__k_10(uint8_t value) { ____k_10 = value; } }; struct Guid_t_StaticFields { public: // System.Guid System.Guid::Empty Guid_t ___Empty_11; // System.Object System.Guid::_rngAccess RuntimeObject * ____rngAccess_12; // System.Security.Cryptography.RandomNumberGenerator System.Guid::_rng RandomNumberGenerator_t386037858 * ____rng_13; // System.Security.Cryptography.RandomNumberGenerator System.Guid::_fastRng RandomNumberGenerator_t386037858 * ____fastRng_14; public: inline static int32_t get_offset_of_Empty_11() { return static_cast<int32_t>(offsetof(Guid_t_StaticFields, ___Empty_11)); } inline Guid_t get_Empty_11() const { return ___Empty_11; } inline Guid_t * get_address_of_Empty_11() { return &___Empty_11; } inline void set_Empty_11(Guid_t value) { ___Empty_11 = value; } inline static int32_t get_offset_of__rngAccess_12() { return static_cast<int32_t>(offsetof(Guid_t_StaticFields, ____rngAccess_12)); } inline RuntimeObject * get__rngAccess_12() const { return ____rngAccess_12; } inline RuntimeObject ** get_address_of__rngAccess_12() { return &____rngAccess_12; } inline void set__rngAccess_12(RuntimeObject * value) { ____rngAccess_12 = value; Il2CppCodeGenWriteBarrier((&____rngAccess_12), value); } inline static int32_t get_offset_of__rng_13() { return static_cast<int32_t>(offsetof(Guid_t_StaticFields, ____rng_13)); } inline RandomNumberGenerator_t386037858 * get__rng_13() const { return ____rng_13; } inline RandomNumberGenerator_t386037858 ** get_address_of__rng_13() { return &____rng_13; } inline void set__rng_13(RandomNumberGenerator_t386037858 * value) { ____rng_13 = value; Il2CppCodeGenWriteBarrier((&____rng_13), value); } inline static int32_t get_offset_of__fastRng_14() { return static_cast<int32_t>(offsetof(Guid_t_StaticFields, ____fastRng_14)); } inline RandomNumberGenerator_t386037858 * get__fastRng_14() const { return ____fastRng_14; } inline RandomNumberGenerator_t386037858 ** get_address_of__fastRng_14() { return &____fastRng_14; } inline void set__fastRng_14(RandomNumberGenerator_t386037858 * value) { ____fastRng_14 = value; Il2CppCodeGenWriteBarrier((&____fastRng_14), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // GUID_T_H #ifndef SEQUENTIALSEARCHPRIMEGENERATORBASE_T2996090509_H #define SEQUENTIALSEARCHPRIMEGENERATORBASE_T2996090509_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // Mono.Math.Prime.Generator.SequentialSearchPrimeGeneratorBase struct SequentialSearchPrimeGeneratorBase_t2996090509 : public PrimeGeneratorBase_t446028867 { public: public: }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // SEQUENTIALSEARCHPRIMEGENERATORBASE_T2996090509_H #ifndef DECIMAL_T2948259380_H #define DECIMAL_T2948259380_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Decimal struct Decimal_t2948259380 { public: // System.UInt32 System.Decimal::flags uint32_t ___flags_5; // System.UInt32 System.Decimal::hi uint32_t ___hi_6; // System.UInt32 System.Decimal::lo uint32_t ___lo_7; // System.UInt32 System.Decimal::mid uint32_t ___mid_8; public: inline static int32_t get_offset_of_flags_5() { return static_cast<int32_t>(offsetof(Decimal_t2948259380, ___flags_5)); } inline uint32_t get_flags_5() const { return ___flags_5; } inline uint32_t* get_address_of_flags_5() { return &___flags_5; } inline void set_flags_5(uint32_t value) { ___flags_5 = value; } inline static int32_t get_offset_of_hi_6() { return static_cast<int32_t>(offsetof(Decimal_t2948259380, ___hi_6)); } inline uint32_t get_hi_6() const { return ___hi_6; } inline uint32_t* get_address_of_hi_6() { return &___hi_6; } inline void set_hi_6(uint32_t value) { ___hi_6 = value; } inline static int32_t get_offset_of_lo_7() { return static_cast<int32_t>(offsetof(Decimal_t2948259380, ___lo_7)); } inline uint32_t get_lo_7() const { return ___lo_7; } inline uint32_t* get_address_of_lo_7() { return &___lo_7; } inline void set_lo_7(uint32_t value) { ___lo_7 = value; } inline static int32_t get_offset_of_mid_8() { return static_cast<int32_t>(offsetof(Decimal_t2948259380, ___mid_8)); } inline uint32_t get_mid_8() const { return ___mid_8; } inline uint32_t* get_address_of_mid_8() { return &___mid_8; } inline void set_mid_8(uint32_t value) { ___mid_8 = value; } }; struct Decimal_t2948259380_StaticFields { public: // System.Decimal System.Decimal::MinValue Decimal_t2948259380 ___MinValue_0; // System.Decimal System.Decimal::MaxValue Decimal_t2948259380 ___MaxValue_1; // System.Decimal System.Decimal::MinusOne Decimal_t2948259380 ___MinusOne_2; // System.Decimal System.Decimal::One Decimal_t2948259380 ___One_3; // System.Decimal System.Decimal::MaxValueDiv10 Decimal_t2948259380 ___MaxValueDiv10_4; public: inline static int32_t get_offset_of_MinValue_0() { return static_cast<int32_t>(offsetof(Decimal_t2948259380_StaticFields, ___MinValue_0)); } inline Decimal_t2948259380 get_MinValue_0() const { return ___MinValue_0; } inline Decimal_t2948259380 * get_address_of_MinValue_0() { return &___MinValue_0; } inline void set_MinValue_0(Decimal_t2948259380 value) { ___MinValue_0 = value; } inline static int32_t get_offset_of_MaxValue_1() { return static_cast<int32_t>(offsetof(Decimal_t2948259380_StaticFields, ___MaxValue_1)); } inline Decimal_t2948259380 get_MaxValue_1() const { return ___MaxValue_1; } inline Decimal_t2948259380 * get_address_of_MaxValue_1() { return &___MaxValue_1; } inline void set_MaxValue_1(Decimal_t2948259380 value) { ___MaxValue_1 = value; } inline static int32_t get_offset_of_MinusOne_2() { return static_cast<int32_t>(offsetof(Decimal_t2948259380_StaticFields, ___MinusOne_2)); } inline Decimal_t2948259380 get_MinusOne_2() const { return ___MinusOne_2; } inline Decimal_t2948259380 * get_address_of_MinusOne_2() { return &___MinusOne_2; } inline void set_MinusOne_2(Decimal_t2948259380 value) { ___MinusOne_2 = value; } inline static int32_t get_offset_of_One_3() { return static_cast<int32_t>(offsetof(Decimal_t2948259380_StaticFields, ___One_3)); } inline Decimal_t2948259380 get_One_3() const { return ___One_3; } inline Decimal_t2948259380 * get_address_of_One_3() { return &___One_3; } inline void set_One_3(Decimal_t2948259380 value) { ___One_3 = value; } inline static int32_t get_offset_of_MaxValueDiv10_4() { return static_cast<int32_t>(offsetof(Decimal_t2948259380_StaticFields, ___MaxValueDiv10_4)); } inline Decimal_t2948259380 get_MaxValueDiv10_4() const { return ___MaxValueDiv10_4; } inline Decimal_t2948259380 * get_address_of_MaxValueDiv10_4() { return &___MaxValueDiv10_4; } inline void set_MaxValueDiv10_4(Decimal_t2948259380 value) { ___MaxValueDiv10_4 = value; } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // DECIMAL_T2948259380_H #ifndef VOID_T1185182177_H #define VOID_T1185182177_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Void struct Void_t1185182177 { public: public: }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // VOID_T1185182177_H #ifndef U24ARRAYTYPEU241280_T4290130235_H #define U24ARRAYTYPEU241280_T4290130235_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // <PrivateImplementationDetails>/$ArrayType$1280 struct U24ArrayTypeU241280_t4290130235 { public: union { struct { union { }; }; uint8_t U24ArrayTypeU241280_t4290130235__padding[1280]; }; public: }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // U24ARRAYTYPEU241280_T4290130235_H #ifndef U24ARRAYTYPEU24256_T1929481983_H #define U24ARRAYTYPEU24256_T1929481983_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // <PrivateImplementationDetails>/$ArrayType$256 struct U24ArrayTypeU24256_t1929481983 { public: union { struct { union { }; }; uint8_t U24ArrayTypeU24256_t1929481983__padding[256]; }; public: }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // U24ARRAYTYPEU24256_T1929481983_H #ifndef U24ARRAYTYPEU248_T3244137464_H #define U24ARRAYTYPEU248_T3244137464_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // <PrivateImplementationDetails>/$ArrayType$8 struct U24ArrayTypeU248_t3244137464 { public: union { struct { union { }; }; uint8_t U24ArrayTypeU248_t3244137464__padding[8]; }; public: }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // U24ARRAYTYPEU248_T3244137464_H #ifndef U24ARRAYTYPEU2412_T2490092597_H #define U24ARRAYTYPEU2412_T2490092597_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // <PrivateImplementationDetails>/$ArrayType$12 struct U24ArrayTypeU2412_t2490092597 { public: union { struct { union { }; }; uint8_t U24ArrayTypeU2412_t2490092597__padding[12]; }; public: }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // U24ARRAYTYPEU2412_T2490092597_H #ifndef XMLTEXTATTRIBUTE_T499390083_H #define XMLTEXTATTRIBUTE_T499390083_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Xml.Serialization.XmlTextAttribute struct XmlTextAttribute_t499390083 : public Attribute_t861562559 { public: public: }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // XMLTEXTATTRIBUTE_T499390083_H #ifndef SYSTEMEXCEPTION_T176217640_H #define SYSTEMEXCEPTION_T176217640_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.SystemException struct SystemException_t176217640 : public Exception_t { public: public: }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // SYSTEMEXCEPTION_T176217640_H #ifndef XMLSCHEMAVALIDATIONFLAGS_T877176585_H #define XMLSCHEMAVALIDATIONFLAGS_T877176585_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Xml.Schema.XmlSchemaValidationFlags struct XmlSchemaValidationFlags_t877176585 { public: // System.Int32 System.Xml.Schema.XmlSchemaValidationFlags::value__ int32_t ___value___1; public: inline static int32_t get_offset_of_value___1() { return static_cast<int32_t>(offsetof(XmlSchemaValidationFlags_t877176585, ___value___1)); } inline int32_t get_value___1() const { return ___value___1; } inline int32_t* get_address_of_value___1() { return &___value___1; } inline void set_value___1(int32_t value) { ___value___1 = value; } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // XMLSCHEMAVALIDATIONFLAGS_T877176585_H #ifndef DELEGATE_T1188392813_H #define DELEGATE_T1188392813_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Delegate struct Delegate_t1188392813 : public RuntimeObject { public: // System.IntPtr System.Delegate::method_ptr Il2CppMethodPointer ___method_ptr_0; // System.IntPtr System.Delegate::invoke_impl intptr_t ___invoke_impl_1; // System.Object System.Delegate::m_target RuntimeObject * ___m_target_2; // System.IntPtr System.Delegate::method intptr_t ___method_3; // System.IntPtr System.Delegate::delegate_trampoline intptr_t ___delegate_trampoline_4; // System.IntPtr System.Delegate::method_code intptr_t ___method_code_5; // System.Reflection.MethodInfo System.Delegate::method_info MethodInfo_t * ___method_info_6; // System.Reflection.MethodInfo System.Delegate::original_method_info MethodInfo_t * ___original_method_info_7; // System.DelegateData System.Delegate::data DelegateData_t1677132599 * ___data_8; public: inline static int32_t get_offset_of_method_ptr_0() { return static_cast<int32_t>(offsetof(Delegate_t1188392813, ___method_ptr_0)); } inline Il2CppMethodPointer get_method_ptr_0() const { return ___method_ptr_0; } inline Il2CppMethodPointer* get_address_of_method_ptr_0() { return &___method_ptr_0; } inline void set_method_ptr_0(Il2CppMethodPointer value) { ___method_ptr_0 = value; } inline static int32_t get_offset_of_invoke_impl_1() { return static_cast<int32_t>(offsetof(Delegate_t1188392813, ___invoke_impl_1)); } inline intptr_t get_invoke_impl_1() const { return ___invoke_impl_1; } inline intptr_t* get_address_of_invoke_impl_1() { return &___invoke_impl_1; } inline void set_invoke_impl_1(intptr_t value) { ___invoke_impl_1 = value; } inline static int32_t get_offset_of_m_target_2() { return static_cast<int32_t>(offsetof(Delegate_t1188392813, ___m_target_2)); } inline RuntimeObject * get_m_target_2() const { return ___m_target_2; } inline RuntimeObject ** get_address_of_m_target_2() { return &___m_target_2; } inline void set_m_target_2(RuntimeObject * value) { ___m_target_2 = value; Il2CppCodeGenWriteBarrier((&___m_target_2), value); } inline static int32_t get_offset_of_method_3() { return static_cast<int32_t>(offsetof(Delegate_t1188392813, ___method_3)); } inline intptr_t get_method_3() const { return ___method_3; } inline intptr_t* get_address_of_method_3() { return &___method_3; } inline void set_method_3(intptr_t value) { ___method_3 = value; } inline static int32_t get_offset_of_delegate_trampoline_4() { return static_cast<int32_t>(offsetof(Delegate_t1188392813, ___delegate_trampoline_4)); } inline intptr_t get_delegate_trampoline_4() const { return ___delegate_trampoline_4; } inline intptr_t* get_address_of_delegate_trampoline_4() { return &___delegate_trampoline_4; } inline void set_delegate_trampoline_4(intptr_t value) { ___delegate_trampoline_4 = value; } inline static int32_t get_offset_of_method_code_5() { return static_cast<int32_t>(offsetof(Delegate_t1188392813, ___method_code_5)); } inline intptr_t get_method_code_5() const { return ___method_code_5; } inline intptr_t* get_address_of_method_code_5() { return &___method_code_5; } inline void set_method_code_5(intptr_t value) { ___method_code_5 = value; } inline static int32_t get_offset_of_method_info_6() { return static_cast<int32_t>(offsetof(Delegate_t1188392813, ___method_info_6)); } inline MethodInfo_t * get_method_info_6() const { return ___method_info_6; } inline MethodInfo_t ** get_address_of_method_info_6() { return &___method_info_6; } inline void set_method_info_6(MethodInfo_t * value) { ___method_info_6 = value; Il2CppCodeGenWriteBarrier((&___method_info_6), value); } inline static int32_t get_offset_of_original_method_info_7() { return static_cast<int32_t>(offsetof(Delegate_t1188392813, ___original_method_info_7)); } inline MethodInfo_t * get_original_method_info_7() const { return ___original_method_info_7; } inline MethodInfo_t ** get_address_of_original_method_info_7() { return &___original_method_info_7; } inline void set_original_method_info_7(MethodInfo_t * value) { ___original_method_info_7 = value; Il2CppCodeGenWriteBarrier((&___original_method_info_7), value); } inline static int32_t get_offset_of_data_8() { return static_cast<int32_t>(offsetof(Delegate_t1188392813, ___data_8)); } inline DelegateData_t1677132599 * get_data_8() const { return ___data_8; } inline DelegateData_t1677132599 ** get_address_of_data_8() { return &___data_8; } inline void set_data_8(DelegateData_t1677132599 * value) { ___data_8 = value; Il2CppCodeGenWriteBarrier((&___data_8), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // DELEGATE_T1188392813_H #ifndef XMLSEVERITYTYPE_T1894651412_H #define XMLSEVERITYTYPE_T1894651412_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Xml.Schema.XmlSeverityType struct XmlSeverityType_t1894651412 { public: // System.Int32 System.Xml.Schema.XmlSeverityType::value__ int32_t ___value___1; public: inline static int32_t get_offset_of_value___1() { return static_cast<int32_t>(offsetof(XmlSeverityType_t1894651412, ___value___1)); } inline int32_t get_value___1() const { return ___value___1; } inline int32_t* get_address_of_value___1() { return &___value___1; } inline void set_value___1(int32_t value) { ___value___1 = value; } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // XMLSEVERITYTYPE_T1894651412_H #ifndef XMLSCHEMAVALIDITY_T3794542157_H #define XMLSCHEMAVALIDITY_T3794542157_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Xml.Schema.XmlSchemaValidity struct XmlSchemaValidity_t3794542157 { public: // System.Int32 System.Xml.Schema.XmlSchemaValidity::value__ int32_t ___value___1; public: inline static int32_t get_offset_of_value___1() { return static_cast<int32_t>(offsetof(XmlSchemaValidity_t3794542157, ___value___1)); } inline int32_t get_value___1() const { return ___value___1; } inline int32_t* get_address_of_value___1() { return &___value___1; } inline void set_value___1(int32_t value) { ___value___1 = value; } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // XMLSCHEMAVALIDITY_T3794542157_H #ifndef XMLSCHEMAUSE_T647315988_H #define XMLSCHEMAUSE_T647315988_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Xml.Schema.XmlSchemaUse struct XmlSchemaUse_t647315988 { public: // System.Int32 System.Xml.Schema.XmlSchemaUse::value__ int32_t ___value___1; public: inline static int32_t get_offset_of_value___1() { return static_cast<int32_t>(offsetof(XmlSchemaUse_t647315988, ___value___1)); } inline int32_t get_value___1() const { return ___value___1; } inline int32_t* get_address_of_value___1() { return &___value___1; } inline void set_value___1(int32_t value) { ___value___1 = value; } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // XMLSCHEMAUSE_T647315988_H #ifndef XMLTYPECODE_T2623622950_H #define XMLTYPECODE_T2623622950_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Xml.Schema.XmlTypeCode struct XmlTypeCode_t2623622950 { public: // System.Int32 System.Xml.Schema.XmlTypeCode::value__ int32_t ___value___1; public: inline static int32_t get_offset_of_value___1() { return static_cast<int32_t>(offsetof(XmlTypeCode_t2623622950, ___value___1)); } inline int32_t get_value___1() const { return ___value___1; } inline int32_t* get_address_of_value___1() { return &___value___1; } inline void set_value___1(int32_t value) { ___value___1 = value; } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // XMLTYPECODE_T2623622950_H #ifndef U3CPRIVATEIMPLEMENTATIONDETAILSU3E_T3057255362_H #define U3CPRIVATEIMPLEMENTATIONDETAILSU3E_T3057255362_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // <PrivateImplementationDetails> struct U3CPrivateImplementationDetailsU3E_t3057255362 : public RuntimeObject { public: public: }; struct U3CPrivateImplementationDetailsU3E_t3057255362_StaticFields { public: // <PrivateImplementationDetails>/$ArrayType$8 <PrivateImplementationDetails>::$$field-36 U24ArrayTypeU248_t3244137464 ___U24U24fieldU2D36_0; // <PrivateImplementationDetails>/$ArrayType$256 <PrivateImplementationDetails>::$$field-37 U24ArrayTypeU24256_t1929481983 ___U24U24fieldU2D37_1; // <PrivateImplementationDetails>/$ArrayType$256 <PrivateImplementationDetails>::$$field-38 U24ArrayTypeU24256_t1929481983 ___U24U24fieldU2D38_2; // <PrivateImplementationDetails>/$ArrayType$1280 <PrivateImplementationDetails>::$$field-39 U24ArrayTypeU241280_t4290130235 ___U24U24fieldU2D39_3; // <PrivateImplementationDetails>/$ArrayType$12 <PrivateImplementationDetails>::$$field-40 U24ArrayTypeU2412_t2490092597 ___U24U24fieldU2D40_4; // <PrivateImplementationDetails>/$ArrayType$12 <PrivateImplementationDetails>::$$field-41 U24ArrayTypeU2412_t2490092597 ___U24U24fieldU2D41_5; // <PrivateImplementationDetails>/$ArrayType$8 <PrivateImplementationDetails>::$$field-43 U24ArrayTypeU248_t3244137464 ___U24U24fieldU2D43_6; // <PrivateImplementationDetails>/$ArrayType$8 <PrivateImplementationDetails>::$$field-44 U24ArrayTypeU248_t3244137464 ___U24U24fieldU2D44_7; public: inline static int32_t get_offset_of_U24U24fieldU2D36_0() { return static_cast<int32_t>(offsetof(U3CPrivateImplementationDetailsU3E_t3057255362_StaticFields, ___U24U24fieldU2D36_0)); } inline U24ArrayTypeU248_t3244137464 get_U24U24fieldU2D36_0() const { return ___U24U24fieldU2D36_0; } inline U24ArrayTypeU248_t3244137464 * get_address_of_U24U24fieldU2D36_0() { return &___U24U24fieldU2D36_0; } inline void set_U24U24fieldU2D36_0(U24ArrayTypeU248_t3244137464 value) { ___U24U24fieldU2D36_0 = value; } inline static int32_t get_offset_of_U24U24fieldU2D37_1() { return static_cast<int32_t>(offsetof(U3CPrivateImplementationDetailsU3E_t3057255362_StaticFields, ___U24U24fieldU2D37_1)); } inline U24ArrayTypeU24256_t1929481983 get_U24U24fieldU2D37_1() const { return ___U24U24fieldU2D37_1; } inline U24ArrayTypeU24256_t1929481983 * get_address_of_U24U24fieldU2D37_1() { return &___U24U24fieldU2D37_1; } inline void set_U24U24fieldU2D37_1(U24ArrayTypeU24256_t1929481983 value) { ___U24U24fieldU2D37_1 = value; } inline static int32_t get_offset_of_U24U24fieldU2D38_2() { return static_cast<int32_t>(offsetof(U3CPrivateImplementationDetailsU3E_t3057255362_StaticFields, ___U24U24fieldU2D38_2)); } inline U24ArrayTypeU24256_t1929481983 get_U24U24fieldU2D38_2() const { return ___U24U24fieldU2D38_2; } inline U24ArrayTypeU24256_t1929481983 * get_address_of_U24U24fieldU2D38_2() { return &___U24U24fieldU2D38_2; } inline void set_U24U24fieldU2D38_2(U24ArrayTypeU24256_t1929481983 value) { ___U24U24fieldU2D38_2 = value; } inline static int32_t get_offset_of_U24U24fieldU2D39_3() { return static_cast<int32_t>(offsetof(U3CPrivateImplementationDetailsU3E_t3057255362_StaticFields, ___U24U24fieldU2D39_3)); } inline U24ArrayTypeU241280_t4290130235 get_U24U24fieldU2D39_3() const { return ___U24U24fieldU2D39_3; } inline U24ArrayTypeU241280_t4290130235 * get_address_of_U24U24fieldU2D39_3() { return &___U24U24fieldU2D39_3; } inline void set_U24U24fieldU2D39_3(U24ArrayTypeU241280_t4290130235 value) { ___U24U24fieldU2D39_3 = value; } inline static int32_t get_offset_of_U24U24fieldU2D40_4() { return static_cast<int32_t>(offsetof(U3CPrivateImplementationDetailsU3E_t3057255362_StaticFields, ___U24U24fieldU2D40_4)); } inline U24ArrayTypeU2412_t2490092597 get_U24U24fieldU2D40_4() const { return ___U24U24fieldU2D40_4; } inline U24ArrayTypeU2412_t2490092597 * get_address_of_U24U24fieldU2D40_4() { return &___U24U24fieldU2D40_4; } inline void set_U24U24fieldU2D40_4(U24ArrayTypeU2412_t2490092597 value) { ___U24U24fieldU2D40_4 = value; } inline static int32_t get_offset_of_U24U24fieldU2D41_5() { return static_cast<int32_t>(offsetof(U3CPrivateImplementationDetailsU3E_t3057255362_StaticFields, ___U24U24fieldU2D41_5)); } inline U24ArrayTypeU2412_t2490092597 get_U24U24fieldU2D41_5() const { return ___U24U24fieldU2D41_5; } inline U24ArrayTypeU2412_t2490092597 * get_address_of_U24U24fieldU2D41_5() { return &___U24U24fieldU2D41_5; } inline void set_U24U24fieldU2D41_5(U24ArrayTypeU2412_t2490092597 value) { ___U24U24fieldU2D41_5 = value; } inline static int32_t get_offset_of_U24U24fieldU2D43_6() { return static_cast<int32_t>(offsetof(U3CPrivateImplementationDetailsU3E_t3057255362_StaticFields, ___U24U24fieldU2D43_6)); } inline U24ArrayTypeU248_t3244137464 get_U24U24fieldU2D43_6() const { return ___U24U24fieldU2D43_6; } inline U24ArrayTypeU248_t3244137464 * get_address_of_U24U24fieldU2D43_6() { return &___U24U24fieldU2D43_6; } inline void set_U24U24fieldU2D43_6(U24ArrayTypeU248_t3244137464 value) { ___U24U24fieldU2D43_6 = value; } inline static int32_t get_offset_of_U24U24fieldU2D44_7() { return static_cast<int32_t>(offsetof(U3CPrivateImplementationDetailsU3E_t3057255362_StaticFields, ___U24U24fieldU2D44_7)); } inline U24ArrayTypeU248_t3244137464 get_U24U24fieldU2D44_7() const { return ___U24U24fieldU2D44_7; } inline U24ArrayTypeU248_t3244137464 * get_address_of_U24U24fieldU2D44_7() { return &___U24U24fieldU2D44_7; } inline void set_U24U24fieldU2D44_7(U24ArrayTypeU248_t3244137464 value) { ___U24U24fieldU2D44_7 = value; } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // U3CPRIVATEIMPLEMENTATIONDETAILSU3E_T3057255362_H #ifndef SIGN_T3338384039_H #define SIGN_T3338384039_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // Mono.Math.BigInteger/Sign struct Sign_t3338384039 { public: // System.Int32 Mono.Math.BigInteger/Sign::value__ int32_t ___value___1; public: inline static int32_t get_offset_of_value___1() { return static_cast<int32_t>(offsetof(Sign_t3338384039, ___value___1)); } inline int32_t get_value___1() const { return ___value___1; } inline int32_t* get_address_of_value___1() { return &___value___1; } inline void set_value___1(int32_t value) { ___value___1 = value; } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // SIGN_T3338384039_H #ifndef CONFIDENCEFACTOR_T2516000286_H #define CONFIDENCEFACTOR_T2516000286_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // Mono.Math.Prime.ConfidenceFactor struct ConfidenceFactor_t2516000286 { public: // System.Int32 Mono.Math.Prime.ConfidenceFactor::value__ int32_t ___value___1; public: inline static int32_t get_offset_of_value___1() { return static_cast<int32_t>(offsetof(ConfidenceFactor_t2516000286, ___value___1)); } inline int32_t get_value___1() const { return ___value___1; } inline int32_t* get_address_of_value___1() { return &___value___1; } inline void set_value___1(int32_t value) { ___value___1 = value; } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // CONFIDENCEFACTOR_T2516000286_H #ifndef XSDWHITESPACEFACET_T376308449_H #define XSDWHITESPACEFACET_T376308449_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // Mono.Xml.Schema.XsdWhitespaceFacet struct XsdWhitespaceFacet_t376308449 { public: // System.Int32 Mono.Xml.Schema.XsdWhitespaceFacet::value__ int32_t ___value___1; public: inline static int32_t get_offset_of_value___1() { return static_cast<int32_t>(offsetof(XsdWhitespaceFacet_t376308449, ___value___1)); } inline int32_t get_value___1() const { return ___value___1; } inline int32_t* get_address_of_value___1() { return &___value___1; } inline void set_value___1(int32_t value) { ___value___1 = value; } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // XSDWHITESPACEFACET_T376308449_H #ifndef SCHEMATYPES_T1741406581_H #define SCHEMATYPES_T1741406581_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Xml.Serialization.SchemaTypes struct SchemaTypes_t1741406581 { public: // System.Int32 System.Xml.Serialization.SchemaTypes::value__ int32_t ___value___1; public: inline static int32_t get_offset_of_value___1() { return static_cast<int32_t>(offsetof(SchemaTypes_t1741406581, ___value___1)); } inline int32_t get_value___1() const { return ___value___1; } inline int32_t* get_address_of_value___1() { return &___value___1; } inline void set_value___1(int32_t value) { ___value___1 = value; } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // SCHEMATYPES_T1741406581_H #ifndef NUMBERSTYLES_T617258130_H #define NUMBERSTYLES_T617258130_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Globalization.NumberStyles struct NumberStyles_t617258130 { public: // System.Int32 System.Globalization.NumberStyles::value__ int32_t ___value___1; public: inline static int32_t get_offset_of_value___1() { return static_cast<int32_t>(offsetof(NumberStyles_t617258130, ___value___1)); } inline int32_t get_value___1() const { return ___value___1; } inline int32_t* get_address_of_value___1() { return &___value___1; } inline void set_value___1(int32_t value) { ___value___1 = value; } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // NUMBERSTYLES_T617258130_H #ifndef XMLSCHEMACONTENTTYPE_T3022550233_H #define XMLSCHEMACONTENTTYPE_T3022550233_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Xml.Schema.XmlSchemaContentType struct XmlSchemaContentType_t3022550233 { public: // System.Int32 System.Xml.Schema.XmlSchemaContentType::value__ int32_t ___value___1; public: inline static int32_t get_offset_of_value___1() { return static_cast<int32_t>(offsetof(XmlSchemaContentType_t3022550233, ___value___1)); } inline int32_t get_value___1() const { return ___value___1; } inline int32_t* get_address_of_value___1() { return &___value___1; } inline void set_value___1(int32_t value) { ___value___1 = value; } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // XMLSCHEMACONTENTTYPE_T3022550233_H #ifndef XMLSCHEMAEXCEPTION_T3511258692_H #define XMLSCHEMAEXCEPTION_T3511258692_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Xml.Schema.XmlSchemaException struct XmlSchemaException_t3511258692 : public SystemException_t176217640 { public: // System.Boolean System.Xml.Schema.XmlSchemaException::hasLineInfo bool ___hasLineInfo_11; // System.Int32 System.Xml.Schema.XmlSchemaException::lineNumber int32_t ___lineNumber_12; // System.Int32 System.Xml.Schema.XmlSchemaException::linePosition int32_t ___linePosition_13; // System.Xml.Schema.XmlSchemaObject System.Xml.Schema.XmlSchemaException::sourceObj XmlSchemaObject_t1315720168 * ___sourceObj_14; // System.String System.Xml.Schema.XmlSchemaException::sourceUri String_t* ___sourceUri_15; public: inline static int32_t get_offset_of_hasLineInfo_11() { return static_cast<int32_t>(offsetof(XmlSchemaException_t3511258692, ___hasLineInfo_11)); } inline bool get_hasLineInfo_11() const { return ___hasLineInfo_11; } inline bool* get_address_of_hasLineInfo_11() { return &___hasLineInfo_11; } inline void set_hasLineInfo_11(bool value) { ___hasLineInfo_11 = value; } inline static int32_t get_offset_of_lineNumber_12() { return static_cast<int32_t>(offsetof(XmlSchemaException_t3511258692, ___lineNumber_12)); } inline int32_t get_lineNumber_12() const { return ___lineNumber_12; } inline int32_t* get_address_of_lineNumber_12() { return &___lineNumber_12; } inline void set_lineNumber_12(int32_t value) { ___lineNumber_12 = value; } inline static int32_t get_offset_of_linePosition_13() { return static_cast<int32_t>(offsetof(XmlSchemaException_t3511258692, ___linePosition_13)); } inline int32_t get_linePosition_13() const { return ___linePosition_13; } inline int32_t* get_address_of_linePosition_13() { return &___linePosition_13; } inline void set_linePosition_13(int32_t value) { ___linePosition_13 = value; } inline static int32_t get_offset_of_sourceObj_14() { return static_cast<int32_t>(offsetof(XmlSchemaException_t3511258692, ___sourceObj_14)); } inline XmlSchemaObject_t1315720168 * get_sourceObj_14() const { return ___sourceObj_14; } inline XmlSchemaObject_t1315720168 ** get_address_of_sourceObj_14() { return &___sourceObj_14; } inline void set_sourceObj_14(XmlSchemaObject_t1315720168 * value) { ___sourceObj_14 = value; Il2CppCodeGenWriteBarrier((&___sourceObj_14), value); } inline static int32_t get_offset_of_sourceUri_15() { return static_cast<int32_t>(offsetof(XmlSchemaException_t3511258692, ___sourceUri_15)); } inline String_t* get_sourceUri_15() const { return ___sourceUri_15; } inline String_t** get_address_of_sourceUri_15() { return &___sourceUri_15; } inline void set_sourceUri_15(String_t* value) { ___sourceUri_15 = value; Il2CppCodeGenWriteBarrier((&___sourceUri_15), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // XMLSCHEMAEXCEPTION_T3511258692_H #ifndef FACET_T1501039206_H #define FACET_T1501039206_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Xml.Schema.XmlSchemaFacet/Facet struct Facet_t1501039206 { public: // System.Int32 System.Xml.Schema.XmlSchemaFacet/Facet::value__ int32_t ___value___1; public: inline static int32_t get_offset_of_value___1() { return static_cast<int32_t>(offsetof(Facet_t1501039206, ___value___1)); } inline int32_t get_value___1() const { return ___value___1; } inline int32_t* get_address_of_value___1() { return &___value___1; } inline void set_value___1(int32_t value) { ___value___1 = value; } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // FACET_T1501039206_H #ifndef XMLSCHEMASET_T266093086_H #define XMLSCHEMASET_T266093086_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Xml.Schema.XmlSchemaSet struct XmlSchemaSet_t266093086 : public RuntimeObject { public: // System.Xml.XmlNameTable System.Xml.Schema.XmlSchemaSet::nameTable XmlNameTable_t71772148 * ___nameTable_0; // System.Xml.XmlResolver System.Xml.Schema.XmlSchemaSet::xmlResolver XmlResolver_t626023767 * ___xmlResolver_1; // System.Collections.ArrayList System.Xml.Schema.XmlSchemaSet::schemas ArrayList_t2718874744 * ___schemas_2; // System.Xml.Schema.XmlSchemaObjectTable System.Xml.Schema.XmlSchemaSet::attributes XmlSchemaObjectTable_t2546974348 * ___attributes_3; // System.Xml.Schema.XmlSchemaObjectTable System.Xml.Schema.XmlSchemaSet::elements XmlSchemaObjectTable_t2546974348 * ___elements_4; // System.Xml.Schema.XmlSchemaObjectTable System.Xml.Schema.XmlSchemaSet::types XmlSchemaObjectTable_t2546974348 * ___types_5; // System.Collections.Hashtable System.Xml.Schema.XmlSchemaSet::idCollection Hashtable_t1853889766 * ___idCollection_6; // System.Xml.Schema.XmlSchemaObjectTable System.Xml.Schema.XmlSchemaSet::namedIdentities XmlSchemaObjectTable_t2546974348 * ___namedIdentities_7; // System.Xml.Schema.XmlSchemaCompilationSettings System.Xml.Schema.XmlSchemaSet::settings XmlSchemaCompilationSettings_t2218765537 * ___settings_8; // System.Boolean System.Xml.Schema.XmlSchemaSet::isCompiled bool ___isCompiled_9; // System.Guid System.Xml.Schema.XmlSchemaSet::CompilationId Guid_t ___CompilationId_10; // System.Xml.Schema.ValidationEventHandler System.Xml.Schema.XmlSchemaSet::ValidationEventHandler ValidationEventHandler_t791314227 * ___ValidationEventHandler_11; public: inline static int32_t get_offset_of_nameTable_0() { return static_cast<int32_t>(offsetof(XmlSchemaSet_t266093086, ___nameTable_0)); } inline XmlNameTable_t71772148 * get_nameTable_0() const { return ___nameTable_0; } inline XmlNameTable_t71772148 ** get_address_of_nameTable_0() { return &___nameTable_0; } inline void set_nameTable_0(XmlNameTable_t71772148 * value) { ___nameTable_0 = value; Il2CppCodeGenWriteBarrier((&___nameTable_0), value); } inline static int32_t get_offset_of_xmlResolver_1() { return static_cast<int32_t>(offsetof(XmlSchemaSet_t266093086, ___xmlResolver_1)); } inline XmlResolver_t626023767 * get_xmlResolver_1() const { return ___xmlResolver_1; } inline XmlResolver_t626023767 ** get_address_of_xmlResolver_1() { return &___xmlResolver_1; } inline void set_xmlResolver_1(XmlResolver_t626023767 * value) { ___xmlResolver_1 = value; Il2CppCodeGenWriteBarrier((&___xmlResolver_1), value); } inline static int32_t get_offset_of_schemas_2() { return static_cast<int32_t>(offsetof(XmlSchemaSet_t266093086, ___schemas_2)); } inline ArrayList_t2718874744 * get_schemas_2() const { return ___schemas_2; } inline ArrayList_t2718874744 ** get_address_of_schemas_2() { return &___schemas_2; } inline void set_schemas_2(ArrayList_t2718874744 * value) { ___schemas_2 = value; Il2CppCodeGenWriteBarrier((&___schemas_2), value); } inline static int32_t get_offset_of_attributes_3() { return static_cast<int32_t>(offsetof(XmlSchemaSet_t266093086, ___attributes_3)); } inline XmlSchemaObjectTable_t2546974348 * get_attributes_3() const { return ___attributes_3; } inline XmlSchemaObjectTable_t2546974348 ** get_address_of_attributes_3() { return &___attributes_3; } inline void set_attributes_3(XmlSchemaObjectTable_t2546974348 * value) { ___attributes_3 = value; Il2CppCodeGenWriteBarrier((&___attributes_3), value); } inline static int32_t get_offset_of_elements_4() { return static_cast<int32_t>(offsetof(XmlSchemaSet_t266093086, ___elements_4)); } inline XmlSchemaObjectTable_t2546974348 * get_elements_4() const { return ___elements_4; } inline XmlSchemaObjectTable_t2546974348 ** get_address_of_elements_4() { return &___elements_4; } inline void set_elements_4(XmlSchemaObjectTable_t2546974348 * value) { ___elements_4 = value; Il2CppCodeGenWriteBarrier((&___elements_4), value); } inline static int32_t get_offset_of_types_5() { return static_cast<int32_t>(offsetof(XmlSchemaSet_t266093086, ___types_5)); } inline XmlSchemaObjectTable_t2546974348 * get_types_5() const { return ___types_5; } inline XmlSchemaObjectTable_t2546974348 ** get_address_of_types_5() { return &___types_5; } inline void set_types_5(XmlSchemaObjectTable_t2546974348 * value) { ___types_5 = value; Il2CppCodeGenWriteBarrier((&___types_5), value); } inline static int32_t get_offset_of_idCollection_6() { return static_cast<int32_t>(offsetof(XmlSchemaSet_t266093086, ___idCollection_6)); } inline Hashtable_t1853889766 * get_idCollection_6() const { return ___idCollection_6; } inline Hashtable_t1853889766 ** get_address_of_idCollection_6() { return &___idCollection_6; } inline void set_idCollection_6(Hashtable_t1853889766 * value) { ___idCollection_6 = value; Il2CppCodeGenWriteBarrier((&___idCollection_6), value); } inline static int32_t get_offset_of_namedIdentities_7() { return static_cast<int32_t>(offsetof(XmlSchemaSet_t266093086, ___namedIdentities_7)); } inline XmlSchemaObjectTable_t2546974348 * get_namedIdentities_7() const { return ___namedIdentities_7; } inline XmlSchemaObjectTable_t2546974348 ** get_address_of_namedIdentities_7() { return &___namedIdentities_7; } inline void set_namedIdentities_7(XmlSchemaObjectTable_t2546974348 * value) { ___namedIdentities_7 = value; Il2CppCodeGenWriteBarrier((&___namedIdentities_7), value); } inline static int32_t get_offset_of_settings_8() { return static_cast<int32_t>(offsetof(XmlSchemaSet_t266093086, ___settings_8)); } inline XmlSchemaCompilationSettings_t2218765537 * get_settings_8() const { return ___settings_8; } inline XmlSchemaCompilationSettings_t2218765537 ** get_address_of_settings_8() { return &___settings_8; } inline void set_settings_8(XmlSchemaCompilationSettings_t2218765537 * value) { ___settings_8 = value; Il2CppCodeGenWriteBarrier((&___settings_8), value); } inline static int32_t get_offset_of_isCompiled_9() { return static_cast<int32_t>(offsetof(XmlSchemaSet_t266093086, ___isCompiled_9)); } inline bool get_isCompiled_9() const { return ___isCompiled_9; } inline bool* get_address_of_isCompiled_9() { return &___isCompiled_9; } inline void set_isCompiled_9(bool value) { ___isCompiled_9 = value; } inline static int32_t get_offset_of_CompilationId_10() { return static_cast<int32_t>(offsetof(XmlSchemaSet_t266093086, ___CompilationId_10)); } inline Guid_t get_CompilationId_10() const { return ___CompilationId_10; } inline Guid_t * get_address_of_CompilationId_10() { return &___CompilationId_10; } inline void set_CompilationId_10(Guid_t value) { ___CompilationId_10 = value; } inline static int32_t get_offset_of_ValidationEventHandler_11() { return static_cast<int32_t>(offsetof(XmlSchemaSet_t266093086, ___ValidationEventHandler_11)); } inline ValidationEventHandler_t791314227 * get_ValidationEventHandler_11() const { return ___ValidationEventHandler_11; } inline ValidationEventHandler_t791314227 ** get_address_of_ValidationEventHandler_11() { return &___ValidationEventHandler_11; } inline void set_ValidationEventHandler_11(ValidationEventHandler_t791314227 * value) { ___ValidationEventHandler_11 = value; Il2CppCodeGenWriteBarrier((&___ValidationEventHandler_11), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // XMLSCHEMASET_T266093086_H #ifndef XMLSCHEMAFORM_T4264307319_H #define XMLSCHEMAFORM_T4264307319_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Xml.Schema.XmlSchemaForm struct XmlSchemaForm_t4264307319 { public: // System.Int32 System.Xml.Schema.XmlSchemaForm::value__ int32_t ___value___1; public: inline static int32_t get_offset_of_value___1() { return static_cast<int32_t>(offsetof(XmlSchemaForm_t4264307319, ___value___1)); } inline int32_t get_value___1() const { return ___value___1; } inline int32_t* get_address_of_value___1() { return &___value___1; } inline void set_value___1(int32_t value) { ___value___1 = value; } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // XMLSCHEMAFORM_T4264307319_H #ifndef XMLSCHEMAOBJECT_T1315720168_H #define XMLSCHEMAOBJECT_T1315720168_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Xml.Schema.XmlSchemaObject struct XmlSchemaObject_t1315720168 : public RuntimeObject { public: // System.Int32 System.Xml.Schema.XmlSchemaObject::lineNumber int32_t ___lineNumber_0; // System.Int32 System.Xml.Schema.XmlSchemaObject::linePosition int32_t ___linePosition_1; // System.String System.Xml.Schema.XmlSchemaObject::sourceUri String_t* ___sourceUri_2; // System.Xml.Serialization.XmlSerializerNamespaces System.Xml.Schema.XmlSchemaObject::namespaces XmlSerializerNamespaces_t2702737953 * ___namespaces_3; // System.Collections.ArrayList System.Xml.Schema.XmlSchemaObject::unhandledAttributeList ArrayList_t2718874744 * ___unhandledAttributeList_4; // System.Boolean System.Xml.Schema.XmlSchemaObject::isCompiled bool ___isCompiled_5; // System.Int32 System.Xml.Schema.XmlSchemaObject::errorCount int32_t ___errorCount_6; // System.Guid System.Xml.Schema.XmlSchemaObject::CompilationId Guid_t ___CompilationId_7; // System.Guid System.Xml.Schema.XmlSchemaObject::ValidationId Guid_t ___ValidationId_8; // System.Boolean System.Xml.Schema.XmlSchemaObject::isRedefineChild bool ___isRedefineChild_9; // System.Boolean System.Xml.Schema.XmlSchemaObject::isRedefinedComponent bool ___isRedefinedComponent_10; // System.Xml.Schema.XmlSchemaObject System.Xml.Schema.XmlSchemaObject::redefinedObject XmlSchemaObject_t1315720168 * ___redefinedObject_11; // System.Xml.Schema.XmlSchemaObject System.Xml.Schema.XmlSchemaObject::parent XmlSchemaObject_t1315720168 * ___parent_12; public: inline static int32_t get_offset_of_lineNumber_0() { return static_cast<int32_t>(offsetof(XmlSchemaObject_t1315720168, ___lineNumber_0)); } inline int32_t get_lineNumber_0() const { return ___lineNumber_0; } inline int32_t* get_address_of_lineNumber_0() { return &___lineNumber_0; } inline void set_lineNumber_0(int32_t value) { ___lineNumber_0 = value; } inline static int32_t get_offset_of_linePosition_1() { return static_cast<int32_t>(offsetof(XmlSchemaObject_t1315720168, ___linePosition_1)); } inline int32_t get_linePosition_1() const { return ___linePosition_1; } inline int32_t* get_address_of_linePosition_1() { return &___linePosition_1; } inline void set_linePosition_1(int32_t value) { ___linePosition_1 = value; } inline static int32_t get_offset_of_sourceUri_2() { return static_cast<int32_t>(offsetof(XmlSchemaObject_t1315720168, ___sourceUri_2)); } inline String_t* get_sourceUri_2() const { return ___sourceUri_2; } inline String_t** get_address_of_sourceUri_2() { return &___sourceUri_2; } inline void set_sourceUri_2(String_t* value) { ___sourceUri_2 = value; Il2CppCodeGenWriteBarrier((&___sourceUri_2), value); } inline static int32_t get_offset_of_namespaces_3() { return static_cast<int32_t>(offsetof(XmlSchemaObject_t1315720168, ___namespaces_3)); } inline XmlSerializerNamespaces_t2702737953 * get_namespaces_3() const { return ___namespaces_3; } inline XmlSerializerNamespaces_t2702737953 ** get_address_of_namespaces_3() { return &___namespaces_3; } inline void set_namespaces_3(XmlSerializerNamespaces_t2702737953 * value) { ___namespaces_3 = value; Il2CppCodeGenWriteBarrier((&___namespaces_3), value); } inline static int32_t get_offset_of_unhandledAttributeList_4() { return static_cast<int32_t>(offsetof(XmlSchemaObject_t1315720168, ___unhandledAttributeList_4)); } inline ArrayList_t2718874744 * get_unhandledAttributeList_4() const { return ___unhandledAttributeList_4; } inline ArrayList_t2718874744 ** get_address_of_unhandledAttributeList_4() { return &___unhandledAttributeList_4; } inline void set_unhandledAttributeList_4(ArrayList_t2718874744 * value) { ___unhandledAttributeList_4 = value; Il2CppCodeGenWriteBarrier((&___unhandledAttributeList_4), value); } inline static int32_t get_offset_of_isCompiled_5() { return static_cast<int32_t>(offsetof(XmlSchemaObject_t1315720168, ___isCompiled_5)); } inline bool get_isCompiled_5() const { return ___isCompiled_5; } inline bool* get_address_of_isCompiled_5() { return &___isCompiled_5; } inline void set_isCompiled_5(bool value) { ___isCompiled_5 = value; } inline static int32_t get_offset_of_errorCount_6() { return static_cast<int32_t>(offsetof(XmlSchemaObject_t1315720168, ___errorCount_6)); } inline int32_t get_errorCount_6() const { return ___errorCount_6; } inline int32_t* get_address_of_errorCount_6() { return &___errorCount_6; } inline void set_errorCount_6(int32_t value) { ___errorCount_6 = value; } inline static int32_t get_offset_of_CompilationId_7() { return static_cast<int32_t>(offsetof(XmlSchemaObject_t1315720168, ___CompilationId_7)); } inline Guid_t get_CompilationId_7() const { return ___CompilationId_7; } inline Guid_t * get_address_of_CompilationId_7() { return &___CompilationId_7; } inline void set_CompilationId_7(Guid_t value) { ___CompilationId_7 = value; } inline static int32_t get_offset_of_ValidationId_8() { return static_cast<int32_t>(offsetof(XmlSchemaObject_t1315720168, ___ValidationId_8)); } inline Guid_t get_ValidationId_8() const { return ___ValidationId_8; } inline Guid_t * get_address_of_ValidationId_8() { return &___ValidationId_8; } inline void set_ValidationId_8(Guid_t value) { ___ValidationId_8 = value; } inline static int32_t get_offset_of_isRedefineChild_9() { return static_cast<int32_t>(offsetof(XmlSchemaObject_t1315720168, ___isRedefineChild_9)); } inline bool get_isRedefineChild_9() const { return ___isRedefineChild_9; } inline bool* get_address_of_isRedefineChild_9() { return &___isRedefineChild_9; } inline void set_isRedefineChild_9(bool value) { ___isRedefineChild_9 = value; } inline static int32_t get_offset_of_isRedefinedComponent_10() { return static_cast<int32_t>(offsetof(XmlSchemaObject_t1315720168, ___isRedefinedComponent_10)); } inline bool get_isRedefinedComponent_10() const { return ___isRedefinedComponent_10; } inline bool* get_address_of_isRedefinedComponent_10() { return &___isRedefinedComponent_10; } inline void set_isRedefinedComponent_10(bool value) { ___isRedefinedComponent_10 = value; } inline static int32_t get_offset_of_redefinedObject_11() { return static_cast<int32_t>(offsetof(XmlSchemaObject_t1315720168, ___redefinedObject_11)); } inline XmlSchemaObject_t1315720168 * get_redefinedObject_11() const { return ___redefinedObject_11; } inline XmlSchemaObject_t1315720168 ** get_address_of_redefinedObject_11() { return &___redefinedObject_11; } inline void set_redefinedObject_11(XmlSchemaObject_t1315720168 * value) { ___redefinedObject_11 = value; Il2CppCodeGenWriteBarrier((&___redefinedObject_11), value); } inline static int32_t get_offset_of_parent_12() { return static_cast<int32_t>(offsetof(XmlSchemaObject_t1315720168, ___parent_12)); } inline XmlSchemaObject_t1315720168 * get_parent_12() const { return ___parent_12; } inline XmlSchemaObject_t1315720168 ** get_address_of_parent_12() { return &___parent_12; } inline void set_parent_12(XmlSchemaObject_t1315720168 * value) { ___parent_12 = value; Il2CppCodeGenWriteBarrier((&___parent_12), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // XMLSCHEMAOBJECT_T1315720168_H #ifndef XMLSCHEMACONTENTPROCESSING_T826201100_H #define XMLSCHEMACONTENTPROCESSING_T826201100_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Xml.Schema.XmlSchemaContentProcessing struct XmlSchemaContentProcessing_t826201100 { public: // System.Int32 System.Xml.Schema.XmlSchemaContentProcessing::value__ int32_t ___value___1; public: inline static int32_t get_offset_of_value___1() { return static_cast<int32_t>(offsetof(XmlSchemaContentProcessing_t826201100, ___value___1)); } inline int32_t get_value___1() const { return ___value___1; } inline int32_t* get_address_of_value___1() { return &___value___1; } inline void set_value___1(int32_t value) { ___value___1 = value; } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // XMLSCHEMACONTENTPROCESSING_T826201100_H #ifndef XMLSCHEMADERIVATIONMETHOD_T1774354337_H #define XMLSCHEMADERIVATIONMETHOD_T1774354337_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Xml.Schema.XmlSchemaDerivationMethod struct XmlSchemaDerivationMethod_t1774354337 { public: // System.Int32 System.Xml.Schema.XmlSchemaDerivationMethod::value__ int32_t ___value___1; public: inline static int32_t get_offset_of_value___1() { return static_cast<int32_t>(offsetof(XmlSchemaDerivationMethod_t1774354337, ___value___1)); } inline int32_t get_value___1() const { return ___value___1; } inline int32_t* get_address_of_value___1() { return &___value___1; } inline void set_value___1(int32_t value) { ___value___1 = value; } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // XMLSCHEMADERIVATIONMETHOD_T1774354337_H #ifndef XMLSCHEMAVALIDATIONEXCEPTION_T816160496_H #define XMLSCHEMAVALIDATIONEXCEPTION_T816160496_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Xml.Schema.XmlSchemaValidationException struct XmlSchemaValidationException_t816160496 : public XmlSchemaException_t3511258692 { public: public: }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // XMLSCHEMAVALIDATIONEXCEPTION_T816160496_H #ifndef TYPEDATA_T476999220_H #define TYPEDATA_T476999220_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Xml.Serialization.TypeData struct TypeData_t476999220 : public RuntimeObject { public: // System.Type System.Xml.Serialization.TypeData::type Type_t * ___type_0; // System.String System.Xml.Serialization.TypeData::elementName String_t* ___elementName_1; // System.Xml.Serialization.SchemaTypes System.Xml.Serialization.TypeData::sType int32_t ___sType_2; // System.Type System.Xml.Serialization.TypeData::listItemType Type_t * ___listItemType_3; // System.String System.Xml.Serialization.TypeData::typeName String_t* ___typeName_4; // System.String System.Xml.Serialization.TypeData::fullTypeName String_t* ___fullTypeName_5; // System.Xml.Serialization.TypeData System.Xml.Serialization.TypeData::listItemTypeData TypeData_t476999220 * ___listItemTypeData_6; // System.Xml.Serialization.TypeData System.Xml.Serialization.TypeData::mappedType TypeData_t476999220 * ___mappedType_7; // System.Xml.Schema.XmlSchemaPatternFacet System.Xml.Serialization.TypeData::facet XmlSchemaPatternFacet_t3316004401 * ___facet_8; // System.Boolean System.Xml.Serialization.TypeData::hasPublicConstructor bool ___hasPublicConstructor_9; // System.Boolean System.Xml.Serialization.TypeData::nullableOverride bool ___nullableOverride_10; public: inline static int32_t get_offset_of_type_0() { return static_cast<int32_t>(offsetof(TypeData_t476999220, ___type_0)); } inline Type_t * get_type_0() const { return ___type_0; } inline Type_t ** get_address_of_type_0() { return &___type_0; } inline void set_type_0(Type_t * value) { ___type_0 = value; Il2CppCodeGenWriteBarrier((&___type_0), value); } inline static int32_t get_offset_of_elementName_1() { return static_cast<int32_t>(offsetof(TypeData_t476999220, ___elementName_1)); } inline String_t* get_elementName_1() const { return ___elementName_1; } inline String_t** get_address_of_elementName_1() { return &___elementName_1; } inline void set_elementName_1(String_t* value) { ___elementName_1 = value; Il2CppCodeGenWriteBarrier((&___elementName_1), value); } inline static int32_t get_offset_of_sType_2() { return static_cast<int32_t>(offsetof(TypeData_t476999220, ___sType_2)); } inline int32_t get_sType_2() const { return ___sType_2; } inline int32_t* get_address_of_sType_2() { return &___sType_2; } inline void set_sType_2(int32_t value) { ___sType_2 = value; } inline static int32_t get_offset_of_listItemType_3() { return static_cast<int32_t>(offsetof(TypeData_t476999220, ___listItemType_3)); } inline Type_t * get_listItemType_3() const { return ___listItemType_3; } inline Type_t ** get_address_of_listItemType_3() { return &___listItemType_3; } inline void set_listItemType_3(Type_t * value) { ___listItemType_3 = value; Il2CppCodeGenWriteBarrier((&___listItemType_3), value); } inline static int32_t get_offset_of_typeName_4() { return static_cast<int32_t>(offsetof(TypeData_t476999220, ___typeName_4)); } inline String_t* get_typeName_4() const { return ___typeName_4; } inline String_t** get_address_of_typeName_4() { return &___typeName_4; } inline void set_typeName_4(String_t* value) { ___typeName_4 = value; Il2CppCodeGenWriteBarrier((&___typeName_4), value); } inline static int32_t get_offset_of_fullTypeName_5() { return static_cast<int32_t>(offsetof(TypeData_t476999220, ___fullTypeName_5)); } inline String_t* get_fullTypeName_5() const { return ___fullTypeName_5; } inline String_t** get_address_of_fullTypeName_5() { return &___fullTypeName_5; } inline void set_fullTypeName_5(String_t* value) { ___fullTypeName_5 = value; Il2CppCodeGenWriteBarrier((&___fullTypeName_5), value); } inline static int32_t get_offset_of_listItemTypeData_6() { return static_cast<int32_t>(offsetof(TypeData_t476999220, ___listItemTypeData_6)); } inline TypeData_t476999220 * get_listItemTypeData_6() const { return ___listItemTypeData_6; } inline TypeData_t476999220 ** get_address_of_listItemTypeData_6() { return &___listItemTypeData_6; } inline void set_listItemTypeData_6(TypeData_t476999220 * value) { ___listItemTypeData_6 = value; Il2CppCodeGenWriteBarrier((&___listItemTypeData_6), value); } inline static int32_t get_offset_of_mappedType_7() { return static_cast<int32_t>(offsetof(TypeData_t476999220, ___mappedType_7)); } inline TypeData_t476999220 * get_mappedType_7() const { return ___mappedType_7; } inline TypeData_t476999220 ** get_address_of_mappedType_7() { return &___mappedType_7; } inline void set_mappedType_7(TypeData_t476999220 * value) { ___mappedType_7 = value; Il2CppCodeGenWriteBarrier((&___mappedType_7), value); } inline static int32_t get_offset_of_facet_8() { return static_cast<int32_t>(offsetof(TypeData_t476999220, ___facet_8)); } inline XmlSchemaPatternFacet_t3316004401 * get_facet_8() const { return ___facet_8; } inline XmlSchemaPatternFacet_t3316004401 ** get_address_of_facet_8() { return &___facet_8; } inline void set_facet_8(XmlSchemaPatternFacet_t3316004401 * value) { ___facet_8 = value; Il2CppCodeGenWriteBarrier((&___facet_8), value); } inline static int32_t get_offset_of_hasPublicConstructor_9() { return static_cast<int32_t>(offsetof(TypeData_t476999220, ___hasPublicConstructor_9)); } inline bool get_hasPublicConstructor_9() const { return ___hasPublicConstructor_9; } inline bool* get_address_of_hasPublicConstructor_9() { return &___hasPublicConstructor_9; } inline void set_hasPublicConstructor_9(bool value) { ___hasPublicConstructor_9 = value; } inline static int32_t get_offset_of_nullableOverride_10() { return static_cast<int32_t>(offsetof(TypeData_t476999220, ___nullableOverride_10)); } inline bool get_nullableOverride_10() const { return ___nullableOverride_10; } inline bool* get_address_of_nullableOverride_10() { return &___nullableOverride_10; } inline void set_nullableOverride_10(bool value) { ___nullableOverride_10 = value; } }; struct TypeData_t476999220_StaticFields { public: // System.String[] System.Xml.Serialization.TypeData::keywords StringU5BU5D_t1281789340* ___keywords_11; public: inline static int32_t get_offset_of_keywords_11() { return static_cast<int32_t>(offsetof(TypeData_t476999220_StaticFields, ___keywords_11)); } inline StringU5BU5D_t1281789340* get_keywords_11() const { return ___keywords_11; } inline StringU5BU5D_t1281789340** get_address_of_keywords_11() { return &___keywords_11; } inline void set_keywords_11(StringU5BU5D_t1281789340* value) { ___keywords_11 = value; Il2CppCodeGenWriteBarrier((&___keywords_11), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // TYPEDATA_T476999220_H #ifndef XMLSCHEMADOCUMENTATION_T1182960532_H #define XMLSCHEMADOCUMENTATION_T1182960532_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Xml.Schema.XmlSchemaDocumentation struct XmlSchemaDocumentation_t1182960532 : public XmlSchemaObject_t1315720168 { public: // System.String System.Xml.Schema.XmlSchemaDocumentation::language String_t* ___language_13; // System.Xml.XmlNode[] System.Xml.Schema.XmlSchemaDocumentation::markup XmlNodeU5BU5D_t3728671178* ___markup_14; // System.String System.Xml.Schema.XmlSchemaDocumentation::source String_t* ___source_15; public: inline static int32_t get_offset_of_language_13() { return static_cast<int32_t>(offsetof(XmlSchemaDocumentation_t1182960532, ___language_13)); } inline String_t* get_language_13() const { return ___language_13; } inline String_t** get_address_of_language_13() { return &___language_13; } inline void set_language_13(String_t* value) { ___language_13 = value; Il2CppCodeGenWriteBarrier((&___language_13), value); } inline static int32_t get_offset_of_markup_14() { return static_cast<int32_t>(offsetof(XmlSchemaDocumentation_t1182960532, ___markup_14)); } inline XmlNodeU5BU5D_t3728671178* get_markup_14() const { return ___markup_14; } inline XmlNodeU5BU5D_t3728671178** get_address_of_markup_14() { return &___markup_14; } inline void set_markup_14(XmlNodeU5BU5D_t3728671178* value) { ___markup_14 = value; Il2CppCodeGenWriteBarrier((&___markup_14), value); } inline static int32_t get_offset_of_source_15() { return static_cast<int32_t>(offsetof(XmlSchemaDocumentation_t1182960532, ___source_15)); } inline String_t* get_source_15() const { return ___source_15; } inline String_t** get_address_of_source_15() { return &___source_15; } inline void set_source_15(String_t* value) { ___source_15 = value; Il2CppCodeGenWriteBarrier((&___source_15), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // XMLSCHEMADOCUMENTATION_T1182960532_H #ifndef XMLSCHEMAINFO_T997462956_H #define XMLSCHEMAINFO_T997462956_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Xml.Schema.XmlSchemaInfo struct XmlSchemaInfo_t997462956 : public RuntimeObject { public: // System.Boolean System.Xml.Schema.XmlSchemaInfo::isDefault bool ___isDefault_0; // System.Boolean System.Xml.Schema.XmlSchemaInfo::isNil bool ___isNil_1; // System.Xml.Schema.XmlSchemaSimpleType System.Xml.Schema.XmlSchemaInfo::memberType XmlSchemaSimpleType_t2678868104 * ___memberType_2; // System.Xml.Schema.XmlSchemaAttribute System.Xml.Schema.XmlSchemaInfo::attr XmlSchemaAttribute_t2797257020 * ___attr_3; // System.Xml.Schema.XmlSchemaElement System.Xml.Schema.XmlSchemaInfo::elem XmlSchemaElement_t427880856 * ___elem_4; // System.Xml.Schema.XmlSchemaType System.Xml.Schema.XmlSchemaInfo::type XmlSchemaType_t2033747345 * ___type_5; // System.Xml.Schema.XmlSchemaValidity System.Xml.Schema.XmlSchemaInfo::validity int32_t ___validity_6; public: inline static int32_t get_offset_of_isDefault_0() { return static_cast<int32_t>(offsetof(XmlSchemaInfo_t997462956, ___isDefault_0)); } inline bool get_isDefault_0() const { return ___isDefault_0; } inline bool* get_address_of_isDefault_0() { return &___isDefault_0; } inline void set_isDefault_0(bool value) { ___isDefault_0 = value; } inline static int32_t get_offset_of_isNil_1() { return static_cast<int32_t>(offsetof(XmlSchemaInfo_t997462956, ___isNil_1)); } inline bool get_isNil_1() const { return ___isNil_1; } inline bool* get_address_of_isNil_1() { return &___isNil_1; } inline void set_isNil_1(bool value) { ___isNil_1 = value; } inline static int32_t get_offset_of_memberType_2() { return static_cast<int32_t>(offsetof(XmlSchemaInfo_t997462956, ___memberType_2)); } inline XmlSchemaSimpleType_t2678868104 * get_memberType_2() const { return ___memberType_2; } inline XmlSchemaSimpleType_t2678868104 ** get_address_of_memberType_2() { return &___memberType_2; } inline void set_memberType_2(XmlSchemaSimpleType_t2678868104 * value) { ___memberType_2 = value; Il2CppCodeGenWriteBarrier((&___memberType_2), value); } inline static int32_t get_offset_of_attr_3() { return static_cast<int32_t>(offsetof(XmlSchemaInfo_t997462956, ___attr_3)); } inline XmlSchemaAttribute_t2797257020 * get_attr_3() const { return ___attr_3; } inline XmlSchemaAttribute_t2797257020 ** get_address_of_attr_3() { return &___attr_3; } inline void set_attr_3(XmlSchemaAttribute_t2797257020 * value) { ___attr_3 = value; Il2CppCodeGenWriteBarrier((&___attr_3), value); } inline static int32_t get_offset_of_elem_4() { return static_cast<int32_t>(offsetof(XmlSchemaInfo_t997462956, ___elem_4)); } inline XmlSchemaElement_t427880856 * get_elem_4() const { return ___elem_4; } inline XmlSchemaElement_t427880856 ** get_address_of_elem_4() { return &___elem_4; } inline void set_elem_4(XmlSchemaElement_t427880856 * value) { ___elem_4 = value; Il2CppCodeGenWriteBarrier((&___elem_4), value); } inline static int32_t get_offset_of_type_5() { return static_cast<int32_t>(offsetof(XmlSchemaInfo_t997462956, ___type_5)); } inline XmlSchemaType_t2033747345 * get_type_5() const { return ___type_5; } inline XmlSchemaType_t2033747345 ** get_address_of_type_5() { return &___type_5; } inline void set_type_5(XmlSchemaType_t2033747345 * value) { ___type_5 = value; Il2CppCodeGenWriteBarrier((&___type_5), value); } inline static int32_t get_offset_of_validity_6() { return static_cast<int32_t>(offsetof(XmlSchemaInfo_t997462956, ___validity_6)); } inline int32_t get_validity_6() const { return ___validity_6; } inline int32_t* get_address_of_validity_6() { return &___validity_6; } inline void set_validity_6(int32_t value) { ___validity_6 = value; } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // XMLSCHEMAINFO_T997462956_H #ifndef MULTICASTDELEGATE_T_H #define MULTICASTDELEGATE_T_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.MulticastDelegate struct MulticastDelegate_t : public Delegate_t1188392813 { public: // System.MulticastDelegate System.MulticastDelegate::prev MulticastDelegate_t * ___prev_9; // System.MulticastDelegate System.MulticastDelegate::kpm_next MulticastDelegate_t * ___kpm_next_10; public: inline static int32_t get_offset_of_prev_9() { return static_cast<int32_t>(offsetof(MulticastDelegate_t, ___prev_9)); } inline MulticastDelegate_t * get_prev_9() const { return ___prev_9; } inline MulticastDelegate_t ** get_address_of_prev_9() { return &___prev_9; } inline void set_prev_9(MulticastDelegate_t * value) { ___prev_9 = value; Il2CppCodeGenWriteBarrier((&___prev_9), value); } inline static int32_t get_offset_of_kpm_next_10() { return static_cast<int32_t>(offsetof(MulticastDelegate_t, ___kpm_next_10)); } inline MulticastDelegate_t * get_kpm_next_10() const { return ___kpm_next_10; } inline MulticastDelegate_t ** get_address_of_kpm_next_10() { return &___kpm_next_10; } inline void set_kpm_next_10(MulticastDelegate_t * value) { ___kpm_next_10 = value; Il2CppCodeGenWriteBarrier((&___kpm_next_10), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // MULTICASTDELEGATE_T_H #ifndef XMLSCHEMADATATYPE_T322714710_H #define XMLSCHEMADATATYPE_T322714710_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Xml.Schema.XmlSchemaDatatype struct XmlSchemaDatatype_t322714710 : public RuntimeObject { public: // Mono.Xml.Schema.XsdWhitespaceFacet System.Xml.Schema.XmlSchemaDatatype::WhitespaceValue int32_t ___WhitespaceValue_0; // System.Text.StringBuilder System.Xml.Schema.XmlSchemaDatatype::sb StringBuilder_t * ___sb_2; public: inline static int32_t get_offset_of_WhitespaceValue_0() { return static_cast<int32_t>(offsetof(XmlSchemaDatatype_t322714710, ___WhitespaceValue_0)); } inline int32_t get_WhitespaceValue_0() const { return ___WhitespaceValue_0; } inline int32_t* get_address_of_WhitespaceValue_0() { return &___WhitespaceValue_0; } inline void set_WhitespaceValue_0(int32_t value) { ___WhitespaceValue_0 = value; } inline static int32_t get_offset_of_sb_2() { return static_cast<int32_t>(offsetof(XmlSchemaDatatype_t322714710, ___sb_2)); } inline StringBuilder_t * get_sb_2() const { return ___sb_2; } inline StringBuilder_t ** get_address_of_sb_2() { return &___sb_2; } inline void set_sb_2(StringBuilder_t * value) { ___sb_2 = value; Il2CppCodeGenWriteBarrier((&___sb_2), value); } }; struct XmlSchemaDatatype_t322714710_StaticFields { public: // System.Char[] System.Xml.Schema.XmlSchemaDatatype::wsChars CharU5BU5D_t3528271667* ___wsChars_1; // Mono.Xml.Schema.XsdAnySimpleType System.Xml.Schema.XmlSchemaDatatype::datatypeAnySimpleType XsdAnySimpleType_t1257864485 * ___datatypeAnySimpleType_3; // Mono.Xml.Schema.XsdString System.Xml.Schema.XmlSchemaDatatype::datatypeString XsdString_t3049094358 * ___datatypeString_4; // Mono.Xml.Schema.XsdNormalizedString System.Xml.Schema.XmlSchemaDatatype::datatypeNormalizedString XsdNormalizedString_t3260789355 * ___datatypeNormalizedString_5; // Mono.Xml.Schema.XsdToken System.Xml.Schema.XmlSchemaDatatype::datatypeToken XsdToken_t1239036978 * ___datatypeToken_6; // Mono.Xml.Schema.XsdLanguage System.Xml.Schema.XmlSchemaDatatype::datatypeLanguage XsdLanguage_t1876291273 * ___datatypeLanguage_7; // Mono.Xml.Schema.XsdNMToken System.Xml.Schema.XmlSchemaDatatype::datatypeNMToken XsdNMToken_t834691671 * ___datatypeNMToken_8; // Mono.Xml.Schema.XsdNMTokens System.Xml.Schema.XmlSchemaDatatype::datatypeNMTokens XsdNMTokens_t4246953255 * ___datatypeNMTokens_9; // Mono.Xml.Schema.XsdName System.Xml.Schema.XmlSchemaDatatype::datatypeName XsdName_t2755146808 * ___datatypeName_10; // Mono.Xml.Schema.XsdNCName System.Xml.Schema.XmlSchemaDatatype::datatypeNCName XsdNCName_t3943159043 * ___datatypeNCName_11; // Mono.Xml.Schema.XsdID System.Xml.Schema.XmlSchemaDatatype::datatypeID XsdID_t34704195 * ___datatypeID_12; // Mono.Xml.Schema.XsdIDRef System.Xml.Schema.XmlSchemaDatatype::datatypeIDRef XsdIDRef_t2913612829 * ___datatypeIDRef_13; // Mono.Xml.Schema.XsdIDRefs System.Xml.Schema.XmlSchemaDatatype::datatypeIDRefs XsdIDRefs_t16099206 * ___datatypeIDRefs_14; // Mono.Xml.Schema.XsdEntity System.Xml.Schema.XmlSchemaDatatype::datatypeEntity XsdEntity_t3956505874 * ___datatypeEntity_15; // Mono.Xml.Schema.XsdEntities System.Xml.Schema.XmlSchemaDatatype::datatypeEntities XsdEntities_t1477210398 * ___datatypeEntities_16; // Mono.Xml.Schema.XsdNotation System.Xml.Schema.XmlSchemaDatatype::datatypeNotation XsdNotation_t2827634056 * ___datatypeNotation_17; // Mono.Xml.Schema.XsdDecimal System.Xml.Schema.XmlSchemaDatatype::datatypeDecimal XsdDecimal_t1288601093 * ___datatypeDecimal_18; // Mono.Xml.Schema.XsdInteger System.Xml.Schema.XmlSchemaDatatype::datatypeInteger XsdInteger_t2044766898 * ___datatypeInteger_19; // Mono.Xml.Schema.XsdLong System.Xml.Schema.XmlSchemaDatatype::datatypeLong XsdLong_t1324632828 * ___datatypeLong_20; // Mono.Xml.Schema.XsdInt System.Xml.Schema.XmlSchemaDatatype::datatypeInt XsdInt_t33917785 * ___datatypeInt_21; // Mono.Xml.Schema.XsdShort System.Xml.Schema.XmlSchemaDatatype::datatypeShort XsdShort_t3489811876 * ___datatypeShort_22; // Mono.Xml.Schema.XsdByte System.Xml.Schema.XmlSchemaDatatype::datatypeByte XsdByte_t2221093920 * ___datatypeByte_23; // Mono.Xml.Schema.XsdNonNegativeInteger System.Xml.Schema.XmlSchemaDatatype::datatypeNonNegativeInteger XsdNonNegativeInteger_t308064234 * ___datatypeNonNegativeInteger_24; // Mono.Xml.Schema.XsdPositiveInteger System.Xml.Schema.XmlSchemaDatatype::datatypePositiveInteger XsdPositiveInteger_t1704031413 * ___datatypePositiveInteger_25; // Mono.Xml.Schema.XsdUnsignedLong System.Xml.Schema.XmlSchemaDatatype::datatypeUnsignedLong XsdUnsignedLong_t1409593434 * ___datatypeUnsignedLong_26; // Mono.Xml.Schema.XsdUnsignedInt System.Xml.Schema.XmlSchemaDatatype::datatypeUnsignedInt XsdUnsignedInt_t72105793 * ___datatypeUnsignedInt_27; // Mono.Xml.Schema.XsdUnsignedShort System.Xml.Schema.XmlSchemaDatatype::datatypeUnsignedShort XsdUnsignedShort_t3654069686 * ___datatypeUnsignedShort_28; // Mono.Xml.Schema.XsdUnsignedByte System.Xml.Schema.XmlSchemaDatatype::datatypeUnsignedByte XsdUnsignedByte_t2304219558 * ___datatypeUnsignedByte_29; // Mono.Xml.Schema.XsdNonPositiveInteger System.Xml.Schema.XmlSchemaDatatype::datatypeNonPositiveInteger XsdNonPositiveInteger_t1029055398 * ___datatypeNonPositiveInteger_30; // Mono.Xml.Schema.XsdNegativeInteger System.Xml.Schema.XmlSchemaDatatype::datatypeNegativeInteger XsdNegativeInteger_t2178753546 * ___datatypeNegativeInteger_31; // Mono.Xml.Schema.XsdFloat System.Xml.Schema.XmlSchemaDatatype::datatypeFloat XsdFloat_t3181928905 * ___datatypeFloat_32; // Mono.Xml.Schema.XsdDouble System.Xml.Schema.XmlSchemaDatatype::datatypeDouble XsdDouble_t3324344982 * ___datatypeDouble_33; // Mono.Xml.Schema.XsdBase64Binary System.Xml.Schema.XmlSchemaDatatype::datatypeBase64Binary XsdBase64Binary_t3360383190 * ___datatypeBase64Binary_34; // Mono.Xml.Schema.XsdBoolean System.Xml.Schema.XmlSchemaDatatype::datatypeBoolean XsdBoolean_t380164876 * ___datatypeBoolean_35; // Mono.Xml.Schema.XsdAnyURI System.Xml.Schema.XmlSchemaDatatype::datatypeAnyURI XsdAnyURI_t2755748070 * ___datatypeAnyURI_36; // Mono.Xml.Schema.XsdDuration System.Xml.Schema.XmlSchemaDatatype::datatypeDuration XsdDuration_t1555973170 * ___datatypeDuration_37; // Mono.Xml.Schema.XsdDateTime System.Xml.Schema.XmlSchemaDatatype::datatypeDateTime XsdDateTime_t2563698975 * ___datatypeDateTime_38; // Mono.Xml.Schema.XsdDate System.Xml.Schema.XmlSchemaDatatype::datatypeDate XsdDate_t1417753656 * ___datatypeDate_39; // Mono.Xml.Schema.XsdTime System.Xml.Schema.XmlSchemaDatatype::datatypeTime XsdTime_t3558487088 * ___datatypeTime_40; // Mono.Xml.Schema.XsdHexBinary System.Xml.Schema.XmlSchemaDatatype::datatypeHexBinary XsdHexBinary_t882812470 * ___datatypeHexBinary_41; // Mono.Xml.Schema.XsdQName System.Xml.Schema.XmlSchemaDatatype::datatypeQName XsdQName_t2385631467 * ___datatypeQName_42; // Mono.Xml.Schema.XsdGYearMonth System.Xml.Schema.XmlSchemaDatatype::datatypeGYearMonth XsdGYearMonth_t3399073121 * ___datatypeGYearMonth_43; // Mono.Xml.Schema.XsdGMonthDay System.Xml.Schema.XmlSchemaDatatype::datatypeGMonthDay XsdGMonthDay_t2605134399 * ___datatypeGMonthDay_44; // Mono.Xml.Schema.XsdGYear System.Xml.Schema.XmlSchemaDatatype::datatypeGYear XsdGYear_t3316212116 * ___datatypeGYear_45; // Mono.Xml.Schema.XsdGMonth System.Xml.Schema.XmlSchemaDatatype::datatypeGMonth XsdGMonth_t3913018815 * ___datatypeGMonth_46; // Mono.Xml.Schema.XsdGDay System.Xml.Schema.XmlSchemaDatatype::datatypeGDay XsdGDay_t293490745 * ___datatypeGDay_47; // Mono.Xml.Schema.XdtAnyAtomicType System.Xml.Schema.XmlSchemaDatatype::datatypeAnyAtomicType XdtAnyAtomicType_t269366253 * ___datatypeAnyAtomicType_48; // Mono.Xml.Schema.XdtUntypedAtomic System.Xml.Schema.XmlSchemaDatatype::datatypeUntypedAtomic XdtUntypedAtomic_t1388131523 * ___datatypeUntypedAtomic_49; // Mono.Xml.Schema.XdtDayTimeDuration System.Xml.Schema.XmlSchemaDatatype::datatypeDayTimeDuration XdtDayTimeDuration_t268779858 * ___datatypeDayTimeDuration_50; // Mono.Xml.Schema.XdtYearMonthDuration System.Xml.Schema.XmlSchemaDatatype::datatypeYearMonthDuration XdtYearMonthDuration_t1503718519 * ___datatypeYearMonthDuration_51; // System.Collections.Generic.Dictionary`2<System.String,System.Int32> System.Xml.Schema.XmlSchemaDatatype::<>f__switch$map3E Dictionary_2_t2736202052 * ___U3CU3Ef__switchU24map3E_52; // System.Collections.Generic.Dictionary`2<System.String,System.Int32> System.Xml.Schema.XmlSchemaDatatype::<>f__switch$map3F Dictionary_2_t2736202052 * ___U3CU3Ef__switchU24map3F_53; // System.Collections.Generic.Dictionary`2<System.String,System.Int32> System.Xml.Schema.XmlSchemaDatatype::<>f__switch$map40 Dictionary_2_t2736202052 * ___U3CU3Ef__switchU24map40_54; public: inline static int32_t get_offset_of_wsChars_1() { return static_cast<int32_t>(offsetof(XmlSchemaDatatype_t322714710_StaticFields, ___wsChars_1)); } inline CharU5BU5D_t3528271667* get_wsChars_1() const { return ___wsChars_1; } inline CharU5BU5D_t3528271667** get_address_of_wsChars_1() { return &___wsChars_1; } inline void set_wsChars_1(CharU5BU5D_t3528271667* value) { ___wsChars_1 = value; Il2CppCodeGenWriteBarrier((&___wsChars_1), value); } inline static int32_t get_offset_of_datatypeAnySimpleType_3() { return static_cast<int32_t>(offsetof(XmlSchemaDatatype_t322714710_StaticFields, ___datatypeAnySimpleType_3)); } inline XsdAnySimpleType_t1257864485 * get_datatypeAnySimpleType_3() const { return ___datatypeAnySimpleType_3; } inline XsdAnySimpleType_t1257864485 ** get_address_of_datatypeAnySimpleType_3() { return &___datatypeAnySimpleType_3; } inline void set_datatypeAnySimpleType_3(XsdAnySimpleType_t1257864485 * value) { ___datatypeAnySimpleType_3 = value; Il2CppCodeGenWriteBarrier((&___datatypeAnySimpleType_3), value); } inline static int32_t get_offset_of_datatypeString_4() { return static_cast<int32_t>(offsetof(XmlSchemaDatatype_t322714710_StaticFields, ___datatypeString_4)); } inline XsdString_t3049094358 * get_datatypeString_4() const { return ___datatypeString_4; } inline XsdString_t3049094358 ** get_address_of_datatypeString_4() { return &___datatypeString_4; } inline void set_datatypeString_4(XsdString_t3049094358 * value) { ___datatypeString_4 = value; Il2CppCodeGenWriteBarrier((&___datatypeString_4), value); } inline static int32_t get_offset_of_datatypeNormalizedString_5() { return static_cast<int32_t>(offsetof(XmlSchemaDatatype_t322714710_StaticFields, ___datatypeNormalizedString_5)); } inline XsdNormalizedString_t3260789355 * get_datatypeNormalizedString_5() const { return ___datatypeNormalizedString_5; } inline XsdNormalizedString_t3260789355 ** get_address_of_datatypeNormalizedString_5() { return &___datatypeNormalizedString_5; } inline void set_datatypeNormalizedString_5(XsdNormalizedString_t3260789355 * value) { ___datatypeNormalizedString_5 = value; Il2CppCodeGenWriteBarrier((&___datatypeNormalizedString_5), value); } inline static int32_t get_offset_of_datatypeToken_6() { return static_cast<int32_t>(offsetof(XmlSchemaDatatype_t322714710_StaticFields, ___datatypeToken_6)); } inline XsdToken_t1239036978 * get_datatypeToken_6() const { return ___datatypeToken_6; } inline XsdToken_t1239036978 ** get_address_of_datatypeToken_6() { return &___datatypeToken_6; } inline void set_datatypeToken_6(XsdToken_t1239036978 * value) { ___datatypeToken_6 = value; Il2CppCodeGenWriteBarrier((&___datatypeToken_6), value); } inline static int32_t get_offset_of_datatypeLanguage_7() { return static_cast<int32_t>(offsetof(XmlSchemaDatatype_t322714710_StaticFields, ___datatypeLanguage_7)); } inline XsdLanguage_t1876291273 * get_datatypeLanguage_7() const { return ___datatypeLanguage_7; } inline XsdLanguage_t1876291273 ** get_address_of_datatypeLanguage_7() { return &___datatypeLanguage_7; } inline void set_datatypeLanguage_7(XsdLanguage_t1876291273 * value) { ___datatypeLanguage_7 = value; Il2CppCodeGenWriteBarrier((&___datatypeLanguage_7), value); } inline static int32_t get_offset_of_datatypeNMToken_8() { return static_cast<int32_t>(offsetof(XmlSchemaDatatype_t322714710_StaticFields, ___datatypeNMToken_8)); } inline XsdNMToken_t834691671 * get_datatypeNMToken_8() const { return ___datatypeNMToken_8; } inline XsdNMToken_t834691671 ** get_address_of_datatypeNMToken_8() { return &___datatypeNMToken_8; } inline void set_datatypeNMToken_8(XsdNMToken_t834691671 * value) { ___datatypeNMToken_8 = value; Il2CppCodeGenWriteBarrier((&___datatypeNMToken_8), value); } inline static int32_t get_offset_of_datatypeNMTokens_9() { return static_cast<int32_t>(offsetof(XmlSchemaDatatype_t322714710_StaticFields, ___datatypeNMTokens_9)); } inline XsdNMTokens_t4246953255 * get_datatypeNMTokens_9() const { return ___datatypeNMTokens_9; } inline XsdNMTokens_t4246953255 ** get_address_of_datatypeNMTokens_9() { return &___datatypeNMTokens_9; } inline void set_datatypeNMTokens_9(XsdNMTokens_t4246953255 * value) { ___datatypeNMTokens_9 = value; Il2CppCodeGenWriteBarrier((&___datatypeNMTokens_9), value); } inline static int32_t get_offset_of_datatypeName_10() { return static_cast<int32_t>(offsetof(XmlSchemaDatatype_t322714710_StaticFields, ___datatypeName_10)); } inline XsdName_t2755146808 * get_datatypeName_10() const { return ___datatypeName_10; } inline XsdName_t2755146808 ** get_address_of_datatypeName_10() { return &___datatypeName_10; } inline void set_datatypeName_10(XsdName_t2755146808 * value) { ___datatypeName_10 = value; Il2CppCodeGenWriteBarrier((&___datatypeName_10), value); } inline static int32_t get_offset_of_datatypeNCName_11() { return static_cast<int32_t>(offsetof(XmlSchemaDatatype_t322714710_StaticFields, ___datatypeNCName_11)); } inline XsdNCName_t3943159043 * get_datatypeNCName_11() const { return ___datatypeNCName_11; } inline XsdNCName_t3943159043 ** get_address_of_datatypeNCName_11() { return &___datatypeNCName_11; } inline void set_datatypeNCName_11(XsdNCName_t3943159043 * value) { ___datatypeNCName_11 = value; Il2CppCodeGenWriteBarrier((&___datatypeNCName_11), value); } inline static int32_t get_offset_of_datatypeID_12() { return static_cast<int32_t>(offsetof(XmlSchemaDatatype_t322714710_StaticFields, ___datatypeID_12)); } inline XsdID_t34704195 * get_datatypeID_12() const { return ___datatypeID_12; } inline XsdID_t34704195 ** get_address_of_datatypeID_12() { return &___datatypeID_12; } inline void set_datatypeID_12(XsdID_t34704195 * value) { ___datatypeID_12 = value; Il2CppCodeGenWriteBarrier((&___datatypeID_12), value); } inline static int32_t get_offset_of_datatypeIDRef_13() { return static_cast<int32_t>(offsetof(XmlSchemaDatatype_t322714710_StaticFields, ___datatypeIDRef_13)); } inline XsdIDRef_t2913612829 * get_datatypeIDRef_13() const { return ___datatypeIDRef_13; } inline XsdIDRef_t2913612829 ** get_address_of_datatypeIDRef_13() { return &___datatypeIDRef_13; } inline void set_datatypeIDRef_13(XsdIDRef_t2913612829 * value) { ___datatypeIDRef_13 = value; Il2CppCodeGenWriteBarrier((&___datatypeIDRef_13), value); } inline static int32_t get_offset_of_datatypeIDRefs_14() { return static_cast<int32_t>(offsetof(XmlSchemaDatatype_t322714710_StaticFields, ___datatypeIDRefs_14)); } inline XsdIDRefs_t16099206 * get_datatypeIDRefs_14() const { return ___datatypeIDRefs_14; } inline XsdIDRefs_t16099206 ** get_address_of_datatypeIDRefs_14() { return &___datatypeIDRefs_14; } inline void set_datatypeIDRefs_14(XsdIDRefs_t16099206 * value) { ___datatypeIDRefs_14 = value; Il2CppCodeGenWriteBarrier((&___datatypeIDRefs_14), value); } inline static int32_t get_offset_of_datatypeEntity_15() { return static_cast<int32_t>(offsetof(XmlSchemaDatatype_t322714710_StaticFields, ___datatypeEntity_15)); } inline XsdEntity_t3956505874 * get_datatypeEntity_15() const { return ___datatypeEntity_15; } inline XsdEntity_t3956505874 ** get_address_of_datatypeEntity_15() { return &___datatypeEntity_15; } inline void set_datatypeEntity_15(XsdEntity_t3956505874 * value) { ___datatypeEntity_15 = value; Il2CppCodeGenWriteBarrier((&___datatypeEntity_15), value); } inline static int32_t get_offset_of_datatypeEntities_16() { return static_cast<int32_t>(offsetof(XmlSchemaDatatype_t322714710_StaticFields, ___datatypeEntities_16)); } inline XsdEntities_t1477210398 * get_datatypeEntities_16() const { return ___datatypeEntities_16; } inline XsdEntities_t1477210398 ** get_address_of_datatypeEntities_16() { return &___datatypeEntities_16; } inline void set_datatypeEntities_16(XsdEntities_t1477210398 * value) { ___datatypeEntities_16 = value; Il2CppCodeGenWriteBarrier((&___datatypeEntities_16), value); } inline static int32_t get_offset_of_datatypeNotation_17() { return static_cast<int32_t>(offsetof(XmlSchemaDatatype_t322714710_StaticFields, ___datatypeNotation_17)); } inline XsdNotation_t2827634056 * get_datatypeNotation_17() const { return ___datatypeNotation_17; } inline XsdNotation_t2827634056 ** get_address_of_datatypeNotation_17() { return &___datatypeNotation_17; } inline void set_datatypeNotation_17(XsdNotation_t2827634056 * value) { ___datatypeNotation_17 = value; Il2CppCodeGenWriteBarrier((&___datatypeNotation_17), value); } inline static int32_t get_offset_of_datatypeDecimal_18() { return static_cast<int32_t>(offsetof(XmlSchemaDatatype_t322714710_StaticFields, ___datatypeDecimal_18)); } inline XsdDecimal_t1288601093 * get_datatypeDecimal_18() const { return ___datatypeDecimal_18; } inline XsdDecimal_t1288601093 ** get_address_of_datatypeDecimal_18() { return &___datatypeDecimal_18; } inline void set_datatypeDecimal_18(XsdDecimal_t1288601093 * value) { ___datatypeDecimal_18 = value; Il2CppCodeGenWriteBarrier((&___datatypeDecimal_18), value); } inline static int32_t get_offset_of_datatypeInteger_19() { return static_cast<int32_t>(offsetof(XmlSchemaDatatype_t322714710_StaticFields, ___datatypeInteger_19)); } inline XsdInteger_t2044766898 * get_datatypeInteger_19() const { return ___datatypeInteger_19; } inline XsdInteger_t2044766898 ** get_address_of_datatypeInteger_19() { return &___datatypeInteger_19; } inline void set_datatypeInteger_19(XsdInteger_t2044766898 * value) { ___datatypeInteger_19 = value; Il2CppCodeGenWriteBarrier((&___datatypeInteger_19), value); } inline static int32_t get_offset_of_datatypeLong_20() { return static_cast<int32_t>(offsetof(XmlSchemaDatatype_t322714710_StaticFields, ___datatypeLong_20)); } inline XsdLong_t1324632828 * get_datatypeLong_20() const { return ___datatypeLong_20; } inline XsdLong_t1324632828 ** get_address_of_datatypeLong_20() { return &___datatypeLong_20; } inline void set_datatypeLong_20(XsdLong_t1324632828 * value) { ___datatypeLong_20 = value; Il2CppCodeGenWriteBarrier((&___datatypeLong_20), value); } inline static int32_t get_offset_of_datatypeInt_21() { return static_cast<int32_t>(offsetof(XmlSchemaDatatype_t322714710_StaticFields, ___datatypeInt_21)); } inline XsdInt_t33917785 * get_datatypeInt_21() const { return ___datatypeInt_21; } inline XsdInt_t33917785 ** get_address_of_datatypeInt_21() { return &___datatypeInt_21; } inline void set_datatypeInt_21(XsdInt_t33917785 * value) { ___datatypeInt_21 = value; Il2CppCodeGenWriteBarrier((&___datatypeInt_21), value); } inline static int32_t get_offset_of_datatypeShort_22() { return static_cast<int32_t>(offsetof(XmlSchemaDatatype_t322714710_StaticFields, ___datatypeShort_22)); } inline XsdShort_t3489811876 * get_datatypeShort_22() const { return ___datatypeShort_22; } inline XsdShort_t3489811876 ** get_address_of_datatypeShort_22() { return &___datatypeShort_22; } inline void set_datatypeShort_22(XsdShort_t3489811876 * value) { ___datatypeShort_22 = value; Il2CppCodeGenWriteBarrier((&___datatypeShort_22), value); } inline static int32_t get_offset_of_datatypeByte_23() { return static_cast<int32_t>(offsetof(XmlSchemaDatatype_t322714710_StaticFields, ___datatypeByte_23)); } inline XsdByte_t2221093920 * get_datatypeByte_23() const { return ___datatypeByte_23; } inline XsdByte_t2221093920 ** get_address_of_datatypeByte_23() { return &___datatypeByte_23; } inline void set_datatypeByte_23(XsdByte_t2221093920 * value) { ___datatypeByte_23 = value; Il2CppCodeGenWriteBarrier((&___datatypeByte_23), value); } inline static int32_t get_offset_of_datatypeNonNegativeInteger_24() { return static_cast<int32_t>(offsetof(XmlSchemaDatatype_t322714710_StaticFields, ___datatypeNonNegativeInteger_24)); } inline XsdNonNegativeInteger_t308064234 * get_datatypeNonNegativeInteger_24() const { return ___datatypeNonNegativeInteger_24; } inline XsdNonNegativeInteger_t308064234 ** get_address_of_datatypeNonNegativeInteger_24() { return &___datatypeNonNegativeInteger_24; } inline void set_datatypeNonNegativeInteger_24(XsdNonNegativeInteger_t308064234 * value) { ___datatypeNonNegativeInteger_24 = value; Il2CppCodeGenWriteBarrier((&___datatypeNonNegativeInteger_24), value); } inline static int32_t get_offset_of_datatypePositiveInteger_25() { return static_cast<int32_t>(offsetof(XmlSchemaDatatype_t322714710_StaticFields, ___datatypePositiveInteger_25)); } inline XsdPositiveInteger_t1704031413 * get_datatypePositiveInteger_25() const { return ___datatypePositiveInteger_25; } inline XsdPositiveInteger_t1704031413 ** get_address_of_datatypePositiveInteger_25() { return &___datatypePositiveInteger_25; } inline void set_datatypePositiveInteger_25(XsdPositiveInteger_t1704031413 * value) { ___datatypePositiveInteger_25 = value; Il2CppCodeGenWriteBarrier((&___datatypePositiveInteger_25), value); } inline static int32_t get_offset_of_datatypeUnsignedLong_26() { return static_cast<int32_t>(offsetof(XmlSchemaDatatype_t322714710_StaticFields, ___datatypeUnsignedLong_26)); } inline XsdUnsignedLong_t1409593434 * get_datatypeUnsignedLong_26() const { return ___datatypeUnsignedLong_26; } inline XsdUnsignedLong_t1409593434 ** get_address_of_datatypeUnsignedLong_26() { return &___datatypeUnsignedLong_26; } inline void set_datatypeUnsignedLong_26(XsdUnsignedLong_t1409593434 * value) { ___datatypeUnsignedLong_26 = value; Il2CppCodeGenWriteBarrier((&___datatypeUnsignedLong_26), value); } inline static int32_t get_offset_of_datatypeUnsignedInt_27() { return static_cast<int32_t>(offsetof(XmlSchemaDatatype_t322714710_StaticFields, ___datatypeUnsignedInt_27)); } inline XsdUnsignedInt_t72105793 * get_datatypeUnsignedInt_27() const { return ___datatypeUnsignedInt_27; } inline XsdUnsignedInt_t72105793 ** get_address_of_datatypeUnsignedInt_27() { return &___datatypeUnsignedInt_27; } inline void set_datatypeUnsignedInt_27(XsdUnsignedInt_t72105793 * value) { ___datatypeUnsignedInt_27 = value; Il2CppCodeGenWriteBarrier((&___datatypeUnsignedInt_27), value); } inline static int32_t get_offset_of_datatypeUnsignedShort_28() { return static_cast<int32_t>(offsetof(XmlSchemaDatatype_t322714710_StaticFields, ___datatypeUnsignedShort_28)); } inline XsdUnsignedShort_t3654069686 * get_datatypeUnsignedShort_28() const { return ___datatypeUnsignedShort_28; } inline XsdUnsignedShort_t3654069686 ** get_address_of_datatypeUnsignedShort_28() { return &___datatypeUnsignedShort_28; } inline void set_datatypeUnsignedShort_28(XsdUnsignedShort_t3654069686 * value) { ___datatypeUnsignedShort_28 = value; Il2CppCodeGenWriteBarrier((&___datatypeUnsignedShort_28), value); } inline static int32_t get_offset_of_datatypeUnsignedByte_29() { return static_cast<int32_t>(offsetof(XmlSchemaDatatype_t322714710_StaticFields, ___datatypeUnsignedByte_29)); } inline XsdUnsignedByte_t2304219558 * get_datatypeUnsignedByte_29() const { return ___datatypeUnsignedByte_29; } inline XsdUnsignedByte_t2304219558 ** get_address_of_datatypeUnsignedByte_29() { return &___datatypeUnsignedByte_29; } inline void set_datatypeUnsignedByte_29(XsdUnsignedByte_t2304219558 * value) { ___datatypeUnsignedByte_29 = value; Il2CppCodeGenWriteBarrier((&___datatypeUnsignedByte_29), value); } inline static int32_t get_offset_of_datatypeNonPositiveInteger_30() { return static_cast<int32_t>(offsetof(XmlSchemaDatatype_t322714710_StaticFields, ___datatypeNonPositiveInteger_30)); } inline XsdNonPositiveInteger_t1029055398 * get_datatypeNonPositiveInteger_30() const { return ___datatypeNonPositiveInteger_30; } inline XsdNonPositiveInteger_t1029055398 ** get_address_of_datatypeNonPositiveInteger_30() { return &___datatypeNonPositiveInteger_30; } inline void set_datatypeNonPositiveInteger_30(XsdNonPositiveInteger_t1029055398 * value) { ___datatypeNonPositiveInteger_30 = value; Il2CppCodeGenWriteBarrier((&___datatypeNonPositiveInteger_30), value); } inline static int32_t get_offset_of_datatypeNegativeInteger_31() { return static_cast<int32_t>(offsetof(XmlSchemaDatatype_t322714710_StaticFields, ___datatypeNegativeInteger_31)); } inline XsdNegativeInteger_t2178753546 * get_datatypeNegativeInteger_31() const { return ___datatypeNegativeInteger_31; } inline XsdNegativeInteger_t2178753546 ** get_address_of_datatypeNegativeInteger_31() { return &___datatypeNegativeInteger_31; } inline void set_datatypeNegativeInteger_31(XsdNegativeInteger_t2178753546 * value) { ___datatypeNegativeInteger_31 = value; Il2CppCodeGenWriteBarrier((&___datatypeNegativeInteger_31), value); } inline static int32_t get_offset_of_datatypeFloat_32() { return static_cast<int32_t>(offsetof(XmlSchemaDatatype_t322714710_StaticFields, ___datatypeFloat_32)); } inline XsdFloat_t3181928905 * get_datatypeFloat_32() const { return ___datatypeFloat_32; } inline XsdFloat_t3181928905 ** get_address_of_datatypeFloat_32() { return &___datatypeFloat_32; } inline void set_datatypeFloat_32(XsdFloat_t3181928905 * value) { ___datatypeFloat_32 = value; Il2CppCodeGenWriteBarrier((&___datatypeFloat_32), value); } inline static int32_t get_offset_of_datatypeDouble_33() { return static_cast<int32_t>(offsetof(XmlSchemaDatatype_t322714710_StaticFields, ___datatypeDouble_33)); } inline XsdDouble_t3324344982 * get_datatypeDouble_33() const { return ___datatypeDouble_33; } inline XsdDouble_t3324344982 ** get_address_of_datatypeDouble_33() { return &___datatypeDouble_33; } inline void set_datatypeDouble_33(XsdDouble_t3324344982 * value) { ___datatypeDouble_33 = value; Il2CppCodeGenWriteBarrier((&___datatypeDouble_33), value); } inline static int32_t get_offset_of_datatypeBase64Binary_34() { return static_cast<int32_t>(offsetof(XmlSchemaDatatype_t322714710_StaticFields, ___datatypeBase64Binary_34)); } inline XsdBase64Binary_t3360383190 * get_datatypeBase64Binary_34() const { return ___datatypeBase64Binary_34; } inline XsdBase64Binary_t3360383190 ** get_address_of_datatypeBase64Binary_34() { return &___datatypeBase64Binary_34; } inline void set_datatypeBase64Binary_34(XsdBase64Binary_t3360383190 * value) { ___datatypeBase64Binary_34 = value; Il2CppCodeGenWriteBarrier((&___datatypeBase64Binary_34), value); } inline static int32_t get_offset_of_datatypeBoolean_35() { return static_cast<int32_t>(offsetof(XmlSchemaDatatype_t322714710_StaticFields, ___datatypeBoolean_35)); } inline XsdBoolean_t380164876 * get_datatypeBoolean_35() const { return ___datatypeBoolean_35; } inline XsdBoolean_t380164876 ** get_address_of_datatypeBoolean_35() { return &___datatypeBoolean_35; } inline void set_datatypeBoolean_35(XsdBoolean_t380164876 * value) { ___datatypeBoolean_35 = value; Il2CppCodeGenWriteBarrier((&___datatypeBoolean_35), value); } inline static int32_t get_offset_of_datatypeAnyURI_36() { return static_cast<int32_t>(offsetof(XmlSchemaDatatype_t322714710_StaticFields, ___datatypeAnyURI_36)); } inline XsdAnyURI_t2755748070 * get_datatypeAnyURI_36() const { return ___datatypeAnyURI_36; } inline XsdAnyURI_t2755748070 ** get_address_of_datatypeAnyURI_36() { return &___datatypeAnyURI_36; } inline void set_datatypeAnyURI_36(XsdAnyURI_t2755748070 * value) { ___datatypeAnyURI_36 = value; Il2CppCodeGenWriteBarrier((&___datatypeAnyURI_36), value); } inline static int32_t get_offset_of_datatypeDuration_37() { return static_cast<int32_t>(offsetof(XmlSchemaDatatype_t322714710_StaticFields, ___datatypeDuration_37)); } inline XsdDuration_t1555973170 * get_datatypeDuration_37() const { return ___datatypeDuration_37; } inline XsdDuration_t1555973170 ** get_address_of_datatypeDuration_37() { return &___datatypeDuration_37; } inline void set_datatypeDuration_37(XsdDuration_t1555973170 * value) { ___datatypeDuration_37 = value; Il2CppCodeGenWriteBarrier((&___datatypeDuration_37), value); } inline static int32_t get_offset_of_datatypeDateTime_38() { return static_cast<int32_t>(offsetof(XmlSchemaDatatype_t322714710_StaticFields, ___datatypeDateTime_38)); } inline XsdDateTime_t2563698975 * get_datatypeDateTime_38() const { return ___datatypeDateTime_38; } inline XsdDateTime_t2563698975 ** get_address_of_datatypeDateTime_38() { return &___datatypeDateTime_38; } inline void set_datatypeDateTime_38(XsdDateTime_t2563698975 * value) { ___datatypeDateTime_38 = value; Il2CppCodeGenWriteBarrier((&___datatypeDateTime_38), value); } inline static int32_t get_offset_of_datatypeDate_39() { return static_cast<int32_t>(offsetof(XmlSchemaDatatype_t322714710_StaticFields, ___datatypeDate_39)); } inline XsdDate_t1417753656 * get_datatypeDate_39() const { return ___datatypeDate_39; } inline XsdDate_t1417753656 ** get_address_of_datatypeDate_39() { return &___datatypeDate_39; } inline void set_datatypeDate_39(XsdDate_t1417753656 * value) { ___datatypeDate_39 = value; Il2CppCodeGenWriteBarrier((&___datatypeDate_39), value); } inline static int32_t get_offset_of_datatypeTime_40() { return static_cast<int32_t>(offsetof(XmlSchemaDatatype_t322714710_StaticFields, ___datatypeTime_40)); } inline XsdTime_t3558487088 * get_datatypeTime_40() const { return ___datatypeTime_40; } inline XsdTime_t3558487088 ** get_address_of_datatypeTime_40() { return &___datatypeTime_40; } inline void set_datatypeTime_40(XsdTime_t3558487088 * value) { ___datatypeTime_40 = value; Il2CppCodeGenWriteBarrier((&___datatypeTime_40), value); } inline static int32_t get_offset_of_datatypeHexBinary_41() { return static_cast<int32_t>(offsetof(XmlSchemaDatatype_t322714710_StaticFields, ___datatypeHexBinary_41)); } inline XsdHexBinary_t882812470 * get_datatypeHexBinary_41() const { return ___datatypeHexBinary_41; } inline XsdHexBinary_t882812470 ** get_address_of_datatypeHexBinary_41() { return &___datatypeHexBinary_41; } inline void set_datatypeHexBinary_41(XsdHexBinary_t882812470 * value) { ___datatypeHexBinary_41 = value; Il2CppCodeGenWriteBarrier((&___datatypeHexBinary_41), value); } inline static int32_t get_offset_of_datatypeQName_42() { return static_cast<int32_t>(offsetof(XmlSchemaDatatype_t322714710_StaticFields, ___datatypeQName_42)); } inline XsdQName_t2385631467 * get_datatypeQName_42() const { return ___datatypeQName_42; } inline XsdQName_t2385631467 ** get_address_of_datatypeQName_42() { return &___datatypeQName_42; } inline void set_datatypeQName_42(XsdQName_t2385631467 * value) { ___datatypeQName_42 = value; Il2CppCodeGenWriteBarrier((&___datatypeQName_42), value); } inline static int32_t get_offset_of_datatypeGYearMonth_43() { return static_cast<int32_t>(offsetof(XmlSchemaDatatype_t322714710_StaticFields, ___datatypeGYearMonth_43)); } inline XsdGYearMonth_t3399073121 * get_datatypeGYearMonth_43() const { return ___datatypeGYearMonth_43; } inline XsdGYearMonth_t3399073121 ** get_address_of_datatypeGYearMonth_43() { return &___datatypeGYearMonth_43; } inline void set_datatypeGYearMonth_43(XsdGYearMonth_t3399073121 * value) { ___datatypeGYearMonth_43 = value; Il2CppCodeGenWriteBarrier((&___datatypeGYearMonth_43), value); } inline static int32_t get_offset_of_datatypeGMonthDay_44() { return static_cast<int32_t>(offsetof(XmlSchemaDatatype_t322714710_StaticFields, ___datatypeGMonthDay_44)); } inline XsdGMonthDay_t2605134399 * get_datatypeGMonthDay_44() const { return ___datatypeGMonthDay_44; } inline XsdGMonthDay_t2605134399 ** get_address_of_datatypeGMonthDay_44() { return &___datatypeGMonthDay_44; } inline void set_datatypeGMonthDay_44(XsdGMonthDay_t2605134399 * value) { ___datatypeGMonthDay_44 = value; Il2CppCodeGenWriteBarrier((&___datatypeGMonthDay_44), value); } inline static int32_t get_offset_of_datatypeGYear_45() { return static_cast<int32_t>(offsetof(XmlSchemaDatatype_t322714710_StaticFields, ___datatypeGYear_45)); } inline XsdGYear_t3316212116 * get_datatypeGYear_45() const { return ___datatypeGYear_45; } inline XsdGYear_t3316212116 ** get_address_of_datatypeGYear_45() { return &___datatypeGYear_45; } inline void set_datatypeGYear_45(XsdGYear_t3316212116 * value) { ___datatypeGYear_45 = value; Il2CppCodeGenWriteBarrier((&___datatypeGYear_45), value); } inline static int32_t get_offset_of_datatypeGMonth_46() { return static_cast<int32_t>(offsetof(XmlSchemaDatatype_t322714710_StaticFields, ___datatypeGMonth_46)); } inline XsdGMonth_t3913018815 * get_datatypeGMonth_46() const { return ___datatypeGMonth_46; } inline XsdGMonth_t3913018815 ** get_address_of_datatypeGMonth_46() { return &___datatypeGMonth_46; } inline void set_datatypeGMonth_46(XsdGMonth_t3913018815 * value) { ___datatypeGMonth_46 = value; Il2CppCodeGenWriteBarrier((&___datatypeGMonth_46), value); } inline static int32_t get_offset_of_datatypeGDay_47() { return static_cast<int32_t>(offsetof(XmlSchemaDatatype_t322714710_StaticFields, ___datatypeGDay_47)); } inline XsdGDay_t293490745 * get_datatypeGDay_47() const { return ___datatypeGDay_47; } inline XsdGDay_t293490745 ** get_address_of_datatypeGDay_47() { return &___datatypeGDay_47; } inline void set_datatypeGDay_47(XsdGDay_t293490745 * value) { ___datatypeGDay_47 = value; Il2CppCodeGenWriteBarrier((&___datatypeGDay_47), value); } inline static int32_t get_offset_of_datatypeAnyAtomicType_48() { return static_cast<int32_t>(offsetof(XmlSchemaDatatype_t322714710_StaticFields, ___datatypeAnyAtomicType_48)); } inline XdtAnyAtomicType_t269366253 * get_datatypeAnyAtomicType_48() const { return ___datatypeAnyAtomicType_48; } inline XdtAnyAtomicType_t269366253 ** get_address_of_datatypeAnyAtomicType_48() { return &___datatypeAnyAtomicType_48; } inline void set_datatypeAnyAtomicType_48(XdtAnyAtomicType_t269366253 * value) { ___datatypeAnyAtomicType_48 = value; Il2CppCodeGenWriteBarrier((&___datatypeAnyAtomicType_48), value); } inline static int32_t get_offset_of_datatypeUntypedAtomic_49() { return static_cast<int32_t>(offsetof(XmlSchemaDatatype_t322714710_StaticFields, ___datatypeUntypedAtomic_49)); } inline XdtUntypedAtomic_t1388131523 * get_datatypeUntypedAtomic_49() const { return ___datatypeUntypedAtomic_49; } inline XdtUntypedAtomic_t1388131523 ** get_address_of_datatypeUntypedAtomic_49() { return &___datatypeUntypedAtomic_49; } inline void set_datatypeUntypedAtomic_49(XdtUntypedAtomic_t1388131523 * value) { ___datatypeUntypedAtomic_49 = value; Il2CppCodeGenWriteBarrier((&___datatypeUntypedAtomic_49), value); } inline static int32_t get_offset_of_datatypeDayTimeDuration_50() { return static_cast<int32_t>(offsetof(XmlSchemaDatatype_t322714710_StaticFields, ___datatypeDayTimeDuration_50)); } inline XdtDayTimeDuration_t268779858 * get_datatypeDayTimeDuration_50() const { return ___datatypeDayTimeDuration_50; } inline XdtDayTimeDuration_t268779858 ** get_address_of_datatypeDayTimeDuration_50() { return &___datatypeDayTimeDuration_50; } inline void set_datatypeDayTimeDuration_50(XdtDayTimeDuration_t268779858 * value) { ___datatypeDayTimeDuration_50 = value; Il2CppCodeGenWriteBarrier((&___datatypeDayTimeDuration_50), value); } inline static int32_t get_offset_of_datatypeYearMonthDuration_51() { return static_cast<int32_t>(offsetof(XmlSchemaDatatype_t322714710_StaticFields, ___datatypeYearMonthDuration_51)); } inline XdtYearMonthDuration_t1503718519 * get_datatypeYearMonthDuration_51() const { return ___datatypeYearMonthDuration_51; } inline XdtYearMonthDuration_t1503718519 ** get_address_of_datatypeYearMonthDuration_51() { return &___datatypeYearMonthDuration_51; } inline void set_datatypeYearMonthDuration_51(XdtYearMonthDuration_t1503718519 * value) { ___datatypeYearMonthDuration_51 = value; Il2CppCodeGenWriteBarrier((&___datatypeYearMonthDuration_51), value); } inline static int32_t get_offset_of_U3CU3Ef__switchU24map3E_52() { return static_cast<int32_t>(offsetof(XmlSchemaDatatype_t322714710_StaticFields, ___U3CU3Ef__switchU24map3E_52)); } inline Dictionary_2_t2736202052 * get_U3CU3Ef__switchU24map3E_52() const { return ___U3CU3Ef__switchU24map3E_52; } inline Dictionary_2_t2736202052 ** get_address_of_U3CU3Ef__switchU24map3E_52() { return &___U3CU3Ef__switchU24map3E_52; } inline void set_U3CU3Ef__switchU24map3E_52(Dictionary_2_t2736202052 * value) { ___U3CU3Ef__switchU24map3E_52 = value; Il2CppCodeGenWriteBarrier((&___U3CU3Ef__switchU24map3E_52), value); } inline static int32_t get_offset_of_U3CU3Ef__switchU24map3F_53() { return static_cast<int32_t>(offsetof(XmlSchemaDatatype_t322714710_StaticFields, ___U3CU3Ef__switchU24map3F_53)); } inline Dictionary_2_t2736202052 * get_U3CU3Ef__switchU24map3F_53() const { return ___U3CU3Ef__switchU24map3F_53; } inline Dictionary_2_t2736202052 ** get_address_of_U3CU3Ef__switchU24map3F_53() { return &___U3CU3Ef__switchU24map3F_53; } inline void set_U3CU3Ef__switchU24map3F_53(Dictionary_2_t2736202052 * value) { ___U3CU3Ef__switchU24map3F_53 = value; Il2CppCodeGenWriteBarrier((&___U3CU3Ef__switchU24map3F_53), value); } inline static int32_t get_offset_of_U3CU3Ef__switchU24map40_54() { return static_cast<int32_t>(offsetof(XmlSchemaDatatype_t322714710_StaticFields, ___U3CU3Ef__switchU24map40_54)); } inline Dictionary_2_t2736202052 * get_U3CU3Ef__switchU24map40_54() const { return ___U3CU3Ef__switchU24map40_54; } inline Dictionary_2_t2736202052 ** get_address_of_U3CU3Ef__switchU24map40_54() { return &___U3CU3Ef__switchU24map40_54; } inline void set_U3CU3Ef__switchU24map40_54(Dictionary_2_t2736202052 * value) { ___U3CU3Ef__switchU24map40_54 = value; Il2CppCodeGenWriteBarrier((&___U3CU3Ef__switchU24map40_54), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // XMLSCHEMADATATYPE_T322714710_H #ifndef XMLSCHEMAANNOTATED_T2603549639_H #define XMLSCHEMAANNOTATED_T2603549639_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Xml.Schema.XmlSchemaAnnotated struct XmlSchemaAnnotated_t2603549639 : public XmlSchemaObject_t1315720168 { public: // System.Xml.Schema.XmlSchemaAnnotation System.Xml.Schema.XmlSchemaAnnotated::annotation XmlSchemaAnnotation_t2553753397 * ___annotation_13; // System.String System.Xml.Schema.XmlSchemaAnnotated::id String_t* ___id_14; // System.Xml.XmlAttribute[] System.Xml.Schema.XmlSchemaAnnotated::unhandledAttributes XmlAttributeU5BU5D_t1490365106* ___unhandledAttributes_15; public: inline static int32_t get_offset_of_annotation_13() { return static_cast<int32_t>(offsetof(XmlSchemaAnnotated_t2603549639, ___annotation_13)); } inline XmlSchemaAnnotation_t2553753397 * get_annotation_13() const { return ___annotation_13; } inline XmlSchemaAnnotation_t2553753397 ** get_address_of_annotation_13() { return &___annotation_13; } inline void set_annotation_13(XmlSchemaAnnotation_t2553753397 * value) { ___annotation_13 = value; Il2CppCodeGenWriteBarrier((&___annotation_13), value); } inline static int32_t get_offset_of_id_14() { return static_cast<int32_t>(offsetof(XmlSchemaAnnotated_t2603549639, ___id_14)); } inline String_t* get_id_14() const { return ___id_14; } inline String_t** get_address_of_id_14() { return &___id_14; } inline void set_id_14(String_t* value) { ___id_14 = value; Il2CppCodeGenWriteBarrier((&___id_14), value); } inline static int32_t get_offset_of_unhandledAttributes_15() { return static_cast<int32_t>(offsetof(XmlSchemaAnnotated_t2603549639, ___unhandledAttributes_15)); } inline XmlAttributeU5BU5D_t1490365106* get_unhandledAttributes_15() const { return ___unhandledAttributes_15; } inline XmlAttributeU5BU5D_t1490365106** get_address_of_unhandledAttributes_15() { return &___unhandledAttributes_15; } inline void set_unhandledAttributes_15(XmlAttributeU5BU5D_t1490365106* value) { ___unhandledAttributes_15 = value; Il2CppCodeGenWriteBarrier((&___unhandledAttributes_15), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // XMLSCHEMAANNOTATED_T2603549639_H #ifndef XMLSCHEMAUTIL_T956145399_H #define XMLSCHEMAUTIL_T956145399_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Xml.Schema.XmlSchemaUtil struct XmlSchemaUtil_t956145399 : public RuntimeObject { public: public: }; struct XmlSchemaUtil_t956145399_StaticFields { public: // System.Xml.Schema.XmlSchemaDerivationMethod System.Xml.Schema.XmlSchemaUtil::FinalAllowed int32_t ___FinalAllowed_0; // System.Xml.Schema.XmlSchemaDerivationMethod System.Xml.Schema.XmlSchemaUtil::ElementBlockAllowed int32_t ___ElementBlockAllowed_1; // System.Xml.Schema.XmlSchemaDerivationMethod System.Xml.Schema.XmlSchemaUtil::ComplexTypeBlockAllowed int32_t ___ComplexTypeBlockAllowed_2; // System.Boolean System.Xml.Schema.XmlSchemaUtil::StrictMsCompliant bool ___StrictMsCompliant_3; // System.Collections.Generic.Dictionary`2<System.String,System.Int32> System.Xml.Schema.XmlSchemaUtil::<>f__switch$map4B Dictionary_2_t2736202052 * ___U3CU3Ef__switchU24map4B_4; // System.Collections.Generic.Dictionary`2<System.String,System.Int32> System.Xml.Schema.XmlSchemaUtil::<>f__switch$map4C Dictionary_2_t2736202052 * ___U3CU3Ef__switchU24map4C_5; // System.Collections.Generic.Dictionary`2<System.String,System.Int32> System.Xml.Schema.XmlSchemaUtil::<>f__switch$map4D Dictionary_2_t2736202052 * ___U3CU3Ef__switchU24map4D_6; // System.Collections.Generic.Dictionary`2<System.String,System.Int32> System.Xml.Schema.XmlSchemaUtil::<>f__switch$map4E Dictionary_2_t2736202052 * ___U3CU3Ef__switchU24map4E_7; // System.Collections.Generic.Dictionary`2<System.String,System.Int32> System.Xml.Schema.XmlSchemaUtil::<>f__switch$map4F Dictionary_2_t2736202052 * ___U3CU3Ef__switchU24map4F_8; // System.Collections.Generic.Dictionary`2<System.String,System.Int32> System.Xml.Schema.XmlSchemaUtil::<>f__switch$map50 Dictionary_2_t2736202052 * ___U3CU3Ef__switchU24map50_9; public: inline static int32_t get_offset_of_FinalAllowed_0() { return static_cast<int32_t>(offsetof(XmlSchemaUtil_t956145399_StaticFields, ___FinalAllowed_0)); } inline int32_t get_FinalAllowed_0() const { return ___FinalAllowed_0; } inline int32_t* get_address_of_FinalAllowed_0() { return &___FinalAllowed_0; } inline void set_FinalAllowed_0(int32_t value) { ___FinalAllowed_0 = value; } inline static int32_t get_offset_of_ElementBlockAllowed_1() { return static_cast<int32_t>(offsetof(XmlSchemaUtil_t956145399_StaticFields, ___ElementBlockAllowed_1)); } inline int32_t get_ElementBlockAllowed_1() const { return ___ElementBlockAllowed_1; } inline int32_t* get_address_of_ElementBlockAllowed_1() { return &___ElementBlockAllowed_1; } inline void set_ElementBlockAllowed_1(int32_t value) { ___ElementBlockAllowed_1 = value; } inline static int32_t get_offset_of_ComplexTypeBlockAllowed_2() { return static_cast<int32_t>(offsetof(XmlSchemaUtil_t956145399_StaticFields, ___ComplexTypeBlockAllowed_2)); } inline int32_t get_ComplexTypeBlockAllowed_2() const { return ___ComplexTypeBlockAllowed_2; } inline int32_t* get_address_of_ComplexTypeBlockAllowed_2() { return &___ComplexTypeBlockAllowed_2; } inline void set_ComplexTypeBlockAllowed_2(int32_t value) { ___ComplexTypeBlockAllowed_2 = value; } inline static int32_t get_offset_of_StrictMsCompliant_3() { return static_cast<int32_t>(offsetof(XmlSchemaUtil_t956145399_StaticFields, ___StrictMsCompliant_3)); } inline bool get_StrictMsCompliant_3() const { return ___StrictMsCompliant_3; } inline bool* get_address_of_StrictMsCompliant_3() { return &___StrictMsCompliant_3; } inline void set_StrictMsCompliant_3(bool value) { ___StrictMsCompliant_3 = value; } inline static int32_t get_offset_of_U3CU3Ef__switchU24map4B_4() { return static_cast<int32_t>(offsetof(XmlSchemaUtil_t956145399_StaticFields, ___U3CU3Ef__switchU24map4B_4)); } inline Dictionary_2_t2736202052 * get_U3CU3Ef__switchU24map4B_4() const { return ___U3CU3Ef__switchU24map4B_4; } inline Dictionary_2_t2736202052 ** get_address_of_U3CU3Ef__switchU24map4B_4() { return &___U3CU3Ef__switchU24map4B_4; } inline void set_U3CU3Ef__switchU24map4B_4(Dictionary_2_t2736202052 * value) { ___U3CU3Ef__switchU24map4B_4 = value; Il2CppCodeGenWriteBarrier((&___U3CU3Ef__switchU24map4B_4), value); } inline static int32_t get_offset_of_U3CU3Ef__switchU24map4C_5() { return static_cast<int32_t>(offsetof(XmlSchemaUtil_t956145399_StaticFields, ___U3CU3Ef__switchU24map4C_5)); } inline Dictionary_2_t2736202052 * get_U3CU3Ef__switchU24map4C_5() const { return ___U3CU3Ef__switchU24map4C_5; } inline Dictionary_2_t2736202052 ** get_address_of_U3CU3Ef__switchU24map4C_5() { return &___U3CU3Ef__switchU24map4C_5; } inline void set_U3CU3Ef__switchU24map4C_5(Dictionary_2_t2736202052 * value) { ___U3CU3Ef__switchU24map4C_5 = value; Il2CppCodeGenWriteBarrier((&___U3CU3Ef__switchU24map4C_5), value); } inline static int32_t get_offset_of_U3CU3Ef__switchU24map4D_6() { return static_cast<int32_t>(offsetof(XmlSchemaUtil_t956145399_StaticFields, ___U3CU3Ef__switchU24map4D_6)); } inline Dictionary_2_t2736202052 * get_U3CU3Ef__switchU24map4D_6() const { return ___U3CU3Ef__switchU24map4D_6; } inline Dictionary_2_t2736202052 ** get_address_of_U3CU3Ef__switchU24map4D_6() { return &___U3CU3Ef__switchU24map4D_6; } inline void set_U3CU3Ef__switchU24map4D_6(Dictionary_2_t2736202052 * value) { ___U3CU3Ef__switchU24map4D_6 = value; Il2CppCodeGenWriteBarrier((&___U3CU3Ef__switchU24map4D_6), value); } inline static int32_t get_offset_of_U3CU3Ef__switchU24map4E_7() { return static_cast<int32_t>(offsetof(XmlSchemaUtil_t956145399_StaticFields, ___U3CU3Ef__switchU24map4E_7)); } inline Dictionary_2_t2736202052 * get_U3CU3Ef__switchU24map4E_7() const { return ___U3CU3Ef__switchU24map4E_7; } inline Dictionary_2_t2736202052 ** get_address_of_U3CU3Ef__switchU24map4E_7() { return &___U3CU3Ef__switchU24map4E_7; } inline void set_U3CU3Ef__switchU24map4E_7(Dictionary_2_t2736202052 * value) { ___U3CU3Ef__switchU24map4E_7 = value; Il2CppCodeGenWriteBarrier((&___U3CU3Ef__switchU24map4E_7), value); } inline static int32_t get_offset_of_U3CU3Ef__switchU24map4F_8() { return static_cast<int32_t>(offsetof(XmlSchemaUtil_t956145399_StaticFields, ___U3CU3Ef__switchU24map4F_8)); } inline Dictionary_2_t2736202052 * get_U3CU3Ef__switchU24map4F_8() const { return ___U3CU3Ef__switchU24map4F_8; } inline Dictionary_2_t2736202052 ** get_address_of_U3CU3Ef__switchU24map4F_8() { return &___U3CU3Ef__switchU24map4F_8; } inline void set_U3CU3Ef__switchU24map4F_8(Dictionary_2_t2736202052 * value) { ___U3CU3Ef__switchU24map4F_8 = value; Il2CppCodeGenWriteBarrier((&___U3CU3Ef__switchU24map4F_8), value); } inline static int32_t get_offset_of_U3CU3Ef__switchU24map50_9() { return static_cast<int32_t>(offsetof(XmlSchemaUtil_t956145399_StaticFields, ___U3CU3Ef__switchU24map50_9)); } inline Dictionary_2_t2736202052 * get_U3CU3Ef__switchU24map50_9() const { return ___U3CU3Ef__switchU24map50_9; } inline Dictionary_2_t2736202052 ** get_address_of_U3CU3Ef__switchU24map50_9() { return &___U3CU3Ef__switchU24map50_9; } inline void set_U3CU3Ef__switchU24map50_9(Dictionary_2_t2736202052 * value) { ___U3CU3Ef__switchU24map50_9 = value; Il2CppCodeGenWriteBarrier((&___U3CU3Ef__switchU24map50_9), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // XMLSCHEMAUTIL_T956145399_H #ifndef XMLSCHEMAEXTERNAL_T3074890143_H #define XMLSCHEMAEXTERNAL_T3074890143_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Xml.Schema.XmlSchemaExternal struct XmlSchemaExternal_t3074890143 : public XmlSchemaObject_t1315720168 { public: // System.String System.Xml.Schema.XmlSchemaExternal::id String_t* ___id_13; // System.Xml.Schema.XmlSchema System.Xml.Schema.XmlSchemaExternal::schema XmlSchema_t3742557897 * ___schema_14; // System.String System.Xml.Schema.XmlSchemaExternal::location String_t* ___location_15; public: inline static int32_t get_offset_of_id_13() { return static_cast<int32_t>(offsetof(XmlSchemaExternal_t3074890143, ___id_13)); } inline String_t* get_id_13() const { return ___id_13; } inline String_t** get_address_of_id_13() { return &___id_13; } inline void set_id_13(String_t* value) { ___id_13 = value; Il2CppCodeGenWriteBarrier((&___id_13), value); } inline static int32_t get_offset_of_schema_14() { return static_cast<int32_t>(offsetof(XmlSchemaExternal_t3074890143, ___schema_14)); } inline XmlSchema_t3742557897 * get_schema_14() const { return ___schema_14; } inline XmlSchema_t3742557897 ** get_address_of_schema_14() { return &___schema_14; } inline void set_schema_14(XmlSchema_t3742557897 * value) { ___schema_14 = value; Il2CppCodeGenWriteBarrier((&___schema_14), value); } inline static int32_t get_offset_of_location_15() { return static_cast<int32_t>(offsetof(XmlSchemaExternal_t3074890143, ___location_15)); } inline String_t* get_location_15() const { return ___location_15; } inline String_t** get_address_of_location_15() { return &___location_15; } inline void set_location_15(String_t* value) { ___location_15 = value; Il2CppCodeGenWriteBarrier((&___location_15), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // XMLSCHEMAEXTERNAL_T3074890143_H #ifndef XMLNODECHANGEDEVENTHANDLER_T1533444722_H #define XMLNODECHANGEDEVENTHANDLER_T1533444722_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Xml.XmlNodeChangedEventHandler struct XmlNodeChangedEventHandler_t1533444722 : public MulticastDelegate_t { public: public: }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // XMLNODECHANGEDEVENTHANDLER_T1533444722_H #ifndef XMLSCHEMAINCLUDE_T2307352039_H #define XMLSCHEMAINCLUDE_T2307352039_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Xml.Schema.XmlSchemaInclude struct XmlSchemaInclude_t2307352039 : public XmlSchemaExternal_t3074890143 { public: // System.Xml.Schema.XmlSchemaAnnotation System.Xml.Schema.XmlSchemaInclude::annotation XmlSchemaAnnotation_t2553753397 * ___annotation_16; public: inline static int32_t get_offset_of_annotation_16() { return static_cast<int32_t>(offsetof(XmlSchemaInclude_t2307352039, ___annotation_16)); } inline XmlSchemaAnnotation_t2553753397 * get_annotation_16() const { return ___annotation_16; } inline XmlSchemaAnnotation_t2553753397 ** get_address_of_annotation_16() { return &___annotation_16; } inline void set_annotation_16(XmlSchemaAnnotation_t2553753397 * value) { ___annotation_16 = value; Il2CppCodeGenWriteBarrier((&___annotation_16), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // XMLSCHEMAINCLUDE_T2307352039_H #ifndef VALIDATIONEVENTHANDLER_T791314227_H #define VALIDATIONEVENTHANDLER_T791314227_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Xml.Schema.ValidationEventHandler struct ValidationEventHandler_t791314227 : public MulticastDelegate_t { public: public: }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // VALIDATIONEVENTHANDLER_T791314227_H #ifndef XMLSCHEMATYPE_T2033747345_H #define XMLSCHEMATYPE_T2033747345_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Xml.Schema.XmlSchemaType struct XmlSchemaType_t2033747345 : public XmlSchemaAnnotated_t2603549639 { public: // System.Xml.Schema.XmlSchemaDerivationMethod System.Xml.Schema.XmlSchemaType::final int32_t ___final_16; // System.Boolean System.Xml.Schema.XmlSchemaType::isMixed bool ___isMixed_17; // System.String System.Xml.Schema.XmlSchemaType::name String_t* ___name_18; // System.Boolean System.Xml.Schema.XmlSchemaType::recursed bool ___recursed_19; // System.Xml.XmlQualifiedName System.Xml.Schema.XmlSchemaType::BaseSchemaTypeName XmlQualifiedName_t2760654312 * ___BaseSchemaTypeName_20; // System.Xml.Schema.XmlSchemaType System.Xml.Schema.XmlSchemaType::BaseXmlSchemaTypeInternal XmlSchemaType_t2033747345 * ___BaseXmlSchemaTypeInternal_21; // System.Xml.Schema.XmlSchemaDatatype System.Xml.Schema.XmlSchemaType::DatatypeInternal XmlSchemaDatatype_t322714710 * ___DatatypeInternal_22; // System.Xml.Schema.XmlSchemaDerivationMethod System.Xml.Schema.XmlSchemaType::resolvedDerivedBy int32_t ___resolvedDerivedBy_23; // System.Xml.Schema.XmlSchemaDerivationMethod System.Xml.Schema.XmlSchemaType::finalResolved int32_t ___finalResolved_24; // System.Xml.XmlQualifiedName System.Xml.Schema.XmlSchemaType::QNameInternal XmlQualifiedName_t2760654312 * ___QNameInternal_25; public: inline static int32_t get_offset_of_final_16() { return static_cast<int32_t>(offsetof(XmlSchemaType_t2033747345, ___final_16)); } inline int32_t get_final_16() const { return ___final_16; } inline int32_t* get_address_of_final_16() { return &___final_16; } inline void set_final_16(int32_t value) { ___final_16 = value; } inline static int32_t get_offset_of_isMixed_17() { return static_cast<int32_t>(offsetof(XmlSchemaType_t2033747345, ___isMixed_17)); } inline bool get_isMixed_17() const { return ___isMixed_17; } inline bool* get_address_of_isMixed_17() { return &___isMixed_17; } inline void set_isMixed_17(bool value) { ___isMixed_17 = value; } inline static int32_t get_offset_of_name_18() { return static_cast<int32_t>(offsetof(XmlSchemaType_t2033747345, ___name_18)); } inline String_t* get_name_18() const { return ___name_18; } inline String_t** get_address_of_name_18() { return &___name_18; } inline void set_name_18(String_t* value) { ___name_18 = value; Il2CppCodeGenWriteBarrier((&___name_18), value); } inline static int32_t get_offset_of_recursed_19() { return static_cast<int32_t>(offsetof(XmlSchemaType_t2033747345, ___recursed_19)); } inline bool get_recursed_19() const { return ___recursed_19; } inline bool* get_address_of_recursed_19() { return &___recursed_19; } inline void set_recursed_19(bool value) { ___recursed_19 = value; } inline static int32_t get_offset_of_BaseSchemaTypeName_20() { return static_cast<int32_t>(offsetof(XmlSchemaType_t2033747345, ___BaseSchemaTypeName_20)); } inline XmlQualifiedName_t2760654312 * get_BaseSchemaTypeName_20() const { return ___BaseSchemaTypeName_20; } inline XmlQualifiedName_t2760654312 ** get_address_of_BaseSchemaTypeName_20() { return &___BaseSchemaTypeName_20; } inline void set_BaseSchemaTypeName_20(XmlQualifiedName_t2760654312 * value) { ___BaseSchemaTypeName_20 = value; Il2CppCodeGenWriteBarrier((&___BaseSchemaTypeName_20), value); } inline static int32_t get_offset_of_BaseXmlSchemaTypeInternal_21() { return static_cast<int32_t>(offsetof(XmlSchemaType_t2033747345, ___BaseXmlSchemaTypeInternal_21)); } inline XmlSchemaType_t2033747345 * get_BaseXmlSchemaTypeInternal_21() const { return ___BaseXmlSchemaTypeInternal_21; } inline XmlSchemaType_t2033747345 ** get_address_of_BaseXmlSchemaTypeInternal_21() { return &___BaseXmlSchemaTypeInternal_21; } inline void set_BaseXmlSchemaTypeInternal_21(XmlSchemaType_t2033747345 * value) { ___BaseXmlSchemaTypeInternal_21 = value; Il2CppCodeGenWriteBarrier((&___BaseXmlSchemaTypeInternal_21), value); } inline static int32_t get_offset_of_DatatypeInternal_22() { return static_cast<int32_t>(offsetof(XmlSchemaType_t2033747345, ___DatatypeInternal_22)); } inline XmlSchemaDatatype_t322714710 * get_DatatypeInternal_22() const { return ___DatatypeInternal_22; } inline XmlSchemaDatatype_t322714710 ** get_address_of_DatatypeInternal_22() { return &___DatatypeInternal_22; } inline void set_DatatypeInternal_22(XmlSchemaDatatype_t322714710 * value) { ___DatatypeInternal_22 = value; Il2CppCodeGenWriteBarrier((&___DatatypeInternal_22), value); } inline static int32_t get_offset_of_resolvedDerivedBy_23() { return static_cast<int32_t>(offsetof(XmlSchemaType_t2033747345, ___resolvedDerivedBy_23)); } inline int32_t get_resolvedDerivedBy_23() const { return ___resolvedDerivedBy_23; } inline int32_t* get_address_of_resolvedDerivedBy_23() { return &___resolvedDerivedBy_23; } inline void set_resolvedDerivedBy_23(int32_t value) { ___resolvedDerivedBy_23 = value; } inline static int32_t get_offset_of_finalResolved_24() { return static_cast<int32_t>(offsetof(XmlSchemaType_t2033747345, ___finalResolved_24)); } inline int32_t get_finalResolved_24() const { return ___finalResolved_24; } inline int32_t* get_address_of_finalResolved_24() { return &___finalResolved_24; } inline void set_finalResolved_24(int32_t value) { ___finalResolved_24 = value; } inline static int32_t get_offset_of_QNameInternal_25() { return static_cast<int32_t>(offsetof(XmlSchemaType_t2033747345, ___QNameInternal_25)); } inline XmlQualifiedName_t2760654312 * get_QNameInternal_25() const { return ___QNameInternal_25; } inline XmlQualifiedName_t2760654312 ** get_address_of_QNameInternal_25() { return &___QNameInternal_25; } inline void set_QNameInternal_25(XmlQualifiedName_t2760654312 * value) { ___QNameInternal_25 = value; Il2CppCodeGenWriteBarrier((&___QNameInternal_25), value); } }; struct XmlSchemaType_t2033747345_StaticFields { public: // System.Collections.Generic.Dictionary`2<System.String,System.Int32> System.Xml.Schema.XmlSchemaType::<>f__switch$map42 Dictionary_2_t2736202052 * ___U3CU3Ef__switchU24map42_26; // System.Collections.Generic.Dictionary`2<System.String,System.Int32> System.Xml.Schema.XmlSchemaType::<>f__switch$map43 Dictionary_2_t2736202052 * ___U3CU3Ef__switchU24map43_27; public: inline static int32_t get_offset_of_U3CU3Ef__switchU24map42_26() { return static_cast<int32_t>(offsetof(XmlSchemaType_t2033747345_StaticFields, ___U3CU3Ef__switchU24map42_26)); } inline Dictionary_2_t2736202052 * get_U3CU3Ef__switchU24map42_26() const { return ___U3CU3Ef__switchU24map42_26; } inline Dictionary_2_t2736202052 ** get_address_of_U3CU3Ef__switchU24map42_26() { return &___U3CU3Ef__switchU24map42_26; } inline void set_U3CU3Ef__switchU24map42_26(Dictionary_2_t2736202052 * value) { ___U3CU3Ef__switchU24map42_26 = value; Il2CppCodeGenWriteBarrier((&___U3CU3Ef__switchU24map42_26), value); } inline static int32_t get_offset_of_U3CU3Ef__switchU24map43_27() { return static_cast<int32_t>(offsetof(XmlSchemaType_t2033747345_StaticFields, ___U3CU3Ef__switchU24map43_27)); } inline Dictionary_2_t2736202052 * get_U3CU3Ef__switchU24map43_27() const { return ___U3CU3Ef__switchU24map43_27; } inline Dictionary_2_t2736202052 ** get_address_of_U3CU3Ef__switchU24map43_27() { return &___U3CU3Ef__switchU24map43_27; } inline void set_U3CU3Ef__switchU24map43_27(Dictionary_2_t2736202052 * value) { ___U3CU3Ef__switchU24map43_27 = value; Il2CppCodeGenWriteBarrier((&___U3CU3Ef__switchU24map43_27), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // XMLSCHEMATYPE_T2033747345_H #ifndef XMLSCHEMAIDENTITYCONSTRAINT_T297318432_H #define XMLSCHEMAIDENTITYCONSTRAINT_T297318432_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Xml.Schema.XmlSchemaIdentityConstraint struct XmlSchemaIdentityConstraint_t297318432 : public XmlSchemaAnnotated_t2603549639 { public: // System.Xml.Schema.XmlSchemaObjectCollection System.Xml.Schema.XmlSchemaIdentityConstraint::fields XmlSchemaObjectCollection_t1064819932 * ___fields_16; // System.String System.Xml.Schema.XmlSchemaIdentityConstraint::name String_t* ___name_17; // System.Xml.XmlQualifiedName System.Xml.Schema.XmlSchemaIdentityConstraint::qName XmlQualifiedName_t2760654312 * ___qName_18; // System.Xml.Schema.XmlSchemaXPath System.Xml.Schema.XmlSchemaIdentityConstraint::selector XmlSchemaXPath_t3156455507 * ___selector_19; // Mono.Xml.Schema.XsdIdentitySelector System.Xml.Schema.XmlSchemaIdentityConstraint::compiledSelector XsdIdentitySelector_t574258590 * ___compiledSelector_20; public: inline static int32_t get_offset_of_fields_16() { return static_cast<int32_t>(offsetof(XmlSchemaIdentityConstraint_t297318432, ___fields_16)); } inline XmlSchemaObjectCollection_t1064819932 * get_fields_16() const { return ___fields_16; } inline XmlSchemaObjectCollection_t1064819932 ** get_address_of_fields_16() { return &___fields_16; } inline void set_fields_16(XmlSchemaObjectCollection_t1064819932 * value) { ___fields_16 = value; Il2CppCodeGenWriteBarrier((&___fields_16), value); } inline static int32_t get_offset_of_name_17() { return static_cast<int32_t>(offsetof(XmlSchemaIdentityConstraint_t297318432, ___name_17)); } inline String_t* get_name_17() const { return ___name_17; } inline String_t** get_address_of_name_17() { return &___name_17; } inline void set_name_17(String_t* value) { ___name_17 = value; Il2CppCodeGenWriteBarrier((&___name_17), value); } inline static int32_t get_offset_of_qName_18() { return static_cast<int32_t>(offsetof(XmlSchemaIdentityConstraint_t297318432, ___qName_18)); } inline XmlQualifiedName_t2760654312 * get_qName_18() const { return ___qName_18; } inline XmlQualifiedName_t2760654312 ** get_address_of_qName_18() { return &___qName_18; } inline void set_qName_18(XmlQualifiedName_t2760654312 * value) { ___qName_18 = value; Il2CppCodeGenWriteBarrier((&___qName_18), value); } inline static int32_t get_offset_of_selector_19() { return static_cast<int32_t>(offsetof(XmlSchemaIdentityConstraint_t297318432, ___selector_19)); } inline XmlSchemaXPath_t3156455507 * get_selector_19() const { return ___selector_19; } inline XmlSchemaXPath_t3156455507 ** get_address_of_selector_19() { return &___selector_19; } inline void set_selector_19(XmlSchemaXPath_t3156455507 * value) { ___selector_19 = value; Il2CppCodeGenWriteBarrier((&___selector_19), value); } inline static int32_t get_offset_of_compiledSelector_20() { return static_cast<int32_t>(offsetof(XmlSchemaIdentityConstraint_t297318432, ___compiledSelector_20)); } inline XsdIdentitySelector_t574258590 * get_compiledSelector_20() const { return ___compiledSelector_20; } inline XsdIdentitySelector_t574258590 ** get_address_of_compiledSelector_20() { return &___compiledSelector_20; } inline void set_compiledSelector_20(XsdIdentitySelector_t574258590 * value) { ___compiledSelector_20 = value; Il2CppCodeGenWriteBarrier((&___compiledSelector_20), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // XMLSCHEMAIDENTITYCONSTRAINT_T297318432_H #ifndef XMLSCHEMACONTENTMODEL_T602185179_H #define XMLSCHEMACONTENTMODEL_T602185179_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Xml.Schema.XmlSchemaContentModel struct XmlSchemaContentModel_t602185179 : public XmlSchemaAnnotated_t2603549639 { public: public: }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // XMLSCHEMACONTENTMODEL_T602185179_H #ifndef XMLSCHEMAIMPORT_T3509836441_H #define XMLSCHEMAIMPORT_T3509836441_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Xml.Schema.XmlSchemaImport struct XmlSchemaImport_t3509836441 : public XmlSchemaExternal_t3074890143 { public: // System.Xml.Schema.XmlSchemaAnnotation System.Xml.Schema.XmlSchemaImport::annotation XmlSchemaAnnotation_t2553753397 * ___annotation_16; // System.String System.Xml.Schema.XmlSchemaImport::nameSpace String_t* ___nameSpace_17; public: inline static int32_t get_offset_of_annotation_16() { return static_cast<int32_t>(offsetof(XmlSchemaImport_t3509836441, ___annotation_16)); } inline XmlSchemaAnnotation_t2553753397 * get_annotation_16() const { return ___annotation_16; } inline XmlSchemaAnnotation_t2553753397 ** get_address_of_annotation_16() { return &___annotation_16; } inline void set_annotation_16(XmlSchemaAnnotation_t2553753397 * value) { ___annotation_16 = value; Il2CppCodeGenWriteBarrier((&___annotation_16), value); } inline static int32_t get_offset_of_nameSpace_17() { return static_cast<int32_t>(offsetof(XmlSchemaImport_t3509836441, ___nameSpace_17)); } inline String_t* get_nameSpace_17() const { return ___nameSpace_17; } inline String_t** get_address_of_nameSpace_17() { return &___nameSpace_17; } inline void set_nameSpace_17(String_t* value) { ___nameSpace_17 = value; Il2CppCodeGenWriteBarrier((&___nameSpace_17), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // XMLSCHEMAIMPORT_T3509836441_H #ifndef XMLSCHEMACONTENT_T1040349258_H #define XMLSCHEMACONTENT_T1040349258_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Xml.Schema.XmlSchemaContent struct XmlSchemaContent_t1040349258 : public XmlSchemaAnnotated_t2603549639 { public: // System.Object System.Xml.Schema.XmlSchemaContent::actualBaseSchemaType RuntimeObject * ___actualBaseSchemaType_16; public: inline static int32_t get_offset_of_actualBaseSchemaType_16() { return static_cast<int32_t>(offsetof(XmlSchemaContent_t1040349258, ___actualBaseSchemaType_16)); } inline RuntimeObject * get_actualBaseSchemaType_16() const { return ___actualBaseSchemaType_16; } inline RuntimeObject ** get_address_of_actualBaseSchemaType_16() { return &___actualBaseSchemaType_16; } inline void set_actualBaseSchemaType_16(RuntimeObject * value) { ___actualBaseSchemaType_16 = value; Il2CppCodeGenWriteBarrier((&___actualBaseSchemaType_16), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // XMLSCHEMACONTENT_T1040349258_H #ifndef XMLSCHEMASIMPLETYPECONTENT_T599285223_H #define XMLSCHEMASIMPLETYPECONTENT_T599285223_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Xml.Schema.XmlSchemaSimpleTypeContent struct XmlSchemaSimpleTypeContent_t599285223 : public XmlSchemaAnnotated_t2603549639 { public: // System.Xml.Schema.XmlSchemaSimpleType System.Xml.Schema.XmlSchemaSimpleTypeContent::OwnerType XmlSchemaSimpleType_t2678868104 * ___OwnerType_16; public: inline static int32_t get_offset_of_OwnerType_16() { return static_cast<int32_t>(offsetof(XmlSchemaSimpleTypeContent_t599285223, ___OwnerType_16)); } inline XmlSchemaSimpleType_t2678868104 * get_OwnerType_16() const { return ___OwnerType_16; } inline XmlSchemaSimpleType_t2678868104 ** get_address_of_OwnerType_16() { return &___OwnerType_16; } inline void set_OwnerType_16(XmlSchemaSimpleType_t2678868104 * value) { ___OwnerType_16 = value; Il2CppCodeGenWriteBarrier((&___OwnerType_16), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // XMLSCHEMASIMPLETYPECONTENT_T599285223_H #ifndef XMLSCHEMAFACET_T1906017689_H #define XMLSCHEMAFACET_T1906017689_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Xml.Schema.XmlSchemaFacet struct XmlSchemaFacet_t1906017689 : public XmlSchemaAnnotated_t2603549639 { public: // System.Boolean System.Xml.Schema.XmlSchemaFacet::isFixed bool ___isFixed_17; // System.String System.Xml.Schema.XmlSchemaFacet::val String_t* ___val_18; public: inline static int32_t get_offset_of_isFixed_17() { return static_cast<int32_t>(offsetof(XmlSchemaFacet_t1906017689, ___isFixed_17)); } inline bool get_isFixed_17() const { return ___isFixed_17; } inline bool* get_address_of_isFixed_17() { return &___isFixed_17; } inline void set_isFixed_17(bool value) { ___isFixed_17 = value; } inline static int32_t get_offset_of_val_18() { return static_cast<int32_t>(offsetof(XmlSchemaFacet_t1906017689, ___val_18)); } inline String_t* get_val_18() const { return ___val_18; } inline String_t** get_address_of_val_18() { return &___val_18; } inline void set_val_18(String_t* value) { ___val_18 = value; Il2CppCodeGenWriteBarrier((&___val_18), value); } }; struct XmlSchemaFacet_t1906017689_StaticFields { public: // System.Xml.Schema.XmlSchemaFacet/Facet System.Xml.Schema.XmlSchemaFacet::AllFacets int32_t ___AllFacets_16; public: inline static int32_t get_offset_of_AllFacets_16() { return static_cast<int32_t>(offsetof(XmlSchemaFacet_t1906017689_StaticFields, ___AllFacets_16)); } inline int32_t get_AllFacets_16() const { return ___AllFacets_16; } inline int32_t* get_address_of_AllFacets_16() { return &___AllFacets_16; } inline void set_AllFacets_16(int32_t value) { ___AllFacets_16 = value; } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // XMLSCHEMAFACET_T1906017689_H #ifndef XMLSCHEMAREDEFINE_T4020109446_H #define XMLSCHEMAREDEFINE_T4020109446_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Xml.Schema.XmlSchemaRedefine struct XmlSchemaRedefine_t4020109446 : public XmlSchemaExternal_t3074890143 { public: // System.Xml.Schema.XmlSchemaObjectTable System.Xml.Schema.XmlSchemaRedefine::attributeGroups XmlSchemaObjectTable_t2546974348 * ___attributeGroups_16; // System.Xml.Schema.XmlSchemaObjectTable System.Xml.Schema.XmlSchemaRedefine::groups XmlSchemaObjectTable_t2546974348 * ___groups_17; // System.Xml.Schema.XmlSchemaObjectCollection System.Xml.Schema.XmlSchemaRedefine::items XmlSchemaObjectCollection_t1064819932 * ___items_18; // System.Xml.Schema.XmlSchemaObjectTable System.Xml.Schema.XmlSchemaRedefine::schemaTypes XmlSchemaObjectTable_t2546974348 * ___schemaTypes_19; public: inline static int32_t get_offset_of_attributeGroups_16() { return static_cast<int32_t>(offsetof(XmlSchemaRedefine_t4020109446, ___attributeGroups_16)); } inline XmlSchemaObjectTable_t2546974348 * get_attributeGroups_16() const { return ___attributeGroups_16; } inline XmlSchemaObjectTable_t2546974348 ** get_address_of_attributeGroups_16() { return &___attributeGroups_16; } inline void set_attributeGroups_16(XmlSchemaObjectTable_t2546974348 * value) { ___attributeGroups_16 = value; Il2CppCodeGenWriteBarrier((&___attributeGroups_16), value); } inline static int32_t get_offset_of_groups_17() { return static_cast<int32_t>(offsetof(XmlSchemaRedefine_t4020109446, ___groups_17)); } inline XmlSchemaObjectTable_t2546974348 * get_groups_17() const { return ___groups_17; } inline XmlSchemaObjectTable_t2546974348 ** get_address_of_groups_17() { return &___groups_17; } inline void set_groups_17(XmlSchemaObjectTable_t2546974348 * value) { ___groups_17 = value; Il2CppCodeGenWriteBarrier((&___groups_17), value); } inline static int32_t get_offset_of_items_18() { return static_cast<int32_t>(offsetof(XmlSchemaRedefine_t4020109446, ___items_18)); } inline XmlSchemaObjectCollection_t1064819932 * get_items_18() const { return ___items_18; } inline XmlSchemaObjectCollection_t1064819932 ** get_address_of_items_18() { return &___items_18; } inline void set_items_18(XmlSchemaObjectCollection_t1064819932 * value) { ___items_18 = value; Il2CppCodeGenWriteBarrier((&___items_18), value); } inline static int32_t get_offset_of_schemaTypes_19() { return static_cast<int32_t>(offsetof(XmlSchemaRedefine_t4020109446, ___schemaTypes_19)); } inline XmlSchemaObjectTable_t2546974348 * get_schemaTypes_19() const { return ___schemaTypes_19; } inline XmlSchemaObjectTable_t2546974348 ** get_address_of_schemaTypes_19() { return &___schemaTypes_19; } inline void set_schemaTypes_19(XmlSchemaObjectTable_t2546974348 * value) { ___schemaTypes_19 = value; Il2CppCodeGenWriteBarrier((&___schemaTypes_19), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // XMLSCHEMAREDEFINE_T4020109446_H #ifndef XMLSCHEMAXPATH_T3156455507_H #define XMLSCHEMAXPATH_T3156455507_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Xml.Schema.XmlSchemaXPath struct XmlSchemaXPath_t3156455507 : public XmlSchemaAnnotated_t2603549639 { public: // System.String System.Xml.Schema.XmlSchemaXPath::xpath String_t* ___xpath_16; // System.Xml.XmlNamespaceManager System.Xml.Schema.XmlSchemaXPath::nsmgr XmlNamespaceManager_t418790500 * ___nsmgr_17; // System.Boolean System.Xml.Schema.XmlSchemaXPath::isSelector bool ___isSelector_18; // Mono.Xml.Schema.XsdIdentityPath[] System.Xml.Schema.XmlSchemaXPath::compiledExpression XsdIdentityPathU5BU5D_t2466178853* ___compiledExpression_19; // Mono.Xml.Schema.XsdIdentityPath System.Xml.Schema.XmlSchemaXPath::currentPath XsdIdentityPath_t991900844 * ___currentPath_20; public: inline static int32_t get_offset_of_xpath_16() { return static_cast<int32_t>(offsetof(XmlSchemaXPath_t3156455507, ___xpath_16)); } inline String_t* get_xpath_16() const { return ___xpath_16; } inline String_t** get_address_of_xpath_16() { return &___xpath_16; } inline void set_xpath_16(String_t* value) { ___xpath_16 = value; Il2CppCodeGenWriteBarrier((&___xpath_16), value); } inline static int32_t get_offset_of_nsmgr_17() { return static_cast<int32_t>(offsetof(XmlSchemaXPath_t3156455507, ___nsmgr_17)); } inline XmlNamespaceManager_t418790500 * get_nsmgr_17() const { return ___nsmgr_17; } inline XmlNamespaceManager_t418790500 ** get_address_of_nsmgr_17() { return &___nsmgr_17; } inline void set_nsmgr_17(XmlNamespaceManager_t418790500 * value) { ___nsmgr_17 = value; Il2CppCodeGenWriteBarrier((&___nsmgr_17), value); } inline static int32_t get_offset_of_isSelector_18() { return static_cast<int32_t>(offsetof(XmlSchemaXPath_t3156455507, ___isSelector_18)); } inline bool get_isSelector_18() const { return ___isSelector_18; } inline bool* get_address_of_isSelector_18() { return &___isSelector_18; } inline void set_isSelector_18(bool value) { ___isSelector_18 = value; } inline static int32_t get_offset_of_compiledExpression_19() { return static_cast<int32_t>(offsetof(XmlSchemaXPath_t3156455507, ___compiledExpression_19)); } inline XsdIdentityPathU5BU5D_t2466178853* get_compiledExpression_19() const { return ___compiledExpression_19; } inline XsdIdentityPathU5BU5D_t2466178853** get_address_of_compiledExpression_19() { return &___compiledExpression_19; } inline void set_compiledExpression_19(XsdIdentityPathU5BU5D_t2466178853* value) { ___compiledExpression_19 = value; Il2CppCodeGenWriteBarrier((&___compiledExpression_19), value); } inline static int32_t get_offset_of_currentPath_20() { return static_cast<int32_t>(offsetof(XmlSchemaXPath_t3156455507, ___currentPath_20)); } inline XsdIdentityPath_t991900844 * get_currentPath_20() const { return ___currentPath_20; } inline XsdIdentityPath_t991900844 ** get_address_of_currentPath_20() { return &___currentPath_20; } inline void set_currentPath_20(XsdIdentityPath_t991900844 * value) { ___currentPath_20 = value; Il2CppCodeGenWriteBarrier((&___currentPath_20), value); } }; struct XmlSchemaXPath_t3156455507_StaticFields { public: // System.Collections.Generic.Dictionary`2<System.String,System.Int32> System.Xml.Schema.XmlSchemaXPath::<>f__switch$map4A Dictionary_2_t2736202052 * ___U3CU3Ef__switchU24map4A_21; public: inline static int32_t get_offset_of_U3CU3Ef__switchU24map4A_21() { return static_cast<int32_t>(offsetof(XmlSchemaXPath_t3156455507_StaticFields, ___U3CU3Ef__switchU24map4A_21)); } inline Dictionary_2_t2736202052 * get_U3CU3Ef__switchU24map4A_21() const { return ___U3CU3Ef__switchU24map4A_21; } inline Dictionary_2_t2736202052 ** get_address_of_U3CU3Ef__switchU24map4A_21() { return &___U3CU3Ef__switchU24map4A_21; } inline void set_U3CU3Ef__switchU24map4A_21(Dictionary_2_t2736202052 * value) { ___U3CU3Ef__switchU24map4A_21 = value; Il2CppCodeGenWriteBarrier((&___U3CU3Ef__switchU24map4A_21), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // XMLSCHEMAXPATH_T3156455507_H #ifndef XMLSCHEMANOTATION_T2664560277_H #define XMLSCHEMANOTATION_T2664560277_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Xml.Schema.XmlSchemaNotation struct XmlSchemaNotation_t2664560277 : public XmlSchemaAnnotated_t2603549639 { public: // System.String System.Xml.Schema.XmlSchemaNotation::name String_t* ___name_16; // System.String System.Xml.Schema.XmlSchemaNotation::pub String_t* ___pub_17; // System.String System.Xml.Schema.XmlSchemaNotation::system String_t* ___system_18; // System.Xml.XmlQualifiedName System.Xml.Schema.XmlSchemaNotation::qualifiedName XmlQualifiedName_t2760654312 * ___qualifiedName_19; public: inline static int32_t get_offset_of_name_16() { return static_cast<int32_t>(offsetof(XmlSchemaNotation_t2664560277, ___name_16)); } inline String_t* get_name_16() const { return ___name_16; } inline String_t** get_address_of_name_16() { return &___name_16; } inline void set_name_16(String_t* value) { ___name_16 = value; Il2CppCodeGenWriteBarrier((&___name_16), value); } inline static int32_t get_offset_of_pub_17() { return static_cast<int32_t>(offsetof(XmlSchemaNotation_t2664560277, ___pub_17)); } inline String_t* get_pub_17() const { return ___pub_17; } inline String_t** get_address_of_pub_17() { return &___pub_17; } inline void set_pub_17(String_t* value) { ___pub_17 = value; Il2CppCodeGenWriteBarrier((&___pub_17), value); } inline static int32_t get_offset_of_system_18() { return static_cast<int32_t>(offsetof(XmlSchemaNotation_t2664560277, ___system_18)); } inline String_t* get_system_18() const { return ___system_18; } inline String_t** get_address_of_system_18() { return &___system_18; } inline void set_system_18(String_t* value) { ___system_18 = value; Il2CppCodeGenWriteBarrier((&___system_18), value); } inline static int32_t get_offset_of_qualifiedName_19() { return static_cast<int32_t>(offsetof(XmlSchemaNotation_t2664560277, ___qualifiedName_19)); } inline XmlQualifiedName_t2760654312 * get_qualifiedName_19() const { return ___qualifiedName_19; } inline XmlQualifiedName_t2760654312 ** get_address_of_qualifiedName_19() { return &___qualifiedName_19; } inline void set_qualifiedName_19(XmlQualifiedName_t2760654312 * value) { ___qualifiedName_19 = value; Il2CppCodeGenWriteBarrier((&___qualifiedName_19), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // XMLSCHEMANOTATION_T2664560277_H #ifndef XMLSCHEMAPARTICLE_T3828501457_H #define XMLSCHEMAPARTICLE_T3828501457_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Xml.Schema.XmlSchemaParticle struct XmlSchemaParticle_t3828501457 : public XmlSchemaAnnotated_t2603549639 { public: // System.Decimal System.Xml.Schema.XmlSchemaParticle::minOccurs Decimal_t2948259380 ___minOccurs_16; // System.Decimal System.Xml.Schema.XmlSchemaParticle::maxOccurs Decimal_t2948259380 ___maxOccurs_17; // System.String System.Xml.Schema.XmlSchemaParticle::minstr String_t* ___minstr_18; // System.String System.Xml.Schema.XmlSchemaParticle::maxstr String_t* ___maxstr_19; // System.Decimal System.Xml.Schema.XmlSchemaParticle::validatedMinOccurs Decimal_t2948259380 ___validatedMinOccurs_21; // System.Decimal System.Xml.Schema.XmlSchemaParticle::validatedMaxOccurs Decimal_t2948259380 ___validatedMaxOccurs_22; // System.Int32 System.Xml.Schema.XmlSchemaParticle::recursionDepth int32_t ___recursionDepth_23; // System.Decimal System.Xml.Schema.XmlSchemaParticle::minEffectiveTotalRange Decimal_t2948259380 ___minEffectiveTotalRange_24; // System.Boolean System.Xml.Schema.XmlSchemaParticle::parentIsGroupDefinition bool ___parentIsGroupDefinition_25; // System.Xml.Schema.XmlSchemaParticle System.Xml.Schema.XmlSchemaParticle::OptimizedParticle XmlSchemaParticle_t3828501457 * ___OptimizedParticle_26; public: inline static int32_t get_offset_of_minOccurs_16() { return static_cast<int32_t>(offsetof(XmlSchemaParticle_t3828501457, ___minOccurs_16)); } inline Decimal_t2948259380 get_minOccurs_16() const { return ___minOccurs_16; } inline Decimal_t2948259380 * get_address_of_minOccurs_16() { return &___minOccurs_16; } inline void set_minOccurs_16(Decimal_t2948259380 value) { ___minOccurs_16 = value; } inline static int32_t get_offset_of_maxOccurs_17() { return static_cast<int32_t>(offsetof(XmlSchemaParticle_t3828501457, ___maxOccurs_17)); } inline Decimal_t2948259380 get_maxOccurs_17() const { return ___maxOccurs_17; } inline Decimal_t2948259380 * get_address_of_maxOccurs_17() { return &___maxOccurs_17; } inline void set_maxOccurs_17(Decimal_t2948259380 value) { ___maxOccurs_17 = value; } inline static int32_t get_offset_of_minstr_18() { return static_cast<int32_t>(offsetof(XmlSchemaParticle_t3828501457, ___minstr_18)); } inline String_t* get_minstr_18() const { return ___minstr_18; } inline String_t** get_address_of_minstr_18() { return &___minstr_18; } inline void set_minstr_18(String_t* value) { ___minstr_18 = value; Il2CppCodeGenWriteBarrier((&___minstr_18), value); } inline static int32_t get_offset_of_maxstr_19() { return static_cast<int32_t>(offsetof(XmlSchemaParticle_t3828501457, ___maxstr_19)); } inline String_t* get_maxstr_19() const { return ___maxstr_19; } inline String_t** get_address_of_maxstr_19() { return &___maxstr_19; } inline void set_maxstr_19(String_t* value) { ___maxstr_19 = value; Il2CppCodeGenWriteBarrier((&___maxstr_19), value); } inline static int32_t get_offset_of_validatedMinOccurs_21() { return static_cast<int32_t>(offsetof(XmlSchemaParticle_t3828501457, ___validatedMinOccurs_21)); } inline Decimal_t2948259380 get_validatedMinOccurs_21() const { return ___validatedMinOccurs_21; } inline Decimal_t2948259380 * get_address_of_validatedMinOccurs_21() { return &___validatedMinOccurs_21; } inline void set_validatedMinOccurs_21(Decimal_t2948259380 value) { ___validatedMinOccurs_21 = value; } inline static int32_t get_offset_of_validatedMaxOccurs_22() { return static_cast<int32_t>(offsetof(XmlSchemaParticle_t3828501457, ___validatedMaxOccurs_22)); } inline Decimal_t2948259380 get_validatedMaxOccurs_22() const { return ___validatedMaxOccurs_22; } inline Decimal_t2948259380 * get_address_of_validatedMaxOccurs_22() { return &___validatedMaxOccurs_22; } inline void set_validatedMaxOccurs_22(Decimal_t2948259380 value) { ___validatedMaxOccurs_22 = value; } inline static int32_t get_offset_of_recursionDepth_23() { return static_cast<int32_t>(offsetof(XmlSchemaParticle_t3828501457, ___recursionDepth_23)); } inline int32_t get_recursionDepth_23() const { return ___recursionDepth_23; } inline int32_t* get_address_of_recursionDepth_23() { return &___recursionDepth_23; } inline void set_recursionDepth_23(int32_t value) { ___recursionDepth_23 = value; } inline static int32_t get_offset_of_minEffectiveTotalRange_24() { return static_cast<int32_t>(offsetof(XmlSchemaParticle_t3828501457, ___minEffectiveTotalRange_24)); } inline Decimal_t2948259380 get_minEffectiveTotalRange_24() const { return ___minEffectiveTotalRange_24; } inline Decimal_t2948259380 * get_address_of_minEffectiveTotalRange_24() { return &___minEffectiveTotalRange_24; } inline void set_minEffectiveTotalRange_24(Decimal_t2948259380 value) { ___minEffectiveTotalRange_24 = value; } inline static int32_t get_offset_of_parentIsGroupDefinition_25() { return static_cast<int32_t>(offsetof(XmlSchemaParticle_t3828501457, ___parentIsGroupDefinition_25)); } inline bool get_parentIsGroupDefinition_25() const { return ___parentIsGroupDefinition_25; } inline bool* get_address_of_parentIsGroupDefinition_25() { return &___parentIsGroupDefinition_25; } inline void set_parentIsGroupDefinition_25(bool value) { ___parentIsGroupDefinition_25 = value; } inline static int32_t get_offset_of_OptimizedParticle_26() { return static_cast<int32_t>(offsetof(XmlSchemaParticle_t3828501457, ___OptimizedParticle_26)); } inline XmlSchemaParticle_t3828501457 * get_OptimizedParticle_26() const { return ___OptimizedParticle_26; } inline XmlSchemaParticle_t3828501457 ** get_address_of_OptimizedParticle_26() { return &___OptimizedParticle_26; } inline void set_OptimizedParticle_26(XmlSchemaParticle_t3828501457 * value) { ___OptimizedParticle_26 = value; Il2CppCodeGenWriteBarrier((&___OptimizedParticle_26), value); } }; struct XmlSchemaParticle_t3828501457_StaticFields { public: // System.Xml.Schema.XmlSchemaParticle System.Xml.Schema.XmlSchemaParticle::empty XmlSchemaParticle_t3828501457 * ___empty_20; public: inline static int32_t get_offset_of_empty_20() { return static_cast<int32_t>(offsetof(XmlSchemaParticle_t3828501457_StaticFields, ___empty_20)); } inline XmlSchemaParticle_t3828501457 * get_empty_20() const { return ___empty_20; } inline XmlSchemaParticle_t3828501457 ** get_address_of_empty_20() { return &___empty_20; } inline void set_empty_20(XmlSchemaParticle_t3828501457 * value) { ___empty_20 = value; Il2CppCodeGenWriteBarrier((&___empty_20), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // XMLSCHEMAPARTICLE_T3828501457_H #ifndef XMLSCHEMAGROUP_T1441741786_H #define XMLSCHEMAGROUP_T1441741786_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Xml.Schema.XmlSchemaGroup struct XmlSchemaGroup_t1441741786 : public XmlSchemaAnnotated_t2603549639 { public: // System.String System.Xml.Schema.XmlSchemaGroup::name String_t* ___name_16; // System.Xml.Schema.XmlSchemaGroupBase System.Xml.Schema.XmlSchemaGroup::particle XmlSchemaGroupBase_t3631079376 * ___particle_17; // System.Xml.XmlQualifiedName System.Xml.Schema.XmlSchemaGroup::qualifiedName XmlQualifiedName_t2760654312 * ___qualifiedName_18; // System.Boolean System.Xml.Schema.XmlSchemaGroup::isCircularDefinition bool ___isCircularDefinition_19; public: inline static int32_t get_offset_of_name_16() { return static_cast<int32_t>(offsetof(XmlSchemaGroup_t1441741786, ___name_16)); } inline String_t* get_name_16() const { return ___name_16; } inline String_t** get_address_of_name_16() { return &___name_16; } inline void set_name_16(String_t* value) { ___name_16 = value; Il2CppCodeGenWriteBarrier((&___name_16), value); } inline static int32_t get_offset_of_particle_17() { return static_cast<int32_t>(offsetof(XmlSchemaGroup_t1441741786, ___particle_17)); } inline XmlSchemaGroupBase_t3631079376 * get_particle_17() const { return ___particle_17; } inline XmlSchemaGroupBase_t3631079376 ** get_address_of_particle_17() { return &___particle_17; } inline void set_particle_17(XmlSchemaGroupBase_t3631079376 * value) { ___particle_17 = value; Il2CppCodeGenWriteBarrier((&___particle_17), value); } inline static int32_t get_offset_of_qualifiedName_18() { return static_cast<int32_t>(offsetof(XmlSchemaGroup_t1441741786, ___qualifiedName_18)); } inline XmlQualifiedName_t2760654312 * get_qualifiedName_18() const { return ___qualifiedName_18; } inline XmlQualifiedName_t2760654312 ** get_address_of_qualifiedName_18() { return &___qualifiedName_18; } inline void set_qualifiedName_18(XmlQualifiedName_t2760654312 * value) { ___qualifiedName_18 = value; Il2CppCodeGenWriteBarrier((&___qualifiedName_18), value); } inline static int32_t get_offset_of_isCircularDefinition_19() { return static_cast<int32_t>(offsetof(XmlSchemaGroup_t1441741786, ___isCircularDefinition_19)); } inline bool get_isCircularDefinition_19() const { return ___isCircularDefinition_19; } inline bool* get_address_of_isCircularDefinition_19() { return &___isCircularDefinition_19; } inline void set_isCircularDefinition_19(bool value) { ___isCircularDefinition_19 = value; } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // XMLSCHEMAGROUP_T1441741786_H #ifndef XMLSCHEMAGROUPREF_T1314446647_H #define XMLSCHEMAGROUPREF_T1314446647_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Xml.Schema.XmlSchemaGroupRef struct XmlSchemaGroupRef_t1314446647 : public XmlSchemaParticle_t3828501457 { public: // System.Xml.Schema.XmlSchema System.Xml.Schema.XmlSchemaGroupRef::schema XmlSchema_t3742557897 * ___schema_27; // System.Xml.XmlQualifiedName System.Xml.Schema.XmlSchemaGroupRef::refName XmlQualifiedName_t2760654312 * ___refName_28; // System.Xml.Schema.XmlSchemaGroup System.Xml.Schema.XmlSchemaGroupRef::referencedGroup XmlSchemaGroup_t1441741786 * ___referencedGroup_29; // System.Boolean System.Xml.Schema.XmlSchemaGroupRef::busy bool ___busy_30; public: inline static int32_t get_offset_of_schema_27() { return static_cast<int32_t>(offsetof(XmlSchemaGroupRef_t1314446647, ___schema_27)); } inline XmlSchema_t3742557897 * get_schema_27() const { return ___schema_27; } inline XmlSchema_t3742557897 ** get_address_of_schema_27() { return &___schema_27; } inline void set_schema_27(XmlSchema_t3742557897 * value) { ___schema_27 = value; Il2CppCodeGenWriteBarrier((&___schema_27), value); } inline static int32_t get_offset_of_refName_28() { return static_cast<int32_t>(offsetof(XmlSchemaGroupRef_t1314446647, ___refName_28)); } inline XmlQualifiedName_t2760654312 * get_refName_28() const { return ___refName_28; } inline XmlQualifiedName_t2760654312 ** get_address_of_refName_28() { return &___refName_28; } inline void set_refName_28(XmlQualifiedName_t2760654312 * value) { ___refName_28 = value; Il2CppCodeGenWriteBarrier((&___refName_28), value); } inline static int32_t get_offset_of_referencedGroup_29() { return static_cast<int32_t>(offsetof(XmlSchemaGroupRef_t1314446647, ___referencedGroup_29)); } inline XmlSchemaGroup_t1441741786 * get_referencedGroup_29() const { return ___referencedGroup_29; } inline XmlSchemaGroup_t1441741786 ** get_address_of_referencedGroup_29() { return &___referencedGroup_29; } inline void set_referencedGroup_29(XmlSchemaGroup_t1441741786 * value) { ___referencedGroup_29 = value; Il2CppCodeGenWriteBarrier((&___referencedGroup_29), value); } inline static int32_t get_offset_of_busy_30() { return static_cast<int32_t>(offsetof(XmlSchemaGroupRef_t1314446647, ___busy_30)); } inline bool get_busy_30() const { return ___busy_30; } inline bool* get_address_of_busy_30() { return &___busy_30; } inline void set_busy_30(bool value) { ___busy_30 = value; } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // XMLSCHEMAGROUPREF_T1314446647_H #ifndef XMLSCHEMAELEMENT_T427880856_H #define XMLSCHEMAELEMENT_T427880856_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Xml.Schema.XmlSchemaElement struct XmlSchemaElement_t427880856 : public XmlSchemaParticle_t3828501457 { public: // System.Xml.Schema.XmlSchemaDerivationMethod System.Xml.Schema.XmlSchemaElement::block int32_t ___block_27; // System.Xml.Schema.XmlSchemaObjectCollection System.Xml.Schema.XmlSchemaElement::constraints XmlSchemaObjectCollection_t1064819932 * ___constraints_28; // System.String System.Xml.Schema.XmlSchemaElement::defaultValue String_t* ___defaultValue_29; // System.Object System.Xml.Schema.XmlSchemaElement::elementType RuntimeObject * ___elementType_30; // System.Xml.Schema.XmlSchemaType System.Xml.Schema.XmlSchemaElement::elementSchemaType XmlSchemaType_t2033747345 * ___elementSchemaType_31; // System.Xml.Schema.XmlSchemaDerivationMethod System.Xml.Schema.XmlSchemaElement::final int32_t ___final_32; // System.String System.Xml.Schema.XmlSchemaElement::fixedValue String_t* ___fixedValue_33; // System.Xml.Schema.XmlSchemaForm System.Xml.Schema.XmlSchemaElement::form int32_t ___form_34; // System.Boolean System.Xml.Schema.XmlSchemaElement::isAbstract bool ___isAbstract_35; // System.Boolean System.Xml.Schema.XmlSchemaElement::isNillable bool ___isNillable_36; // System.String System.Xml.Schema.XmlSchemaElement::name String_t* ___name_37; // System.Xml.XmlQualifiedName System.Xml.Schema.XmlSchemaElement::refName XmlQualifiedName_t2760654312 * ___refName_38; // System.Xml.Schema.XmlSchemaType System.Xml.Schema.XmlSchemaElement::schemaType XmlSchemaType_t2033747345 * ___schemaType_39; // System.Xml.XmlQualifiedName System.Xml.Schema.XmlSchemaElement::schemaTypeName XmlQualifiedName_t2760654312 * ___schemaTypeName_40; // System.Xml.XmlQualifiedName System.Xml.Schema.XmlSchemaElement::substitutionGroup XmlQualifiedName_t2760654312 * ___substitutionGroup_41; // System.Xml.Schema.XmlSchema System.Xml.Schema.XmlSchemaElement::schema XmlSchema_t3742557897 * ___schema_42; // System.Boolean System.Xml.Schema.XmlSchemaElement::parentIsSchema bool ___parentIsSchema_43; // System.Xml.XmlQualifiedName System.Xml.Schema.XmlSchemaElement::qName XmlQualifiedName_t2760654312 * ___qName_44; // System.Xml.Schema.XmlSchemaDerivationMethod System.Xml.Schema.XmlSchemaElement::blockResolved int32_t ___blockResolved_45; // System.Xml.Schema.XmlSchemaDerivationMethod System.Xml.Schema.XmlSchemaElement::finalResolved int32_t ___finalResolved_46; // System.Xml.Schema.XmlSchemaElement System.Xml.Schema.XmlSchemaElement::referencedElement XmlSchemaElement_t427880856 * ___referencedElement_47; // System.Collections.ArrayList System.Xml.Schema.XmlSchemaElement::substitutingElements ArrayList_t2718874744 * ___substitutingElements_48; // System.Xml.Schema.XmlSchemaElement System.Xml.Schema.XmlSchemaElement::substitutionGroupElement XmlSchemaElement_t427880856 * ___substitutionGroupElement_49; // System.Boolean System.Xml.Schema.XmlSchemaElement::actualIsAbstract bool ___actualIsAbstract_50; // System.Boolean System.Xml.Schema.XmlSchemaElement::actualIsNillable bool ___actualIsNillable_51; // System.String System.Xml.Schema.XmlSchemaElement::validatedDefaultValue String_t* ___validatedDefaultValue_52; // System.String System.Xml.Schema.XmlSchemaElement::validatedFixedValue String_t* ___validatedFixedValue_53; public: inline static int32_t get_offset_of_block_27() { return static_cast<int32_t>(offsetof(XmlSchemaElement_t427880856, ___block_27)); } inline int32_t get_block_27() const { return ___block_27; } inline int32_t* get_address_of_block_27() { return &___block_27; } inline void set_block_27(int32_t value) { ___block_27 = value; } inline static int32_t get_offset_of_constraints_28() { return static_cast<int32_t>(offsetof(XmlSchemaElement_t427880856, ___constraints_28)); } inline XmlSchemaObjectCollection_t1064819932 * get_constraints_28() const { return ___constraints_28; } inline XmlSchemaObjectCollection_t1064819932 ** get_address_of_constraints_28() { return &___constraints_28; } inline void set_constraints_28(XmlSchemaObjectCollection_t1064819932 * value) { ___constraints_28 = value; Il2CppCodeGenWriteBarrier((&___constraints_28), value); } inline static int32_t get_offset_of_defaultValue_29() { return static_cast<int32_t>(offsetof(XmlSchemaElement_t427880856, ___defaultValue_29)); } inline String_t* get_defaultValue_29() const { return ___defaultValue_29; } inline String_t** get_address_of_defaultValue_29() { return &___defaultValue_29; } inline void set_defaultValue_29(String_t* value) { ___defaultValue_29 = value; Il2CppCodeGenWriteBarrier((&___defaultValue_29), value); } inline static int32_t get_offset_of_elementType_30() { return static_cast<int32_t>(offsetof(XmlSchemaElement_t427880856, ___elementType_30)); } inline RuntimeObject * get_elementType_30() const { return ___elementType_30; } inline RuntimeObject ** get_address_of_elementType_30() { return &___elementType_30; } inline void set_elementType_30(RuntimeObject * value) { ___elementType_30 = value; Il2CppCodeGenWriteBarrier((&___elementType_30), value); } inline static int32_t get_offset_of_elementSchemaType_31() { return static_cast<int32_t>(offsetof(XmlSchemaElement_t427880856, ___elementSchemaType_31)); } inline XmlSchemaType_t2033747345 * get_elementSchemaType_31() const { return ___elementSchemaType_31; } inline XmlSchemaType_t2033747345 ** get_address_of_elementSchemaType_31() { return &___elementSchemaType_31; } inline void set_elementSchemaType_31(XmlSchemaType_t2033747345 * value) { ___elementSchemaType_31 = value; Il2CppCodeGenWriteBarrier((&___elementSchemaType_31), value); } inline static int32_t get_offset_of_final_32() { return static_cast<int32_t>(offsetof(XmlSchemaElement_t427880856, ___final_32)); } inline int32_t get_final_32() const { return ___final_32; } inline int32_t* get_address_of_final_32() { return &___final_32; } inline void set_final_32(int32_t value) { ___final_32 = value; } inline static int32_t get_offset_of_fixedValue_33() { return static_cast<int32_t>(offsetof(XmlSchemaElement_t427880856, ___fixedValue_33)); } inline String_t* get_fixedValue_33() const { return ___fixedValue_33; } inline String_t** get_address_of_fixedValue_33() { return &___fixedValue_33; } inline void set_fixedValue_33(String_t* value) { ___fixedValue_33 = value; Il2CppCodeGenWriteBarrier((&___fixedValue_33), value); } inline static int32_t get_offset_of_form_34() { return static_cast<int32_t>(offsetof(XmlSchemaElement_t427880856, ___form_34)); } inline int32_t get_form_34() const { return ___form_34; } inline int32_t* get_address_of_form_34() { return &___form_34; } inline void set_form_34(int32_t value) { ___form_34 = value; } inline static int32_t get_offset_of_isAbstract_35() { return static_cast<int32_t>(offsetof(XmlSchemaElement_t427880856, ___isAbstract_35)); } inline bool get_isAbstract_35() const { return ___isAbstract_35; } inline bool* get_address_of_isAbstract_35() { return &___isAbstract_35; } inline void set_isAbstract_35(bool value) { ___isAbstract_35 = value; } inline static int32_t get_offset_of_isNillable_36() { return static_cast<int32_t>(offsetof(XmlSchemaElement_t427880856, ___isNillable_36)); } inline bool get_isNillable_36() const { return ___isNillable_36; } inline bool* get_address_of_isNillable_36() { return &___isNillable_36; } inline void set_isNillable_36(bool value) { ___isNillable_36 = value; } inline static int32_t get_offset_of_name_37() { return static_cast<int32_t>(offsetof(XmlSchemaElement_t427880856, ___name_37)); } inline String_t* get_name_37() const { return ___name_37; } inline String_t** get_address_of_name_37() { return &___name_37; } inline void set_name_37(String_t* value) { ___name_37 = value; Il2CppCodeGenWriteBarrier((&___name_37), value); } inline static int32_t get_offset_of_refName_38() { return static_cast<int32_t>(offsetof(XmlSchemaElement_t427880856, ___refName_38)); } inline XmlQualifiedName_t2760654312 * get_refName_38() const { return ___refName_38; } inline XmlQualifiedName_t2760654312 ** get_address_of_refName_38() { return &___refName_38; } inline void set_refName_38(XmlQualifiedName_t2760654312 * value) { ___refName_38 = value; Il2CppCodeGenWriteBarrier((&___refName_38), value); } inline static int32_t get_offset_of_schemaType_39() { return static_cast<int32_t>(offsetof(XmlSchemaElement_t427880856, ___schemaType_39)); } inline XmlSchemaType_t2033747345 * get_schemaType_39() const { return ___schemaType_39; } inline XmlSchemaType_t2033747345 ** get_address_of_schemaType_39() { return &___schemaType_39; } inline void set_schemaType_39(XmlSchemaType_t2033747345 * value) { ___schemaType_39 = value; Il2CppCodeGenWriteBarrier((&___schemaType_39), value); } inline static int32_t get_offset_of_schemaTypeName_40() { return static_cast<int32_t>(offsetof(XmlSchemaElement_t427880856, ___schemaTypeName_40)); } inline XmlQualifiedName_t2760654312 * get_schemaTypeName_40() const { return ___schemaTypeName_40; } inline XmlQualifiedName_t2760654312 ** get_address_of_schemaTypeName_40() { return &___schemaTypeName_40; } inline void set_schemaTypeName_40(XmlQualifiedName_t2760654312 * value) { ___schemaTypeName_40 = value; Il2CppCodeGenWriteBarrier((&___schemaTypeName_40), value); } inline static int32_t get_offset_of_substitutionGroup_41() { return static_cast<int32_t>(offsetof(XmlSchemaElement_t427880856, ___substitutionGroup_41)); } inline XmlQualifiedName_t2760654312 * get_substitutionGroup_41() const { return ___substitutionGroup_41; } inline XmlQualifiedName_t2760654312 ** get_address_of_substitutionGroup_41() { return &___substitutionGroup_41; } inline void set_substitutionGroup_41(XmlQualifiedName_t2760654312 * value) { ___substitutionGroup_41 = value; Il2CppCodeGenWriteBarrier((&___substitutionGroup_41), value); } inline static int32_t get_offset_of_schema_42() { return static_cast<int32_t>(offsetof(XmlSchemaElement_t427880856, ___schema_42)); } inline XmlSchema_t3742557897 * get_schema_42() const { return ___schema_42; } inline XmlSchema_t3742557897 ** get_address_of_schema_42() { return &___schema_42; } inline void set_schema_42(XmlSchema_t3742557897 * value) { ___schema_42 = value; Il2CppCodeGenWriteBarrier((&___schema_42), value); } inline static int32_t get_offset_of_parentIsSchema_43() { return static_cast<int32_t>(offsetof(XmlSchemaElement_t427880856, ___parentIsSchema_43)); } inline bool get_parentIsSchema_43() const { return ___parentIsSchema_43; } inline bool* get_address_of_parentIsSchema_43() { return &___parentIsSchema_43; } inline void set_parentIsSchema_43(bool value) { ___parentIsSchema_43 = value; } inline static int32_t get_offset_of_qName_44() { return static_cast<int32_t>(offsetof(XmlSchemaElement_t427880856, ___qName_44)); } inline XmlQualifiedName_t2760654312 * get_qName_44() const { return ___qName_44; } inline XmlQualifiedName_t2760654312 ** get_address_of_qName_44() { return &___qName_44; } inline void set_qName_44(XmlQualifiedName_t2760654312 * value) { ___qName_44 = value; Il2CppCodeGenWriteBarrier((&___qName_44), value); } inline static int32_t get_offset_of_blockResolved_45() { return static_cast<int32_t>(offsetof(XmlSchemaElement_t427880856, ___blockResolved_45)); } inline int32_t get_blockResolved_45() const { return ___blockResolved_45; } inline int32_t* get_address_of_blockResolved_45() { return &___blockResolved_45; } inline void set_blockResolved_45(int32_t value) { ___blockResolved_45 = value; } inline static int32_t get_offset_of_finalResolved_46() { return static_cast<int32_t>(offsetof(XmlSchemaElement_t427880856, ___finalResolved_46)); } inline int32_t get_finalResolved_46() const { return ___finalResolved_46; } inline int32_t* get_address_of_finalResolved_46() { return &___finalResolved_46; } inline void set_finalResolved_46(int32_t value) { ___finalResolved_46 = value; } inline static int32_t get_offset_of_referencedElement_47() { return static_cast<int32_t>(offsetof(XmlSchemaElement_t427880856, ___referencedElement_47)); } inline XmlSchemaElement_t427880856 * get_referencedElement_47() const { return ___referencedElement_47; } inline XmlSchemaElement_t427880856 ** get_address_of_referencedElement_47() { return &___referencedElement_47; } inline void set_referencedElement_47(XmlSchemaElement_t427880856 * value) { ___referencedElement_47 = value; Il2CppCodeGenWriteBarrier((&___referencedElement_47), value); } inline static int32_t get_offset_of_substitutingElements_48() { return static_cast<int32_t>(offsetof(XmlSchemaElement_t427880856, ___substitutingElements_48)); } inline ArrayList_t2718874744 * get_substitutingElements_48() const { return ___substitutingElements_48; } inline ArrayList_t2718874744 ** get_address_of_substitutingElements_48() { return &___substitutingElements_48; } inline void set_substitutingElements_48(ArrayList_t2718874744 * value) { ___substitutingElements_48 = value; Il2CppCodeGenWriteBarrier((&___substitutingElements_48), value); } inline static int32_t get_offset_of_substitutionGroupElement_49() { return static_cast<int32_t>(offsetof(XmlSchemaElement_t427880856, ___substitutionGroupElement_49)); } inline XmlSchemaElement_t427880856 * get_substitutionGroupElement_49() const { return ___substitutionGroupElement_49; } inline XmlSchemaElement_t427880856 ** get_address_of_substitutionGroupElement_49() { return &___substitutionGroupElement_49; } inline void set_substitutionGroupElement_49(XmlSchemaElement_t427880856 * value) { ___substitutionGroupElement_49 = value; Il2CppCodeGenWriteBarrier((&___substitutionGroupElement_49), value); } inline static int32_t get_offset_of_actualIsAbstract_50() { return static_cast<int32_t>(offsetof(XmlSchemaElement_t427880856, ___actualIsAbstract_50)); } inline bool get_actualIsAbstract_50() const { return ___actualIsAbstract_50; } inline bool* get_address_of_actualIsAbstract_50() { return &___actualIsAbstract_50; } inline void set_actualIsAbstract_50(bool value) { ___actualIsAbstract_50 = value; } inline static int32_t get_offset_of_actualIsNillable_51() { return static_cast<int32_t>(offsetof(XmlSchemaElement_t427880856, ___actualIsNillable_51)); } inline bool get_actualIsNillable_51() const { return ___actualIsNillable_51; } inline bool* get_address_of_actualIsNillable_51() { return &___actualIsNillable_51; } inline void set_actualIsNillable_51(bool value) { ___actualIsNillable_51 = value; } inline static int32_t get_offset_of_validatedDefaultValue_52() { return static_cast<int32_t>(offsetof(XmlSchemaElement_t427880856, ___validatedDefaultValue_52)); } inline String_t* get_validatedDefaultValue_52() const { return ___validatedDefaultValue_52; } inline String_t** get_address_of_validatedDefaultValue_52() { return &___validatedDefaultValue_52; } inline void set_validatedDefaultValue_52(String_t* value) { ___validatedDefaultValue_52 = value; Il2CppCodeGenWriteBarrier((&___validatedDefaultValue_52), value); } inline static int32_t get_offset_of_validatedFixedValue_53() { return static_cast<int32_t>(offsetof(XmlSchemaElement_t427880856, ___validatedFixedValue_53)); } inline String_t* get_validatedFixedValue_53() const { return ___validatedFixedValue_53; } inline String_t** get_address_of_validatedFixedValue_53() { return &___validatedFixedValue_53; } inline void set_validatedFixedValue_53(String_t* value) { ___validatedFixedValue_53 = value; Il2CppCodeGenWriteBarrier((&___validatedFixedValue_53), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // XMLSCHEMAELEMENT_T427880856_H #ifndef XMLSCHEMAENUMERATIONFACET_T2156689038_H #define XMLSCHEMAENUMERATIONFACET_T2156689038_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Xml.Schema.XmlSchemaEnumerationFacet struct XmlSchemaEnumerationFacet_t2156689038 : public XmlSchemaFacet_t1906017689 { public: public: }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // XMLSCHEMAENUMERATIONFACET_T2156689038_H #ifndef XMLSCHEMAGROUPBASE_T3631079376_H #define XMLSCHEMAGROUPBASE_T3631079376_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Xml.Schema.XmlSchemaGroupBase struct XmlSchemaGroupBase_t3631079376 : public XmlSchemaParticle_t3828501457 { public: // System.Xml.Schema.XmlSchemaObjectCollection System.Xml.Schema.XmlSchemaGroupBase::compiledItems XmlSchemaObjectCollection_t1064819932 * ___compiledItems_27; public: inline static int32_t get_offset_of_compiledItems_27() { return static_cast<int32_t>(offsetof(XmlSchemaGroupBase_t3631079376, ___compiledItems_27)); } inline XmlSchemaObjectCollection_t1064819932 * get_compiledItems_27() const { return ___compiledItems_27; } inline XmlSchemaObjectCollection_t1064819932 ** get_address_of_compiledItems_27() { return &___compiledItems_27; } inline void set_compiledItems_27(XmlSchemaObjectCollection_t1064819932 * value) { ___compiledItems_27 = value; Il2CppCodeGenWriteBarrier((&___compiledItems_27), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // XMLSCHEMAGROUPBASE_T3631079376_H #ifndef XMLSCHEMASIMPLECONTENT_T4264369274_H #define XMLSCHEMASIMPLECONTENT_T4264369274_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Xml.Schema.XmlSchemaSimpleContent struct XmlSchemaSimpleContent_t4264369274 : public XmlSchemaContentModel_t602185179 { public: // System.Xml.Schema.XmlSchemaContent System.Xml.Schema.XmlSchemaSimpleContent::content XmlSchemaContent_t1040349258 * ___content_16; public: inline static int32_t get_offset_of_content_16() { return static_cast<int32_t>(offsetof(XmlSchemaSimpleContent_t4264369274, ___content_16)); } inline XmlSchemaContent_t1040349258 * get_content_16() const { return ___content_16; } inline XmlSchemaContent_t1040349258 ** get_address_of_content_16() { return &___content_16; } inline void set_content_16(XmlSchemaContent_t1040349258 * value) { ___content_16 = value; Il2CppCodeGenWriteBarrier((&___content_16), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // XMLSCHEMASIMPLECONTENT_T4264369274_H #ifndef XMLSCHEMASIMPLECONTENTEXTENSION_T1269327470_H #define XMLSCHEMASIMPLECONTENTEXTENSION_T1269327470_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Xml.Schema.XmlSchemaSimpleContentExtension struct XmlSchemaSimpleContentExtension_t1269327470 : public XmlSchemaContent_t1040349258 { public: // System.Xml.Schema.XmlSchemaAnyAttribute System.Xml.Schema.XmlSchemaSimpleContentExtension::any XmlSchemaAnyAttribute_t963227996 * ___any_17; // System.Xml.Schema.XmlSchemaObjectCollection System.Xml.Schema.XmlSchemaSimpleContentExtension::attributes XmlSchemaObjectCollection_t1064819932 * ___attributes_18; // System.Xml.XmlQualifiedName System.Xml.Schema.XmlSchemaSimpleContentExtension::baseTypeName XmlQualifiedName_t2760654312 * ___baseTypeName_19; public: inline static int32_t get_offset_of_any_17() { return static_cast<int32_t>(offsetof(XmlSchemaSimpleContentExtension_t1269327470, ___any_17)); } inline XmlSchemaAnyAttribute_t963227996 * get_any_17() const { return ___any_17; } inline XmlSchemaAnyAttribute_t963227996 ** get_address_of_any_17() { return &___any_17; } inline void set_any_17(XmlSchemaAnyAttribute_t963227996 * value) { ___any_17 = value; Il2CppCodeGenWriteBarrier((&___any_17), value); } inline static int32_t get_offset_of_attributes_18() { return static_cast<int32_t>(offsetof(XmlSchemaSimpleContentExtension_t1269327470, ___attributes_18)); } inline XmlSchemaObjectCollection_t1064819932 * get_attributes_18() const { return ___attributes_18; } inline XmlSchemaObjectCollection_t1064819932 ** get_address_of_attributes_18() { return &___attributes_18; } inline void set_attributes_18(XmlSchemaObjectCollection_t1064819932 * value) { ___attributes_18 = value; Il2CppCodeGenWriteBarrier((&___attributes_18), value); } inline static int32_t get_offset_of_baseTypeName_19() { return static_cast<int32_t>(offsetof(XmlSchemaSimpleContentExtension_t1269327470, ___baseTypeName_19)); } inline XmlQualifiedName_t2760654312 * get_baseTypeName_19() const { return ___baseTypeName_19; } inline XmlQualifiedName_t2760654312 ** get_address_of_baseTypeName_19() { return &___baseTypeName_19; } inline void set_baseTypeName_19(XmlQualifiedName_t2760654312 * value) { ___baseTypeName_19 = value; Il2CppCodeGenWriteBarrier((&___baseTypeName_19), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // XMLSCHEMASIMPLECONTENTEXTENSION_T1269327470_H #ifndef XMLSCHEMASIMPLECONTENTRESTRICTION_T2746076865_H #define XMLSCHEMASIMPLECONTENTRESTRICTION_T2746076865_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Xml.Schema.XmlSchemaSimpleContentRestriction struct XmlSchemaSimpleContentRestriction_t2746076865 : public XmlSchemaContent_t1040349258 { public: // System.Xml.Schema.XmlSchemaAnyAttribute System.Xml.Schema.XmlSchemaSimpleContentRestriction::any XmlSchemaAnyAttribute_t963227996 * ___any_17; // System.Xml.Schema.XmlSchemaObjectCollection System.Xml.Schema.XmlSchemaSimpleContentRestriction::attributes XmlSchemaObjectCollection_t1064819932 * ___attributes_18; // System.Xml.Schema.XmlSchemaSimpleType System.Xml.Schema.XmlSchemaSimpleContentRestriction::baseType XmlSchemaSimpleType_t2678868104 * ___baseType_19; // System.Xml.XmlQualifiedName System.Xml.Schema.XmlSchemaSimpleContentRestriction::baseTypeName XmlQualifiedName_t2760654312 * ___baseTypeName_20; // System.Xml.Schema.XmlSchemaObjectCollection System.Xml.Schema.XmlSchemaSimpleContentRestriction::facets XmlSchemaObjectCollection_t1064819932 * ___facets_21; public: inline static int32_t get_offset_of_any_17() { return static_cast<int32_t>(offsetof(XmlSchemaSimpleContentRestriction_t2746076865, ___any_17)); } inline XmlSchemaAnyAttribute_t963227996 * get_any_17() const { return ___any_17; } inline XmlSchemaAnyAttribute_t963227996 ** get_address_of_any_17() { return &___any_17; } inline void set_any_17(XmlSchemaAnyAttribute_t963227996 * value) { ___any_17 = value; Il2CppCodeGenWriteBarrier((&___any_17), value); } inline static int32_t get_offset_of_attributes_18() { return static_cast<int32_t>(offsetof(XmlSchemaSimpleContentRestriction_t2746076865, ___attributes_18)); } inline XmlSchemaObjectCollection_t1064819932 * get_attributes_18() const { return ___attributes_18; } inline XmlSchemaObjectCollection_t1064819932 ** get_address_of_attributes_18() { return &___attributes_18; } inline void set_attributes_18(XmlSchemaObjectCollection_t1064819932 * value) { ___attributes_18 = value; Il2CppCodeGenWriteBarrier((&___attributes_18), value); } inline static int32_t get_offset_of_baseType_19() { return static_cast<int32_t>(offsetof(XmlSchemaSimpleContentRestriction_t2746076865, ___baseType_19)); } inline XmlSchemaSimpleType_t2678868104 * get_baseType_19() const { return ___baseType_19; } inline XmlSchemaSimpleType_t2678868104 ** get_address_of_baseType_19() { return &___baseType_19; } inline void set_baseType_19(XmlSchemaSimpleType_t2678868104 * value) { ___baseType_19 = value; Il2CppCodeGenWriteBarrier((&___baseType_19), value); } inline static int32_t get_offset_of_baseTypeName_20() { return static_cast<int32_t>(offsetof(XmlSchemaSimpleContentRestriction_t2746076865, ___baseTypeName_20)); } inline XmlQualifiedName_t2760654312 * get_baseTypeName_20() const { return ___baseTypeName_20; } inline XmlQualifiedName_t2760654312 ** get_address_of_baseTypeName_20() { return &___baseTypeName_20; } inline void set_baseTypeName_20(XmlQualifiedName_t2760654312 * value) { ___baseTypeName_20 = value; Il2CppCodeGenWriteBarrier((&___baseTypeName_20), value); } inline static int32_t get_offset_of_facets_21() { return static_cast<int32_t>(offsetof(XmlSchemaSimpleContentRestriction_t2746076865, ___facets_21)); } inline XmlSchemaObjectCollection_t1064819932 * get_facets_21() const { return ___facets_21; } inline XmlSchemaObjectCollection_t1064819932 ** get_address_of_facets_21() { return &___facets_21; } inline void set_facets_21(XmlSchemaObjectCollection_t1064819932 * value) { ___facets_21 = value; Il2CppCodeGenWriteBarrier((&___facets_21), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // XMLSCHEMASIMPLECONTENTRESTRICTION_T2746076865_H #ifndef XMLSCHEMASIMPLETYPE_T2678868104_H #define XMLSCHEMASIMPLETYPE_T2678868104_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Xml.Schema.XmlSchemaSimpleType struct XmlSchemaSimpleType_t2678868104 : public XmlSchemaType_t2033747345 { public: // System.Xml.Schema.XmlSchemaSimpleTypeContent System.Xml.Schema.XmlSchemaSimpleType::content XmlSchemaSimpleTypeContent_t599285223 * ___content_29; // System.Boolean System.Xml.Schema.XmlSchemaSimpleType::islocal bool ___islocal_30; // System.Boolean System.Xml.Schema.XmlSchemaSimpleType::recursed bool ___recursed_31; // System.Xml.Schema.XmlSchemaDerivationMethod System.Xml.Schema.XmlSchemaSimpleType::variety int32_t ___variety_32; public: inline static int32_t get_offset_of_content_29() { return static_cast<int32_t>(offsetof(XmlSchemaSimpleType_t2678868104, ___content_29)); } inline XmlSchemaSimpleTypeContent_t599285223 * get_content_29() const { return ___content_29; } inline XmlSchemaSimpleTypeContent_t599285223 ** get_address_of_content_29() { return &___content_29; } inline void set_content_29(XmlSchemaSimpleTypeContent_t599285223 * value) { ___content_29 = value; Il2CppCodeGenWriteBarrier((&___content_29), value); } inline static int32_t get_offset_of_islocal_30() { return static_cast<int32_t>(offsetof(XmlSchemaSimpleType_t2678868104, ___islocal_30)); } inline bool get_islocal_30() const { return ___islocal_30; } inline bool* get_address_of_islocal_30() { return &___islocal_30; } inline void set_islocal_30(bool value) { ___islocal_30 = value; } inline static int32_t get_offset_of_recursed_31() { return static_cast<int32_t>(offsetof(XmlSchemaSimpleType_t2678868104, ___recursed_31)); } inline bool get_recursed_31() const { return ___recursed_31; } inline bool* get_address_of_recursed_31() { return &___recursed_31; } inline void set_recursed_31(bool value) { ___recursed_31 = value; } inline static int32_t get_offset_of_variety_32() { return static_cast<int32_t>(offsetof(XmlSchemaSimpleType_t2678868104, ___variety_32)); } inline int32_t get_variety_32() const { return ___variety_32; } inline int32_t* get_address_of_variety_32() { return &___variety_32; } inline void set_variety_32(int32_t value) { ___variety_32 = value; } }; struct XmlSchemaSimpleType_t2678868104_StaticFields { public: // System.Xml.Schema.XmlSchemaSimpleType System.Xml.Schema.XmlSchemaSimpleType::schemaLocationType XmlSchemaSimpleType_t2678868104 * ___schemaLocationType_28; // System.Xml.Schema.XmlSchemaSimpleType System.Xml.Schema.XmlSchemaSimpleType::XsAnySimpleType XmlSchemaSimpleType_t2678868104 * ___XsAnySimpleType_33; // System.Xml.Schema.XmlSchemaSimpleType System.Xml.Schema.XmlSchemaSimpleType::XsString XmlSchemaSimpleType_t2678868104 * ___XsString_34; // System.Xml.Schema.XmlSchemaSimpleType System.Xml.Schema.XmlSchemaSimpleType::XsBoolean XmlSchemaSimpleType_t2678868104 * ___XsBoolean_35; // System.Xml.Schema.XmlSchemaSimpleType System.Xml.Schema.XmlSchemaSimpleType::XsDecimal XmlSchemaSimpleType_t2678868104 * ___XsDecimal_36; // System.Xml.Schema.XmlSchemaSimpleType System.Xml.Schema.XmlSchemaSimpleType::XsFloat XmlSchemaSimpleType_t2678868104 * ___XsFloat_37; // System.Xml.Schema.XmlSchemaSimpleType System.Xml.Schema.XmlSchemaSimpleType::XsDouble XmlSchemaSimpleType_t2678868104 * ___XsDouble_38; // System.Xml.Schema.XmlSchemaSimpleType System.Xml.Schema.XmlSchemaSimpleType::XsDuration XmlSchemaSimpleType_t2678868104 * ___XsDuration_39; // System.Xml.Schema.XmlSchemaSimpleType System.Xml.Schema.XmlSchemaSimpleType::XsDateTime XmlSchemaSimpleType_t2678868104 * ___XsDateTime_40; // System.Xml.Schema.XmlSchemaSimpleType System.Xml.Schema.XmlSchemaSimpleType::XsTime XmlSchemaSimpleType_t2678868104 * ___XsTime_41; // System.Xml.Schema.XmlSchemaSimpleType System.Xml.Schema.XmlSchemaSimpleType::XsDate XmlSchemaSimpleType_t2678868104 * ___XsDate_42; // System.Xml.Schema.XmlSchemaSimpleType System.Xml.Schema.XmlSchemaSimpleType::XsGYearMonth XmlSchemaSimpleType_t2678868104 * ___XsGYearMonth_43; // System.Xml.Schema.XmlSchemaSimpleType System.Xml.Schema.XmlSchemaSimpleType::XsGYear XmlSchemaSimpleType_t2678868104 * ___XsGYear_44; // System.Xml.Schema.XmlSchemaSimpleType System.Xml.Schema.XmlSchemaSimpleType::XsGMonthDay XmlSchemaSimpleType_t2678868104 * ___XsGMonthDay_45; // System.Xml.Schema.XmlSchemaSimpleType System.Xml.Schema.XmlSchemaSimpleType::XsGDay XmlSchemaSimpleType_t2678868104 * ___XsGDay_46; // System.Xml.Schema.XmlSchemaSimpleType System.Xml.Schema.XmlSchemaSimpleType::XsGMonth XmlSchemaSimpleType_t2678868104 * ___XsGMonth_47; // System.Xml.Schema.XmlSchemaSimpleType System.Xml.Schema.XmlSchemaSimpleType::XsHexBinary XmlSchemaSimpleType_t2678868104 * ___XsHexBinary_48; // System.Xml.Schema.XmlSchemaSimpleType System.Xml.Schema.XmlSchemaSimpleType::XsBase64Binary XmlSchemaSimpleType_t2678868104 * ___XsBase64Binary_49; // System.Xml.Schema.XmlSchemaSimpleType System.Xml.Schema.XmlSchemaSimpleType::XsAnyUri XmlSchemaSimpleType_t2678868104 * ___XsAnyUri_50; // System.Xml.Schema.XmlSchemaSimpleType System.Xml.Schema.XmlSchemaSimpleType::XsQName XmlSchemaSimpleType_t2678868104 * ___XsQName_51; // System.Xml.Schema.XmlSchemaSimpleType System.Xml.Schema.XmlSchemaSimpleType::XsNotation XmlSchemaSimpleType_t2678868104 * ___XsNotation_52; // System.Xml.Schema.XmlSchemaSimpleType System.Xml.Schema.XmlSchemaSimpleType::XsNormalizedString XmlSchemaSimpleType_t2678868104 * ___XsNormalizedString_53; // System.Xml.Schema.XmlSchemaSimpleType System.Xml.Schema.XmlSchemaSimpleType::XsToken XmlSchemaSimpleType_t2678868104 * ___XsToken_54; // System.Xml.Schema.XmlSchemaSimpleType System.Xml.Schema.XmlSchemaSimpleType::XsLanguage XmlSchemaSimpleType_t2678868104 * ___XsLanguage_55; // System.Xml.Schema.XmlSchemaSimpleType System.Xml.Schema.XmlSchemaSimpleType::XsNMToken XmlSchemaSimpleType_t2678868104 * ___XsNMToken_56; // System.Xml.Schema.XmlSchemaSimpleType System.Xml.Schema.XmlSchemaSimpleType::XsNMTokens XmlSchemaSimpleType_t2678868104 * ___XsNMTokens_57; // System.Xml.Schema.XmlSchemaSimpleType System.Xml.Schema.XmlSchemaSimpleType::XsName XmlSchemaSimpleType_t2678868104 * ___XsName_58; // System.Xml.Schema.XmlSchemaSimpleType System.Xml.Schema.XmlSchemaSimpleType::XsNCName XmlSchemaSimpleType_t2678868104 * ___XsNCName_59; // System.Xml.Schema.XmlSchemaSimpleType System.Xml.Schema.XmlSchemaSimpleType::XsID XmlSchemaSimpleType_t2678868104 * ___XsID_60; // System.Xml.Schema.XmlSchemaSimpleType System.Xml.Schema.XmlSchemaSimpleType::XsIDRef XmlSchemaSimpleType_t2678868104 * ___XsIDRef_61; // System.Xml.Schema.XmlSchemaSimpleType System.Xml.Schema.XmlSchemaSimpleType::XsIDRefs XmlSchemaSimpleType_t2678868104 * ___XsIDRefs_62; // System.Xml.Schema.XmlSchemaSimpleType System.Xml.Schema.XmlSchemaSimpleType::XsEntity XmlSchemaSimpleType_t2678868104 * ___XsEntity_63; // System.Xml.Schema.XmlSchemaSimpleType System.Xml.Schema.XmlSchemaSimpleType::XsEntities XmlSchemaSimpleType_t2678868104 * ___XsEntities_64; // System.Xml.Schema.XmlSchemaSimpleType System.Xml.Schema.XmlSchemaSimpleType::XsInteger XmlSchemaSimpleType_t2678868104 * ___XsInteger_65; // System.Xml.Schema.XmlSchemaSimpleType System.Xml.Schema.XmlSchemaSimpleType::XsNonPositiveInteger XmlSchemaSimpleType_t2678868104 * ___XsNonPositiveInteger_66; // System.Xml.Schema.XmlSchemaSimpleType System.Xml.Schema.XmlSchemaSimpleType::XsNegativeInteger XmlSchemaSimpleType_t2678868104 * ___XsNegativeInteger_67; // System.Xml.Schema.XmlSchemaSimpleType System.Xml.Schema.XmlSchemaSimpleType::XsLong XmlSchemaSimpleType_t2678868104 * ___XsLong_68; // System.Xml.Schema.XmlSchemaSimpleType System.Xml.Schema.XmlSchemaSimpleType::XsInt XmlSchemaSimpleType_t2678868104 * ___XsInt_69; // System.Xml.Schema.XmlSchemaSimpleType System.Xml.Schema.XmlSchemaSimpleType::XsShort XmlSchemaSimpleType_t2678868104 * ___XsShort_70; // System.Xml.Schema.XmlSchemaSimpleType System.Xml.Schema.XmlSchemaSimpleType::XsByte XmlSchemaSimpleType_t2678868104 * ___XsByte_71; // System.Xml.Schema.XmlSchemaSimpleType System.Xml.Schema.XmlSchemaSimpleType::XsNonNegativeInteger XmlSchemaSimpleType_t2678868104 * ___XsNonNegativeInteger_72; // System.Xml.Schema.XmlSchemaSimpleType System.Xml.Schema.XmlSchemaSimpleType::XsUnsignedLong XmlSchemaSimpleType_t2678868104 * ___XsUnsignedLong_73; // System.Xml.Schema.XmlSchemaSimpleType System.Xml.Schema.XmlSchemaSimpleType::XsUnsignedInt XmlSchemaSimpleType_t2678868104 * ___XsUnsignedInt_74; // System.Xml.Schema.XmlSchemaSimpleType System.Xml.Schema.XmlSchemaSimpleType::XsUnsignedShort XmlSchemaSimpleType_t2678868104 * ___XsUnsignedShort_75; // System.Xml.Schema.XmlSchemaSimpleType System.Xml.Schema.XmlSchemaSimpleType::XsUnsignedByte XmlSchemaSimpleType_t2678868104 * ___XsUnsignedByte_76; // System.Xml.Schema.XmlSchemaSimpleType System.Xml.Schema.XmlSchemaSimpleType::XsPositiveInteger XmlSchemaSimpleType_t2678868104 * ___XsPositiveInteger_77; // System.Xml.Schema.XmlSchemaSimpleType System.Xml.Schema.XmlSchemaSimpleType::XdtUntypedAtomic XmlSchemaSimpleType_t2678868104 * ___XdtUntypedAtomic_78; // System.Xml.Schema.XmlSchemaSimpleType System.Xml.Schema.XmlSchemaSimpleType::XdtAnyAtomicType XmlSchemaSimpleType_t2678868104 * ___XdtAnyAtomicType_79; // System.Xml.Schema.XmlSchemaSimpleType System.Xml.Schema.XmlSchemaSimpleType::XdtYearMonthDuration XmlSchemaSimpleType_t2678868104 * ___XdtYearMonthDuration_80; // System.Xml.Schema.XmlSchemaSimpleType System.Xml.Schema.XmlSchemaSimpleType::XdtDayTimeDuration XmlSchemaSimpleType_t2678868104 * ___XdtDayTimeDuration_81; public: inline static int32_t get_offset_of_schemaLocationType_28() { return static_cast<int32_t>(offsetof(XmlSchemaSimpleType_t2678868104_StaticFields, ___schemaLocationType_28)); } inline XmlSchemaSimpleType_t2678868104 * get_schemaLocationType_28() const { return ___schemaLocationType_28; } inline XmlSchemaSimpleType_t2678868104 ** get_address_of_schemaLocationType_28() { return &___schemaLocationType_28; } inline void set_schemaLocationType_28(XmlSchemaSimpleType_t2678868104 * value) { ___schemaLocationType_28 = value; Il2CppCodeGenWriteBarrier((&___schemaLocationType_28), value); } inline static int32_t get_offset_of_XsAnySimpleType_33() { return static_cast<int32_t>(offsetof(XmlSchemaSimpleType_t2678868104_StaticFields, ___XsAnySimpleType_33)); } inline XmlSchemaSimpleType_t2678868104 * get_XsAnySimpleType_33() const { return ___XsAnySimpleType_33; } inline XmlSchemaSimpleType_t2678868104 ** get_address_of_XsAnySimpleType_33() { return &___XsAnySimpleType_33; } inline void set_XsAnySimpleType_33(XmlSchemaSimpleType_t2678868104 * value) { ___XsAnySimpleType_33 = value; Il2CppCodeGenWriteBarrier((&___XsAnySimpleType_33), value); } inline static int32_t get_offset_of_XsString_34() { return static_cast<int32_t>(offsetof(XmlSchemaSimpleType_t2678868104_StaticFields, ___XsString_34)); } inline XmlSchemaSimpleType_t2678868104 * get_XsString_34() const { return ___XsString_34; } inline XmlSchemaSimpleType_t2678868104 ** get_address_of_XsString_34() { return &___XsString_34; } inline void set_XsString_34(XmlSchemaSimpleType_t2678868104 * value) { ___XsString_34 = value; Il2CppCodeGenWriteBarrier((&___XsString_34), value); } inline static int32_t get_offset_of_XsBoolean_35() { return static_cast<int32_t>(offsetof(XmlSchemaSimpleType_t2678868104_StaticFields, ___XsBoolean_35)); } inline XmlSchemaSimpleType_t2678868104 * get_XsBoolean_35() const { return ___XsBoolean_35; } inline XmlSchemaSimpleType_t2678868104 ** get_address_of_XsBoolean_35() { return &___XsBoolean_35; } inline void set_XsBoolean_35(XmlSchemaSimpleType_t2678868104 * value) { ___XsBoolean_35 = value; Il2CppCodeGenWriteBarrier((&___XsBoolean_35), value); } inline static int32_t get_offset_of_XsDecimal_36() { return static_cast<int32_t>(offsetof(XmlSchemaSimpleType_t2678868104_StaticFields, ___XsDecimal_36)); } inline XmlSchemaSimpleType_t2678868104 * get_XsDecimal_36() const { return ___XsDecimal_36; } inline XmlSchemaSimpleType_t2678868104 ** get_address_of_XsDecimal_36() { return &___XsDecimal_36; } inline void set_XsDecimal_36(XmlSchemaSimpleType_t2678868104 * value) { ___XsDecimal_36 = value; Il2CppCodeGenWriteBarrier((&___XsDecimal_36), value); } inline static int32_t get_offset_of_XsFloat_37() { return static_cast<int32_t>(offsetof(XmlSchemaSimpleType_t2678868104_StaticFields, ___XsFloat_37)); } inline XmlSchemaSimpleType_t2678868104 * get_XsFloat_37() const { return ___XsFloat_37; } inline XmlSchemaSimpleType_t2678868104 ** get_address_of_XsFloat_37() { return &___XsFloat_37; } inline void set_XsFloat_37(XmlSchemaSimpleType_t2678868104 * value) { ___XsFloat_37 = value; Il2CppCodeGenWriteBarrier((&___XsFloat_37), value); } inline static int32_t get_offset_of_XsDouble_38() { return static_cast<int32_t>(offsetof(XmlSchemaSimpleType_t2678868104_StaticFields, ___XsDouble_38)); } inline XmlSchemaSimpleType_t2678868104 * get_XsDouble_38() const { return ___XsDouble_38; } inline XmlSchemaSimpleType_t2678868104 ** get_address_of_XsDouble_38() { return &___XsDouble_38; } inline void set_XsDouble_38(XmlSchemaSimpleType_t2678868104 * value) { ___XsDouble_38 = value; Il2CppCodeGenWriteBarrier((&___XsDouble_38), value); } inline static int32_t get_offset_of_XsDuration_39() { return static_cast<int32_t>(offsetof(XmlSchemaSimpleType_t2678868104_StaticFields, ___XsDuration_39)); } inline XmlSchemaSimpleType_t2678868104 * get_XsDuration_39() const { return ___XsDuration_39; } inline XmlSchemaSimpleType_t2678868104 ** get_address_of_XsDuration_39() { return &___XsDuration_39; } inline void set_XsDuration_39(XmlSchemaSimpleType_t2678868104 * value) { ___XsDuration_39 = value; Il2CppCodeGenWriteBarrier((&___XsDuration_39), value); } inline static int32_t get_offset_of_XsDateTime_40() { return static_cast<int32_t>(offsetof(XmlSchemaSimpleType_t2678868104_StaticFields, ___XsDateTime_40)); } inline XmlSchemaSimpleType_t2678868104 * get_XsDateTime_40() const { return ___XsDateTime_40; } inline XmlSchemaSimpleType_t2678868104 ** get_address_of_XsDateTime_40() { return &___XsDateTime_40; } inline void set_XsDateTime_40(XmlSchemaSimpleType_t2678868104 * value) { ___XsDateTime_40 = value; Il2CppCodeGenWriteBarrier((&___XsDateTime_40), value); } inline static int32_t get_offset_of_XsTime_41() { return static_cast<int32_t>(offsetof(XmlSchemaSimpleType_t2678868104_StaticFields, ___XsTime_41)); } inline XmlSchemaSimpleType_t2678868104 * get_XsTime_41() const { return ___XsTime_41; } inline XmlSchemaSimpleType_t2678868104 ** get_address_of_XsTime_41() { return &___XsTime_41; } inline void set_XsTime_41(XmlSchemaSimpleType_t2678868104 * value) { ___XsTime_41 = value; Il2CppCodeGenWriteBarrier((&___XsTime_41), value); } inline static int32_t get_offset_of_XsDate_42() { return static_cast<int32_t>(offsetof(XmlSchemaSimpleType_t2678868104_StaticFields, ___XsDate_42)); } inline XmlSchemaSimpleType_t2678868104 * get_XsDate_42() const { return ___XsDate_42; } inline XmlSchemaSimpleType_t2678868104 ** get_address_of_XsDate_42() { return &___XsDate_42; } inline void set_XsDate_42(XmlSchemaSimpleType_t2678868104 * value) { ___XsDate_42 = value; Il2CppCodeGenWriteBarrier((&___XsDate_42), value); } inline static int32_t get_offset_of_XsGYearMonth_43() { return static_cast<int32_t>(offsetof(XmlSchemaSimpleType_t2678868104_StaticFields, ___XsGYearMonth_43)); } inline XmlSchemaSimpleType_t2678868104 * get_XsGYearMonth_43() const { return ___XsGYearMonth_43; } inline XmlSchemaSimpleType_t2678868104 ** get_address_of_XsGYearMonth_43() { return &___XsGYearMonth_43; } inline void set_XsGYearMonth_43(XmlSchemaSimpleType_t2678868104 * value) { ___XsGYearMonth_43 = value; Il2CppCodeGenWriteBarrier((&___XsGYearMonth_43), value); } inline static int32_t get_offset_of_XsGYear_44() { return static_cast<int32_t>(offsetof(XmlSchemaSimpleType_t2678868104_StaticFields, ___XsGYear_44)); } inline XmlSchemaSimpleType_t2678868104 * get_XsGYear_44() const { return ___XsGYear_44; } inline XmlSchemaSimpleType_t2678868104 ** get_address_of_XsGYear_44() { return &___XsGYear_44; } inline void set_XsGYear_44(XmlSchemaSimpleType_t2678868104 * value) { ___XsGYear_44 = value; Il2CppCodeGenWriteBarrier((&___XsGYear_44), value); } inline static int32_t get_offset_of_XsGMonthDay_45() { return static_cast<int32_t>(offsetof(XmlSchemaSimpleType_t2678868104_StaticFields, ___XsGMonthDay_45)); } inline XmlSchemaSimpleType_t2678868104 * get_XsGMonthDay_45() const { return ___XsGMonthDay_45; } inline XmlSchemaSimpleType_t2678868104 ** get_address_of_XsGMonthDay_45() { return &___XsGMonthDay_45; } inline void set_XsGMonthDay_45(XmlSchemaSimpleType_t2678868104 * value) { ___XsGMonthDay_45 = value; Il2CppCodeGenWriteBarrier((&___XsGMonthDay_45), value); } inline static int32_t get_offset_of_XsGDay_46() { return static_cast<int32_t>(offsetof(XmlSchemaSimpleType_t2678868104_StaticFields, ___XsGDay_46)); } inline XmlSchemaSimpleType_t2678868104 * get_XsGDay_46() const { return ___XsGDay_46; } inline XmlSchemaSimpleType_t2678868104 ** get_address_of_XsGDay_46() { return &___XsGDay_46; } inline void set_XsGDay_46(XmlSchemaSimpleType_t2678868104 * value) { ___XsGDay_46 = value; Il2CppCodeGenWriteBarrier((&___XsGDay_46), value); } inline static int32_t get_offset_of_XsGMonth_47() { return static_cast<int32_t>(offsetof(XmlSchemaSimpleType_t2678868104_StaticFields, ___XsGMonth_47)); } inline XmlSchemaSimpleType_t2678868104 * get_XsGMonth_47() const { return ___XsGMonth_47; } inline XmlSchemaSimpleType_t2678868104 ** get_address_of_XsGMonth_47() { return &___XsGMonth_47; } inline void set_XsGMonth_47(XmlSchemaSimpleType_t2678868104 * value) { ___XsGMonth_47 = value; Il2CppCodeGenWriteBarrier((&___XsGMonth_47), value); } inline static int32_t get_offset_of_XsHexBinary_48() { return static_cast<int32_t>(offsetof(XmlSchemaSimpleType_t2678868104_StaticFields, ___XsHexBinary_48)); } inline XmlSchemaSimpleType_t2678868104 * get_XsHexBinary_48() const { return ___XsHexBinary_48; } inline XmlSchemaSimpleType_t2678868104 ** get_address_of_XsHexBinary_48() { return &___XsHexBinary_48; } inline void set_XsHexBinary_48(XmlSchemaSimpleType_t2678868104 * value) { ___XsHexBinary_48 = value; Il2CppCodeGenWriteBarrier((&___XsHexBinary_48), value); } inline static int32_t get_offset_of_XsBase64Binary_49() { return static_cast<int32_t>(offsetof(XmlSchemaSimpleType_t2678868104_StaticFields, ___XsBase64Binary_49)); } inline XmlSchemaSimpleType_t2678868104 * get_XsBase64Binary_49() const { return ___XsBase64Binary_49; } inline XmlSchemaSimpleType_t2678868104 ** get_address_of_XsBase64Binary_49() { return &___XsBase64Binary_49; } inline void set_XsBase64Binary_49(XmlSchemaSimpleType_t2678868104 * value) { ___XsBase64Binary_49 = value; Il2CppCodeGenWriteBarrier((&___XsBase64Binary_49), value); } inline static int32_t get_offset_of_XsAnyUri_50() { return static_cast<int32_t>(offsetof(XmlSchemaSimpleType_t2678868104_StaticFields, ___XsAnyUri_50)); } inline XmlSchemaSimpleType_t2678868104 * get_XsAnyUri_50() const { return ___XsAnyUri_50; } inline XmlSchemaSimpleType_t2678868104 ** get_address_of_XsAnyUri_50() { return &___XsAnyUri_50; } inline void set_XsAnyUri_50(XmlSchemaSimpleType_t2678868104 * value) { ___XsAnyUri_50 = value; Il2CppCodeGenWriteBarrier((&___XsAnyUri_50), value); } inline static int32_t get_offset_of_XsQName_51() { return static_cast<int32_t>(offsetof(XmlSchemaSimpleType_t2678868104_StaticFields, ___XsQName_51)); } inline XmlSchemaSimpleType_t2678868104 * get_XsQName_51() const { return ___XsQName_51; } inline XmlSchemaSimpleType_t2678868104 ** get_address_of_XsQName_51() { return &___XsQName_51; } inline void set_XsQName_51(XmlSchemaSimpleType_t2678868104 * value) { ___XsQName_51 = value; Il2CppCodeGenWriteBarrier((&___XsQName_51), value); } inline static int32_t get_offset_of_XsNotation_52() { return static_cast<int32_t>(offsetof(XmlSchemaSimpleType_t2678868104_StaticFields, ___XsNotation_52)); } inline XmlSchemaSimpleType_t2678868104 * get_XsNotation_52() const { return ___XsNotation_52; } inline XmlSchemaSimpleType_t2678868104 ** get_address_of_XsNotation_52() { return &___XsNotation_52; } inline void set_XsNotation_52(XmlSchemaSimpleType_t2678868104 * value) { ___XsNotation_52 = value; Il2CppCodeGenWriteBarrier((&___XsNotation_52), value); } inline static int32_t get_offset_of_XsNormalizedString_53() { return static_cast<int32_t>(offsetof(XmlSchemaSimpleType_t2678868104_StaticFields, ___XsNormalizedString_53)); } inline XmlSchemaSimpleType_t2678868104 * get_XsNormalizedString_53() const { return ___XsNormalizedString_53; } inline XmlSchemaSimpleType_t2678868104 ** get_address_of_XsNormalizedString_53() { return &___XsNormalizedString_53; } inline void set_XsNormalizedString_53(XmlSchemaSimpleType_t2678868104 * value) { ___XsNormalizedString_53 = value; Il2CppCodeGenWriteBarrier((&___XsNormalizedString_53), value); } inline static int32_t get_offset_of_XsToken_54() { return static_cast<int32_t>(offsetof(XmlSchemaSimpleType_t2678868104_StaticFields, ___XsToken_54)); } inline XmlSchemaSimpleType_t2678868104 * get_XsToken_54() const { return ___XsToken_54; } inline XmlSchemaSimpleType_t2678868104 ** get_address_of_XsToken_54() { return &___XsToken_54; } inline void set_XsToken_54(XmlSchemaSimpleType_t2678868104 * value) { ___XsToken_54 = value; Il2CppCodeGenWriteBarrier((&___XsToken_54), value); } inline static int32_t get_offset_of_XsLanguage_55() { return static_cast<int32_t>(offsetof(XmlSchemaSimpleType_t2678868104_StaticFields, ___XsLanguage_55)); } inline XmlSchemaSimpleType_t2678868104 * get_XsLanguage_55() const { return ___XsLanguage_55; } inline XmlSchemaSimpleType_t2678868104 ** get_address_of_XsLanguage_55() { return &___XsLanguage_55; } inline void set_XsLanguage_55(XmlSchemaSimpleType_t2678868104 * value) { ___XsLanguage_55 = value; Il2CppCodeGenWriteBarrier((&___XsLanguage_55), value); } inline static int32_t get_offset_of_XsNMToken_56() { return static_cast<int32_t>(offsetof(XmlSchemaSimpleType_t2678868104_StaticFields, ___XsNMToken_56)); } inline XmlSchemaSimpleType_t2678868104 * get_XsNMToken_56() const { return ___XsNMToken_56; } inline XmlSchemaSimpleType_t2678868104 ** get_address_of_XsNMToken_56() { return &___XsNMToken_56; } inline void set_XsNMToken_56(XmlSchemaSimpleType_t2678868104 * value) { ___XsNMToken_56 = value; Il2CppCodeGenWriteBarrier((&___XsNMToken_56), value); } inline static int32_t get_offset_of_XsNMTokens_57() { return static_cast<int32_t>(offsetof(XmlSchemaSimpleType_t2678868104_StaticFields, ___XsNMTokens_57)); } inline XmlSchemaSimpleType_t2678868104 * get_XsNMTokens_57() const { return ___XsNMTokens_57; } inline XmlSchemaSimpleType_t2678868104 ** get_address_of_XsNMTokens_57() { return &___XsNMTokens_57; } inline void set_XsNMTokens_57(XmlSchemaSimpleType_t2678868104 * value) { ___XsNMTokens_57 = value; Il2CppCodeGenWriteBarrier((&___XsNMTokens_57), value); } inline static int32_t get_offset_of_XsName_58() { return static_cast<int32_t>(offsetof(XmlSchemaSimpleType_t2678868104_StaticFields, ___XsName_58)); } inline XmlSchemaSimpleType_t2678868104 * get_XsName_58() const { return ___XsName_58; } inline XmlSchemaSimpleType_t2678868104 ** get_address_of_XsName_58() { return &___XsName_58; } inline void set_XsName_58(XmlSchemaSimpleType_t2678868104 * value) { ___XsName_58 = value; Il2CppCodeGenWriteBarrier((&___XsName_58), value); } inline static int32_t get_offset_of_XsNCName_59() { return static_cast<int32_t>(offsetof(XmlSchemaSimpleType_t2678868104_StaticFields, ___XsNCName_59)); } inline XmlSchemaSimpleType_t2678868104 * get_XsNCName_59() const { return ___XsNCName_59; } inline XmlSchemaSimpleType_t2678868104 ** get_address_of_XsNCName_59() { return &___XsNCName_59; } inline void set_XsNCName_59(XmlSchemaSimpleType_t2678868104 * value) { ___XsNCName_59 = value; Il2CppCodeGenWriteBarrier((&___XsNCName_59), value); } inline static int32_t get_offset_of_XsID_60() { return static_cast<int32_t>(offsetof(XmlSchemaSimpleType_t2678868104_StaticFields, ___XsID_60)); } inline XmlSchemaSimpleType_t2678868104 * get_XsID_60() const { return ___XsID_60; } inline XmlSchemaSimpleType_t2678868104 ** get_address_of_XsID_60() { return &___XsID_60; } inline void set_XsID_60(XmlSchemaSimpleType_t2678868104 * value) { ___XsID_60 = value; Il2CppCodeGenWriteBarrier((&___XsID_60), value); } inline static int32_t get_offset_of_XsIDRef_61() { return static_cast<int32_t>(offsetof(XmlSchemaSimpleType_t2678868104_StaticFields, ___XsIDRef_61)); } inline XmlSchemaSimpleType_t2678868104 * get_XsIDRef_61() const { return ___XsIDRef_61; } inline XmlSchemaSimpleType_t2678868104 ** get_address_of_XsIDRef_61() { return &___XsIDRef_61; } inline void set_XsIDRef_61(XmlSchemaSimpleType_t2678868104 * value) { ___XsIDRef_61 = value; Il2CppCodeGenWriteBarrier((&___XsIDRef_61), value); } inline static int32_t get_offset_of_XsIDRefs_62() { return static_cast<int32_t>(offsetof(XmlSchemaSimpleType_t2678868104_StaticFields, ___XsIDRefs_62)); } inline XmlSchemaSimpleType_t2678868104 * get_XsIDRefs_62() const { return ___XsIDRefs_62; } inline XmlSchemaSimpleType_t2678868104 ** get_address_of_XsIDRefs_62() { return &___XsIDRefs_62; } inline void set_XsIDRefs_62(XmlSchemaSimpleType_t2678868104 * value) { ___XsIDRefs_62 = value; Il2CppCodeGenWriteBarrier((&___XsIDRefs_62), value); } inline static int32_t get_offset_of_XsEntity_63() { return static_cast<int32_t>(offsetof(XmlSchemaSimpleType_t2678868104_StaticFields, ___XsEntity_63)); } inline XmlSchemaSimpleType_t2678868104 * get_XsEntity_63() const { return ___XsEntity_63; } inline XmlSchemaSimpleType_t2678868104 ** get_address_of_XsEntity_63() { return &___XsEntity_63; } inline void set_XsEntity_63(XmlSchemaSimpleType_t2678868104 * value) { ___XsEntity_63 = value; Il2CppCodeGenWriteBarrier((&___XsEntity_63), value); } inline static int32_t get_offset_of_XsEntities_64() { return static_cast<int32_t>(offsetof(XmlSchemaSimpleType_t2678868104_StaticFields, ___XsEntities_64)); } inline XmlSchemaSimpleType_t2678868104 * get_XsEntities_64() const { return ___XsEntities_64; } inline XmlSchemaSimpleType_t2678868104 ** get_address_of_XsEntities_64() { return &___XsEntities_64; } inline void set_XsEntities_64(XmlSchemaSimpleType_t2678868104 * value) { ___XsEntities_64 = value; Il2CppCodeGenWriteBarrier((&___XsEntities_64), value); } inline static int32_t get_offset_of_XsInteger_65() { return static_cast<int32_t>(offsetof(XmlSchemaSimpleType_t2678868104_StaticFields, ___XsInteger_65)); } inline XmlSchemaSimpleType_t2678868104 * get_XsInteger_65() const { return ___XsInteger_65; } inline XmlSchemaSimpleType_t2678868104 ** get_address_of_XsInteger_65() { return &___XsInteger_65; } inline void set_XsInteger_65(XmlSchemaSimpleType_t2678868104 * value) { ___XsInteger_65 = value; Il2CppCodeGenWriteBarrier((&___XsInteger_65), value); } inline static int32_t get_offset_of_XsNonPositiveInteger_66() { return static_cast<int32_t>(offsetof(XmlSchemaSimpleType_t2678868104_StaticFields, ___XsNonPositiveInteger_66)); } inline XmlSchemaSimpleType_t2678868104 * get_XsNonPositiveInteger_66() const { return ___XsNonPositiveInteger_66; } inline XmlSchemaSimpleType_t2678868104 ** get_address_of_XsNonPositiveInteger_66() { return &___XsNonPositiveInteger_66; } inline void set_XsNonPositiveInteger_66(XmlSchemaSimpleType_t2678868104 * value) { ___XsNonPositiveInteger_66 = value; Il2CppCodeGenWriteBarrier((&___XsNonPositiveInteger_66), value); } inline static int32_t get_offset_of_XsNegativeInteger_67() { return static_cast<int32_t>(offsetof(XmlSchemaSimpleType_t2678868104_StaticFields, ___XsNegativeInteger_67)); } inline XmlSchemaSimpleType_t2678868104 * get_XsNegativeInteger_67() const { return ___XsNegativeInteger_67; } inline XmlSchemaSimpleType_t2678868104 ** get_address_of_XsNegativeInteger_67() { return &___XsNegativeInteger_67; } inline void set_XsNegativeInteger_67(XmlSchemaSimpleType_t2678868104 * value) { ___XsNegativeInteger_67 = value; Il2CppCodeGenWriteBarrier((&___XsNegativeInteger_67), value); } inline static int32_t get_offset_of_XsLong_68() { return static_cast<int32_t>(offsetof(XmlSchemaSimpleType_t2678868104_StaticFields, ___XsLong_68)); } inline XmlSchemaSimpleType_t2678868104 * get_XsLong_68() const { return ___XsLong_68; } inline XmlSchemaSimpleType_t2678868104 ** get_address_of_XsLong_68() { return &___XsLong_68; } inline void set_XsLong_68(XmlSchemaSimpleType_t2678868104 * value) { ___XsLong_68 = value; Il2CppCodeGenWriteBarrier((&___XsLong_68), value); } inline static int32_t get_offset_of_XsInt_69() { return static_cast<int32_t>(offsetof(XmlSchemaSimpleType_t2678868104_StaticFields, ___XsInt_69)); } inline XmlSchemaSimpleType_t2678868104 * get_XsInt_69() const { return ___XsInt_69; } inline XmlSchemaSimpleType_t2678868104 ** get_address_of_XsInt_69() { return &___XsInt_69; } inline void set_XsInt_69(XmlSchemaSimpleType_t2678868104 * value) { ___XsInt_69 = value; Il2CppCodeGenWriteBarrier((&___XsInt_69), value); } inline static int32_t get_offset_of_XsShort_70() { return static_cast<int32_t>(offsetof(XmlSchemaSimpleType_t2678868104_StaticFields, ___XsShort_70)); } inline XmlSchemaSimpleType_t2678868104 * get_XsShort_70() const { return ___XsShort_70; } inline XmlSchemaSimpleType_t2678868104 ** get_address_of_XsShort_70() { return &___XsShort_70; } inline void set_XsShort_70(XmlSchemaSimpleType_t2678868104 * value) { ___XsShort_70 = value; Il2CppCodeGenWriteBarrier((&___XsShort_70), value); } inline static int32_t get_offset_of_XsByte_71() { return static_cast<int32_t>(offsetof(XmlSchemaSimpleType_t2678868104_StaticFields, ___XsByte_71)); } inline XmlSchemaSimpleType_t2678868104 * get_XsByte_71() const { return ___XsByte_71; } inline XmlSchemaSimpleType_t2678868104 ** get_address_of_XsByte_71() { return &___XsByte_71; } inline void set_XsByte_71(XmlSchemaSimpleType_t2678868104 * value) { ___XsByte_71 = value; Il2CppCodeGenWriteBarrier((&___XsByte_71), value); } inline static int32_t get_offset_of_XsNonNegativeInteger_72() { return static_cast<int32_t>(offsetof(XmlSchemaSimpleType_t2678868104_StaticFields, ___XsNonNegativeInteger_72)); } inline XmlSchemaSimpleType_t2678868104 * get_XsNonNegativeInteger_72() const { return ___XsNonNegativeInteger_72; } inline XmlSchemaSimpleType_t2678868104 ** get_address_of_XsNonNegativeInteger_72() { return &___XsNonNegativeInteger_72; } inline void set_XsNonNegativeInteger_72(XmlSchemaSimpleType_t2678868104 * value) { ___XsNonNegativeInteger_72 = value; Il2CppCodeGenWriteBarrier((&___XsNonNegativeInteger_72), value); } inline static int32_t get_offset_of_XsUnsignedLong_73() { return static_cast<int32_t>(offsetof(XmlSchemaSimpleType_t2678868104_StaticFields, ___XsUnsignedLong_73)); } inline XmlSchemaSimpleType_t2678868104 * get_XsUnsignedLong_73() const { return ___XsUnsignedLong_73; } inline XmlSchemaSimpleType_t2678868104 ** get_address_of_XsUnsignedLong_73() { return &___XsUnsignedLong_73; } inline void set_XsUnsignedLong_73(XmlSchemaSimpleType_t2678868104 * value) { ___XsUnsignedLong_73 = value; Il2CppCodeGenWriteBarrier((&___XsUnsignedLong_73), value); } inline static int32_t get_offset_of_XsUnsignedInt_74() { return static_cast<int32_t>(offsetof(XmlSchemaSimpleType_t2678868104_StaticFields, ___XsUnsignedInt_74)); } inline XmlSchemaSimpleType_t2678868104 * get_XsUnsignedInt_74() const { return ___XsUnsignedInt_74; } inline XmlSchemaSimpleType_t2678868104 ** get_address_of_XsUnsignedInt_74() { return &___XsUnsignedInt_74; } inline void set_XsUnsignedInt_74(XmlSchemaSimpleType_t2678868104 * value) { ___XsUnsignedInt_74 = value; Il2CppCodeGenWriteBarrier((&___XsUnsignedInt_74), value); } inline static int32_t get_offset_of_XsUnsignedShort_75() { return static_cast<int32_t>(offsetof(XmlSchemaSimpleType_t2678868104_StaticFields, ___XsUnsignedShort_75)); } inline XmlSchemaSimpleType_t2678868104 * get_XsUnsignedShort_75() const { return ___XsUnsignedShort_75; } inline XmlSchemaSimpleType_t2678868104 ** get_address_of_XsUnsignedShort_75() { return &___XsUnsignedShort_75; } inline void set_XsUnsignedShort_75(XmlSchemaSimpleType_t2678868104 * value) { ___XsUnsignedShort_75 = value; Il2CppCodeGenWriteBarrier((&___XsUnsignedShort_75), value); } inline static int32_t get_offset_of_XsUnsignedByte_76() { return static_cast<int32_t>(offsetof(XmlSchemaSimpleType_t2678868104_StaticFields, ___XsUnsignedByte_76)); } inline XmlSchemaSimpleType_t2678868104 * get_XsUnsignedByte_76() const { return ___XsUnsignedByte_76; } inline XmlSchemaSimpleType_t2678868104 ** get_address_of_XsUnsignedByte_76() { return &___XsUnsignedByte_76; } inline void set_XsUnsignedByte_76(XmlSchemaSimpleType_t2678868104 * value) { ___XsUnsignedByte_76 = value; Il2CppCodeGenWriteBarrier((&___XsUnsignedByte_76), value); } inline static int32_t get_offset_of_XsPositiveInteger_77() { return static_cast<int32_t>(offsetof(XmlSchemaSimpleType_t2678868104_StaticFields, ___XsPositiveInteger_77)); } inline XmlSchemaSimpleType_t2678868104 * get_XsPositiveInteger_77() const { return ___XsPositiveInteger_77; } inline XmlSchemaSimpleType_t2678868104 ** get_address_of_XsPositiveInteger_77() { return &___XsPositiveInteger_77; } inline void set_XsPositiveInteger_77(XmlSchemaSimpleType_t2678868104 * value) { ___XsPositiveInteger_77 = value; Il2CppCodeGenWriteBarrier((&___XsPositiveInteger_77), value); } inline static int32_t get_offset_of_XdtUntypedAtomic_78() { return static_cast<int32_t>(offsetof(XmlSchemaSimpleType_t2678868104_StaticFields, ___XdtUntypedAtomic_78)); } inline XmlSchemaSimpleType_t2678868104 * get_XdtUntypedAtomic_78() const { return ___XdtUntypedAtomic_78; } inline XmlSchemaSimpleType_t2678868104 ** get_address_of_XdtUntypedAtomic_78() { return &___XdtUntypedAtomic_78; } inline void set_XdtUntypedAtomic_78(XmlSchemaSimpleType_t2678868104 * value) { ___XdtUntypedAtomic_78 = value; Il2CppCodeGenWriteBarrier((&___XdtUntypedAtomic_78), value); } inline static int32_t get_offset_of_XdtAnyAtomicType_79() { return static_cast<int32_t>(offsetof(XmlSchemaSimpleType_t2678868104_StaticFields, ___XdtAnyAtomicType_79)); } inline XmlSchemaSimpleType_t2678868104 * get_XdtAnyAtomicType_79() const { return ___XdtAnyAtomicType_79; } inline XmlSchemaSimpleType_t2678868104 ** get_address_of_XdtAnyAtomicType_79() { return &___XdtAnyAtomicType_79; } inline void set_XdtAnyAtomicType_79(XmlSchemaSimpleType_t2678868104 * value) { ___XdtAnyAtomicType_79 = value; Il2CppCodeGenWriteBarrier((&___XdtAnyAtomicType_79), value); } inline static int32_t get_offset_of_XdtYearMonthDuration_80() { return static_cast<int32_t>(offsetof(XmlSchemaSimpleType_t2678868104_StaticFields, ___XdtYearMonthDuration_80)); } inline XmlSchemaSimpleType_t2678868104 * get_XdtYearMonthDuration_80() const { return ___XdtYearMonthDuration_80; } inline XmlSchemaSimpleType_t2678868104 ** get_address_of_XdtYearMonthDuration_80() { return &___XdtYearMonthDuration_80; } inline void set_XdtYearMonthDuration_80(XmlSchemaSimpleType_t2678868104 * value) { ___XdtYearMonthDuration_80 = value; Il2CppCodeGenWriteBarrier((&___XdtYearMonthDuration_80), value); } inline static int32_t get_offset_of_XdtDayTimeDuration_81() { return static_cast<int32_t>(offsetof(XmlSchemaSimpleType_t2678868104_StaticFields, ___XdtDayTimeDuration_81)); } inline XmlSchemaSimpleType_t2678868104 * get_XdtDayTimeDuration_81() const { return ___XdtDayTimeDuration_81; } inline XmlSchemaSimpleType_t2678868104 ** get_address_of_XdtDayTimeDuration_81() { return &___XdtDayTimeDuration_81; } inline void set_XdtDayTimeDuration_81(XmlSchemaSimpleType_t2678868104 * value) { ___XdtDayTimeDuration_81 = value; Il2CppCodeGenWriteBarrier((&___XdtDayTimeDuration_81), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // XMLSCHEMASIMPLETYPE_T2678868104_H #ifndef XMLSCHEMASIMPLETYPELIST_T472803608_H #define XMLSCHEMASIMPLETYPELIST_T472803608_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Xml.Schema.XmlSchemaSimpleTypeList struct XmlSchemaSimpleTypeList_t472803608 : public XmlSchemaSimpleTypeContent_t599285223 { public: // System.Xml.Schema.XmlSchemaSimpleType System.Xml.Schema.XmlSchemaSimpleTypeList::itemType XmlSchemaSimpleType_t2678868104 * ___itemType_17; // System.Xml.XmlQualifiedName System.Xml.Schema.XmlSchemaSimpleTypeList::itemTypeName XmlQualifiedName_t2760654312 * ___itemTypeName_18; // System.Object System.Xml.Schema.XmlSchemaSimpleTypeList::validatedListItemType RuntimeObject * ___validatedListItemType_19; // System.Xml.Schema.XmlSchemaSimpleType System.Xml.Schema.XmlSchemaSimpleTypeList::validatedListItemSchemaType XmlSchemaSimpleType_t2678868104 * ___validatedListItemSchemaType_20; public: inline static int32_t get_offset_of_itemType_17() { return static_cast<int32_t>(offsetof(XmlSchemaSimpleTypeList_t472803608, ___itemType_17)); } inline XmlSchemaSimpleType_t2678868104 * get_itemType_17() const { return ___itemType_17; } inline XmlSchemaSimpleType_t2678868104 ** get_address_of_itemType_17() { return &___itemType_17; } inline void set_itemType_17(XmlSchemaSimpleType_t2678868104 * value) { ___itemType_17 = value; Il2CppCodeGenWriteBarrier((&___itemType_17), value); } inline static int32_t get_offset_of_itemTypeName_18() { return static_cast<int32_t>(offsetof(XmlSchemaSimpleTypeList_t472803608, ___itemTypeName_18)); } inline XmlQualifiedName_t2760654312 * get_itemTypeName_18() const { return ___itemTypeName_18; } inline XmlQualifiedName_t2760654312 ** get_address_of_itemTypeName_18() { return &___itemTypeName_18; } inline void set_itemTypeName_18(XmlQualifiedName_t2760654312 * value) { ___itemTypeName_18 = value; Il2CppCodeGenWriteBarrier((&___itemTypeName_18), value); } inline static int32_t get_offset_of_validatedListItemType_19() { return static_cast<int32_t>(offsetof(XmlSchemaSimpleTypeList_t472803608, ___validatedListItemType_19)); } inline RuntimeObject * get_validatedListItemType_19() const { return ___validatedListItemType_19; } inline RuntimeObject ** get_address_of_validatedListItemType_19() { return &___validatedListItemType_19; } inline void set_validatedListItemType_19(RuntimeObject * value) { ___validatedListItemType_19 = value; Il2CppCodeGenWriteBarrier((&___validatedListItemType_19), value); } inline static int32_t get_offset_of_validatedListItemSchemaType_20() { return static_cast<int32_t>(offsetof(XmlSchemaSimpleTypeList_t472803608, ___validatedListItemSchemaType_20)); } inline XmlSchemaSimpleType_t2678868104 * get_validatedListItemSchemaType_20() const { return ___validatedListItemSchemaType_20; } inline XmlSchemaSimpleType_t2678868104 ** get_address_of_validatedListItemSchemaType_20() { return &___validatedListItemSchemaType_20; } inline void set_validatedListItemSchemaType_20(XmlSchemaSimpleType_t2678868104 * value) { ___validatedListItemSchemaType_20 = value; Il2CppCodeGenWriteBarrier((&___validatedListItemSchemaType_20), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // XMLSCHEMASIMPLETYPELIST_T472803608_H #ifndef XMLSCHEMAWHITESPACEFACET_T4158372164_H #define XMLSCHEMAWHITESPACEFACET_T4158372164_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Xml.Schema.XmlSchemaWhiteSpaceFacet struct XmlSchemaWhiteSpaceFacet_t4158372164 : public XmlSchemaFacet_t1906017689 { public: public: }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // XMLSCHEMAWHITESPACEFACET_T4158372164_H #ifndef XMLSCHEMASIMPLETYPERESTRICTION_T3925451115_H #define XMLSCHEMASIMPLETYPERESTRICTION_T3925451115_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Xml.Schema.XmlSchemaSimpleTypeRestriction struct XmlSchemaSimpleTypeRestriction_t3925451115 : public XmlSchemaSimpleTypeContent_t599285223 { public: // System.Xml.Schema.XmlSchemaSimpleType System.Xml.Schema.XmlSchemaSimpleTypeRestriction::baseType XmlSchemaSimpleType_t2678868104 * ___baseType_17; // System.Xml.XmlQualifiedName System.Xml.Schema.XmlSchemaSimpleTypeRestriction::baseTypeName XmlQualifiedName_t2760654312 * ___baseTypeName_18; // System.Xml.Schema.XmlSchemaObjectCollection System.Xml.Schema.XmlSchemaSimpleTypeRestriction::facets XmlSchemaObjectCollection_t1064819932 * ___facets_19; // System.String[] System.Xml.Schema.XmlSchemaSimpleTypeRestriction::enumarationFacetValues StringU5BU5D_t1281789340* ___enumarationFacetValues_20; // System.String[] System.Xml.Schema.XmlSchemaSimpleTypeRestriction::patternFacetValues StringU5BU5D_t1281789340* ___patternFacetValues_21; // System.Text.RegularExpressions.Regex[] System.Xml.Schema.XmlSchemaSimpleTypeRestriction::rexPatterns RegexU5BU5D_t1561692752* ___rexPatterns_22; // System.Decimal System.Xml.Schema.XmlSchemaSimpleTypeRestriction::lengthFacet Decimal_t2948259380 ___lengthFacet_23; // System.Decimal System.Xml.Schema.XmlSchemaSimpleTypeRestriction::maxLengthFacet Decimal_t2948259380 ___maxLengthFacet_24; // System.Decimal System.Xml.Schema.XmlSchemaSimpleTypeRestriction::minLengthFacet Decimal_t2948259380 ___minLengthFacet_25; // System.Decimal System.Xml.Schema.XmlSchemaSimpleTypeRestriction::fractionDigitsFacet Decimal_t2948259380 ___fractionDigitsFacet_26; // System.Decimal System.Xml.Schema.XmlSchemaSimpleTypeRestriction::totalDigitsFacet Decimal_t2948259380 ___totalDigitsFacet_27; // System.Object System.Xml.Schema.XmlSchemaSimpleTypeRestriction::maxInclusiveFacet RuntimeObject * ___maxInclusiveFacet_28; // System.Object System.Xml.Schema.XmlSchemaSimpleTypeRestriction::maxExclusiveFacet RuntimeObject * ___maxExclusiveFacet_29; // System.Object System.Xml.Schema.XmlSchemaSimpleTypeRestriction::minInclusiveFacet RuntimeObject * ___minInclusiveFacet_30; // System.Object System.Xml.Schema.XmlSchemaSimpleTypeRestriction::minExclusiveFacet RuntimeObject * ___minExclusiveFacet_31; // System.Xml.Schema.XmlSchemaFacet/Facet System.Xml.Schema.XmlSchemaSimpleTypeRestriction::fixedFacets int32_t ___fixedFacets_32; public: inline static int32_t get_offset_of_baseType_17() { return static_cast<int32_t>(offsetof(XmlSchemaSimpleTypeRestriction_t3925451115, ___baseType_17)); } inline XmlSchemaSimpleType_t2678868104 * get_baseType_17() const { return ___baseType_17; } inline XmlSchemaSimpleType_t2678868104 ** get_address_of_baseType_17() { return &___baseType_17; } inline void set_baseType_17(XmlSchemaSimpleType_t2678868104 * value) { ___baseType_17 = value; Il2CppCodeGenWriteBarrier((&___baseType_17), value); } inline static int32_t get_offset_of_baseTypeName_18() { return static_cast<int32_t>(offsetof(XmlSchemaSimpleTypeRestriction_t3925451115, ___baseTypeName_18)); } inline XmlQualifiedName_t2760654312 * get_baseTypeName_18() const { return ___baseTypeName_18; } inline XmlQualifiedName_t2760654312 ** get_address_of_baseTypeName_18() { return &___baseTypeName_18; } inline void set_baseTypeName_18(XmlQualifiedName_t2760654312 * value) { ___baseTypeName_18 = value; Il2CppCodeGenWriteBarrier((&___baseTypeName_18), value); } inline static int32_t get_offset_of_facets_19() { return static_cast<int32_t>(offsetof(XmlSchemaSimpleTypeRestriction_t3925451115, ___facets_19)); } inline XmlSchemaObjectCollection_t1064819932 * get_facets_19() const { return ___facets_19; } inline XmlSchemaObjectCollection_t1064819932 ** get_address_of_facets_19() { return &___facets_19; } inline void set_facets_19(XmlSchemaObjectCollection_t1064819932 * value) { ___facets_19 = value; Il2CppCodeGenWriteBarrier((&___facets_19), value); } inline static int32_t get_offset_of_enumarationFacetValues_20() { return static_cast<int32_t>(offsetof(XmlSchemaSimpleTypeRestriction_t3925451115, ___enumarationFacetValues_20)); } inline StringU5BU5D_t1281789340* get_enumarationFacetValues_20() const { return ___enumarationFacetValues_20; } inline StringU5BU5D_t1281789340** get_address_of_enumarationFacetValues_20() { return &___enumarationFacetValues_20; } inline void set_enumarationFacetValues_20(StringU5BU5D_t1281789340* value) { ___enumarationFacetValues_20 = value; Il2CppCodeGenWriteBarrier((&___enumarationFacetValues_20), value); } inline static int32_t get_offset_of_patternFacetValues_21() { return static_cast<int32_t>(offsetof(XmlSchemaSimpleTypeRestriction_t3925451115, ___patternFacetValues_21)); } inline StringU5BU5D_t1281789340* get_patternFacetValues_21() const { return ___patternFacetValues_21; } inline StringU5BU5D_t1281789340** get_address_of_patternFacetValues_21() { return &___patternFacetValues_21; } inline void set_patternFacetValues_21(StringU5BU5D_t1281789340* value) { ___patternFacetValues_21 = value; Il2CppCodeGenWriteBarrier((&___patternFacetValues_21), value); } inline static int32_t get_offset_of_rexPatterns_22() { return static_cast<int32_t>(offsetof(XmlSchemaSimpleTypeRestriction_t3925451115, ___rexPatterns_22)); } inline RegexU5BU5D_t1561692752* get_rexPatterns_22() const { return ___rexPatterns_22; } inline RegexU5BU5D_t1561692752** get_address_of_rexPatterns_22() { return &___rexPatterns_22; } inline void set_rexPatterns_22(RegexU5BU5D_t1561692752* value) { ___rexPatterns_22 = value; Il2CppCodeGenWriteBarrier((&___rexPatterns_22), value); } inline static int32_t get_offset_of_lengthFacet_23() { return static_cast<int32_t>(offsetof(XmlSchemaSimpleTypeRestriction_t3925451115, ___lengthFacet_23)); } inline Decimal_t2948259380 get_lengthFacet_23() const { return ___lengthFacet_23; } inline Decimal_t2948259380 * get_address_of_lengthFacet_23() { return &___lengthFacet_23; } inline void set_lengthFacet_23(Decimal_t2948259380 value) { ___lengthFacet_23 = value; } inline static int32_t get_offset_of_maxLengthFacet_24() { return static_cast<int32_t>(offsetof(XmlSchemaSimpleTypeRestriction_t3925451115, ___maxLengthFacet_24)); } inline Decimal_t2948259380 get_maxLengthFacet_24() const { return ___maxLengthFacet_24; } inline Decimal_t2948259380 * get_address_of_maxLengthFacet_24() { return &___maxLengthFacet_24; } inline void set_maxLengthFacet_24(Decimal_t2948259380 value) { ___maxLengthFacet_24 = value; } inline static int32_t get_offset_of_minLengthFacet_25() { return static_cast<int32_t>(offsetof(XmlSchemaSimpleTypeRestriction_t3925451115, ___minLengthFacet_25)); } inline Decimal_t2948259380 get_minLengthFacet_25() const { return ___minLengthFacet_25; } inline Decimal_t2948259380 * get_address_of_minLengthFacet_25() { return &___minLengthFacet_25; } inline void set_minLengthFacet_25(Decimal_t2948259380 value) { ___minLengthFacet_25 = value; } inline static int32_t get_offset_of_fractionDigitsFacet_26() { return static_cast<int32_t>(offsetof(XmlSchemaSimpleTypeRestriction_t3925451115, ___fractionDigitsFacet_26)); } inline Decimal_t2948259380 get_fractionDigitsFacet_26() const { return ___fractionDigitsFacet_26; } inline Decimal_t2948259380 * get_address_of_fractionDigitsFacet_26() { return &___fractionDigitsFacet_26; } inline void set_fractionDigitsFacet_26(Decimal_t2948259380 value) { ___fractionDigitsFacet_26 = value; } inline static int32_t get_offset_of_totalDigitsFacet_27() { return static_cast<int32_t>(offsetof(XmlSchemaSimpleTypeRestriction_t3925451115, ___totalDigitsFacet_27)); } inline Decimal_t2948259380 get_totalDigitsFacet_27() const { return ___totalDigitsFacet_27; } inline Decimal_t2948259380 * get_address_of_totalDigitsFacet_27() { return &___totalDigitsFacet_27; } inline void set_totalDigitsFacet_27(Decimal_t2948259380 value) { ___totalDigitsFacet_27 = value; } inline static int32_t get_offset_of_maxInclusiveFacet_28() { return static_cast<int32_t>(offsetof(XmlSchemaSimpleTypeRestriction_t3925451115, ___maxInclusiveFacet_28)); } inline RuntimeObject * get_maxInclusiveFacet_28() const { return ___maxInclusiveFacet_28; } inline RuntimeObject ** get_address_of_maxInclusiveFacet_28() { return &___maxInclusiveFacet_28; } inline void set_maxInclusiveFacet_28(RuntimeObject * value) { ___maxInclusiveFacet_28 = value; Il2CppCodeGenWriteBarrier((&___maxInclusiveFacet_28), value); } inline static int32_t get_offset_of_maxExclusiveFacet_29() { return static_cast<int32_t>(offsetof(XmlSchemaSimpleTypeRestriction_t3925451115, ___maxExclusiveFacet_29)); } inline RuntimeObject * get_maxExclusiveFacet_29() const { return ___maxExclusiveFacet_29; } inline RuntimeObject ** get_address_of_maxExclusiveFacet_29() { return &___maxExclusiveFacet_29; } inline void set_maxExclusiveFacet_29(RuntimeObject * value) { ___maxExclusiveFacet_29 = value; Il2CppCodeGenWriteBarrier((&___maxExclusiveFacet_29), value); } inline static int32_t get_offset_of_minInclusiveFacet_30() { return static_cast<int32_t>(offsetof(XmlSchemaSimpleTypeRestriction_t3925451115, ___minInclusiveFacet_30)); } inline RuntimeObject * get_minInclusiveFacet_30() const { return ___minInclusiveFacet_30; } inline RuntimeObject ** get_address_of_minInclusiveFacet_30() { return &___minInclusiveFacet_30; } inline void set_minInclusiveFacet_30(RuntimeObject * value) { ___minInclusiveFacet_30 = value; Il2CppCodeGenWriteBarrier((&___minInclusiveFacet_30), value); } inline static int32_t get_offset_of_minExclusiveFacet_31() { return static_cast<int32_t>(offsetof(XmlSchemaSimpleTypeRestriction_t3925451115, ___minExclusiveFacet_31)); } inline RuntimeObject * get_minExclusiveFacet_31() const { return ___minExclusiveFacet_31; } inline RuntimeObject ** get_address_of_minExclusiveFacet_31() { return &___minExclusiveFacet_31; } inline void set_minExclusiveFacet_31(RuntimeObject * value) { ___minExclusiveFacet_31 = value; Il2CppCodeGenWriteBarrier((&___minExclusiveFacet_31), value); } inline static int32_t get_offset_of_fixedFacets_32() { return static_cast<int32_t>(offsetof(XmlSchemaSimpleTypeRestriction_t3925451115, ___fixedFacets_32)); } inline int32_t get_fixedFacets_32() const { return ___fixedFacets_32; } inline int32_t* get_address_of_fixedFacets_32() { return &___fixedFacets_32; } inline void set_fixedFacets_32(int32_t value) { ___fixedFacets_32 = value; } }; struct XmlSchemaSimpleTypeRestriction_t3925451115_StaticFields { public: // System.Globalization.NumberStyles System.Xml.Schema.XmlSchemaSimpleTypeRestriction::lengthStyle int32_t ___lengthStyle_33; // System.Xml.Schema.XmlSchemaFacet/Facet System.Xml.Schema.XmlSchemaSimpleTypeRestriction::listFacets int32_t ___listFacets_34; public: inline static int32_t get_offset_of_lengthStyle_33() { return static_cast<int32_t>(offsetof(XmlSchemaSimpleTypeRestriction_t3925451115_StaticFields, ___lengthStyle_33)); } inline int32_t get_lengthStyle_33() const { return ___lengthStyle_33; } inline int32_t* get_address_of_lengthStyle_33() { return &___lengthStyle_33; } inline void set_lengthStyle_33(int32_t value) { ___lengthStyle_33 = value; } inline static int32_t get_offset_of_listFacets_34() { return static_cast<int32_t>(offsetof(XmlSchemaSimpleTypeRestriction_t3925451115_StaticFields, ___listFacets_34)); } inline int32_t get_listFacets_34() const { return ___listFacets_34; } inline int32_t* get_address_of_listFacets_34() { return &___listFacets_34; } inline void set_listFacets_34(int32_t value) { ___listFacets_34 = value; } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // XMLSCHEMASIMPLETYPERESTRICTION_T3925451115_H #ifndef XMLSCHEMASIMPLETYPEUNION_T4071426880_H #define XMLSCHEMASIMPLETYPEUNION_T4071426880_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Xml.Schema.XmlSchemaSimpleTypeUnion struct XmlSchemaSimpleTypeUnion_t4071426880 : public XmlSchemaSimpleTypeContent_t599285223 { public: // System.Xml.Schema.XmlSchemaObjectCollection System.Xml.Schema.XmlSchemaSimpleTypeUnion::baseTypes XmlSchemaObjectCollection_t1064819932 * ___baseTypes_17; // System.Xml.XmlQualifiedName[] System.Xml.Schema.XmlSchemaSimpleTypeUnion::memberTypes XmlQualifiedNameU5BU5D_t1471530361* ___memberTypes_18; // System.Object[] System.Xml.Schema.XmlSchemaSimpleTypeUnion::validatedTypes ObjectU5BU5D_t2843939325* ___validatedTypes_19; // System.Xml.Schema.XmlSchemaSimpleType[] System.Xml.Schema.XmlSchemaSimpleTypeUnion::validatedSchemaTypes XmlSchemaSimpleTypeU5BU5D_t1394089049* ___validatedSchemaTypes_20; public: inline static int32_t get_offset_of_baseTypes_17() { return static_cast<int32_t>(offsetof(XmlSchemaSimpleTypeUnion_t4071426880, ___baseTypes_17)); } inline XmlSchemaObjectCollection_t1064819932 * get_baseTypes_17() const { return ___baseTypes_17; } inline XmlSchemaObjectCollection_t1064819932 ** get_address_of_baseTypes_17() { return &___baseTypes_17; } inline void set_baseTypes_17(XmlSchemaObjectCollection_t1064819932 * value) { ___baseTypes_17 = value; Il2CppCodeGenWriteBarrier((&___baseTypes_17), value); } inline static int32_t get_offset_of_memberTypes_18() { return static_cast<int32_t>(offsetof(XmlSchemaSimpleTypeUnion_t4071426880, ___memberTypes_18)); } inline XmlQualifiedNameU5BU5D_t1471530361* get_memberTypes_18() const { return ___memberTypes_18; } inline XmlQualifiedNameU5BU5D_t1471530361** get_address_of_memberTypes_18() { return &___memberTypes_18; } inline void set_memberTypes_18(XmlQualifiedNameU5BU5D_t1471530361* value) { ___memberTypes_18 = value; Il2CppCodeGenWriteBarrier((&___memberTypes_18), value); } inline static int32_t get_offset_of_validatedTypes_19() { return static_cast<int32_t>(offsetof(XmlSchemaSimpleTypeUnion_t4071426880, ___validatedTypes_19)); } inline ObjectU5BU5D_t2843939325* get_validatedTypes_19() const { return ___validatedTypes_19; } inline ObjectU5BU5D_t2843939325** get_address_of_validatedTypes_19() { return &___validatedTypes_19; } inline void set_validatedTypes_19(ObjectU5BU5D_t2843939325* value) { ___validatedTypes_19 = value; Il2CppCodeGenWriteBarrier((&___validatedTypes_19), value); } inline static int32_t get_offset_of_validatedSchemaTypes_20() { return static_cast<int32_t>(offsetof(XmlSchemaSimpleTypeUnion_t4071426880, ___validatedSchemaTypes_20)); } inline XmlSchemaSimpleTypeU5BU5D_t1394089049* get_validatedSchemaTypes_20() const { return ___validatedSchemaTypes_20; } inline XmlSchemaSimpleTypeU5BU5D_t1394089049** get_address_of_validatedSchemaTypes_20() { return &___validatedSchemaTypes_20; } inline void set_validatedSchemaTypes_20(XmlSchemaSimpleTypeU5BU5D_t1394089049* value) { ___validatedSchemaTypes_20 = value; Il2CppCodeGenWriteBarrier((&___validatedSchemaTypes_20), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // XMLSCHEMASIMPLETYPEUNION_T4071426880_H #ifndef XMLSCHEMAUNIQUE_T2867867737_H #define XMLSCHEMAUNIQUE_T2867867737_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Xml.Schema.XmlSchemaUnique struct XmlSchemaUnique_t2867867737 : public XmlSchemaIdentityConstraint_t297318432 { public: public: }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // XMLSCHEMAUNIQUE_T2867867737_H #ifndef XMLSCHEMACOMPLEXTYPE_T3740801802_H #define XMLSCHEMACOMPLEXTYPE_T3740801802_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Xml.Schema.XmlSchemaComplexType struct XmlSchemaComplexType_t3740801802 : public XmlSchemaType_t2033747345 { public: // System.Xml.Schema.XmlSchemaAnyAttribute System.Xml.Schema.XmlSchemaComplexType::anyAttribute XmlSchemaAnyAttribute_t963227996 * ___anyAttribute_28; // System.Xml.Schema.XmlSchemaObjectCollection System.Xml.Schema.XmlSchemaComplexType::attributes XmlSchemaObjectCollection_t1064819932 * ___attributes_29; // System.Xml.Schema.XmlSchemaObjectTable System.Xml.Schema.XmlSchemaComplexType::attributeUses XmlSchemaObjectTable_t2546974348 * ___attributeUses_30; // System.Xml.Schema.XmlSchemaAnyAttribute System.Xml.Schema.XmlSchemaComplexType::attributeWildcard XmlSchemaAnyAttribute_t963227996 * ___attributeWildcard_31; // System.Xml.Schema.XmlSchemaDerivationMethod System.Xml.Schema.XmlSchemaComplexType::block int32_t ___block_32; // System.Xml.Schema.XmlSchemaDerivationMethod System.Xml.Schema.XmlSchemaComplexType::blockResolved int32_t ___blockResolved_33; // System.Xml.Schema.XmlSchemaContentModel System.Xml.Schema.XmlSchemaComplexType::contentModel XmlSchemaContentModel_t602185179 * ___contentModel_34; // System.Xml.Schema.XmlSchemaParticle System.Xml.Schema.XmlSchemaComplexType::validatableParticle XmlSchemaParticle_t3828501457 * ___validatableParticle_35; // System.Xml.Schema.XmlSchemaParticle System.Xml.Schema.XmlSchemaComplexType::contentTypeParticle XmlSchemaParticle_t3828501457 * ___contentTypeParticle_36; // System.Boolean System.Xml.Schema.XmlSchemaComplexType::isAbstract bool ___isAbstract_37; // System.Boolean System.Xml.Schema.XmlSchemaComplexType::isMixed bool ___isMixed_38; // System.Xml.Schema.XmlSchemaParticle System.Xml.Schema.XmlSchemaComplexType::particle XmlSchemaParticle_t3828501457 * ___particle_39; // System.Xml.Schema.XmlSchemaContentType System.Xml.Schema.XmlSchemaComplexType::resolvedContentType int32_t ___resolvedContentType_40; // System.Boolean System.Xml.Schema.XmlSchemaComplexType::ValidatedIsAbstract bool ___ValidatedIsAbstract_41; // System.Guid System.Xml.Schema.XmlSchemaComplexType::CollectProcessId Guid_t ___CollectProcessId_44; public: inline static int32_t get_offset_of_anyAttribute_28() { return static_cast<int32_t>(offsetof(XmlSchemaComplexType_t3740801802, ___anyAttribute_28)); } inline XmlSchemaAnyAttribute_t963227996 * get_anyAttribute_28() const { return ___anyAttribute_28; } inline XmlSchemaAnyAttribute_t963227996 ** get_address_of_anyAttribute_28() { return &___anyAttribute_28; } inline void set_anyAttribute_28(XmlSchemaAnyAttribute_t963227996 * value) { ___anyAttribute_28 = value; Il2CppCodeGenWriteBarrier((&___anyAttribute_28), value); } inline static int32_t get_offset_of_attributes_29() { return static_cast<int32_t>(offsetof(XmlSchemaComplexType_t3740801802, ___attributes_29)); } inline XmlSchemaObjectCollection_t1064819932 * get_attributes_29() const { return ___attributes_29; } inline XmlSchemaObjectCollection_t1064819932 ** get_address_of_attributes_29() { return &___attributes_29; } inline void set_attributes_29(XmlSchemaObjectCollection_t1064819932 * value) { ___attributes_29 = value; Il2CppCodeGenWriteBarrier((&___attributes_29), value); } inline static int32_t get_offset_of_attributeUses_30() { return static_cast<int32_t>(offsetof(XmlSchemaComplexType_t3740801802, ___attributeUses_30)); } inline XmlSchemaObjectTable_t2546974348 * get_attributeUses_30() const { return ___attributeUses_30; } inline XmlSchemaObjectTable_t2546974348 ** get_address_of_attributeUses_30() { return &___attributeUses_30; } inline void set_attributeUses_30(XmlSchemaObjectTable_t2546974348 * value) { ___attributeUses_30 = value; Il2CppCodeGenWriteBarrier((&___attributeUses_30), value); } inline static int32_t get_offset_of_attributeWildcard_31() { return static_cast<int32_t>(offsetof(XmlSchemaComplexType_t3740801802, ___attributeWildcard_31)); } inline XmlSchemaAnyAttribute_t963227996 * get_attributeWildcard_31() const { return ___attributeWildcard_31; } inline XmlSchemaAnyAttribute_t963227996 ** get_address_of_attributeWildcard_31() { return &___attributeWildcard_31; } inline void set_attributeWildcard_31(XmlSchemaAnyAttribute_t963227996 * value) { ___attributeWildcard_31 = value; Il2CppCodeGenWriteBarrier((&___attributeWildcard_31), value); } inline static int32_t get_offset_of_block_32() { return static_cast<int32_t>(offsetof(XmlSchemaComplexType_t3740801802, ___block_32)); } inline int32_t get_block_32() const { return ___block_32; } inline int32_t* get_address_of_block_32() { return &___block_32; } inline void set_block_32(int32_t value) { ___block_32 = value; } inline static int32_t get_offset_of_blockResolved_33() { return static_cast<int32_t>(offsetof(XmlSchemaComplexType_t3740801802, ___blockResolved_33)); } inline int32_t get_blockResolved_33() const { return ___blockResolved_33; } inline int32_t* get_address_of_blockResolved_33() { return &___blockResolved_33; } inline void set_blockResolved_33(int32_t value) { ___blockResolved_33 = value; } inline static int32_t get_offset_of_contentModel_34() { return static_cast<int32_t>(offsetof(XmlSchemaComplexType_t3740801802, ___contentModel_34)); } inline XmlSchemaContentModel_t602185179 * get_contentModel_34() const { return ___contentModel_34; } inline XmlSchemaContentModel_t602185179 ** get_address_of_contentModel_34() { return &___contentModel_34; } inline void set_contentModel_34(XmlSchemaContentModel_t602185179 * value) { ___contentModel_34 = value; Il2CppCodeGenWriteBarrier((&___contentModel_34), value); } inline static int32_t get_offset_of_validatableParticle_35() { return static_cast<int32_t>(offsetof(XmlSchemaComplexType_t3740801802, ___validatableParticle_35)); } inline XmlSchemaParticle_t3828501457 * get_validatableParticle_35() const { return ___validatableParticle_35; } inline XmlSchemaParticle_t3828501457 ** get_address_of_validatableParticle_35() { return &___validatableParticle_35; } inline void set_validatableParticle_35(XmlSchemaParticle_t3828501457 * value) { ___validatableParticle_35 = value; Il2CppCodeGenWriteBarrier((&___validatableParticle_35), value); } inline static int32_t get_offset_of_contentTypeParticle_36() { return static_cast<int32_t>(offsetof(XmlSchemaComplexType_t3740801802, ___contentTypeParticle_36)); } inline XmlSchemaParticle_t3828501457 * get_contentTypeParticle_36() const { return ___contentTypeParticle_36; } inline XmlSchemaParticle_t3828501457 ** get_address_of_contentTypeParticle_36() { return &___contentTypeParticle_36; } inline void set_contentTypeParticle_36(XmlSchemaParticle_t3828501457 * value) { ___contentTypeParticle_36 = value; Il2CppCodeGenWriteBarrier((&___contentTypeParticle_36), value); } inline static int32_t get_offset_of_isAbstract_37() { return static_cast<int32_t>(offsetof(XmlSchemaComplexType_t3740801802, ___isAbstract_37)); } inline bool get_isAbstract_37() const { return ___isAbstract_37; } inline bool* get_address_of_isAbstract_37() { return &___isAbstract_37; } inline void set_isAbstract_37(bool value) { ___isAbstract_37 = value; } inline static int32_t get_offset_of_isMixed_38() { return static_cast<int32_t>(offsetof(XmlSchemaComplexType_t3740801802, ___isMixed_38)); } inline bool get_isMixed_38() const { return ___isMixed_38; } inline bool* get_address_of_isMixed_38() { return &___isMixed_38; } inline void set_isMixed_38(bool value) { ___isMixed_38 = value; } inline static int32_t get_offset_of_particle_39() { return static_cast<int32_t>(offsetof(XmlSchemaComplexType_t3740801802, ___particle_39)); } inline XmlSchemaParticle_t3828501457 * get_particle_39() const { return ___particle_39; } inline XmlSchemaParticle_t3828501457 ** get_address_of_particle_39() { return &___particle_39; } inline void set_particle_39(XmlSchemaParticle_t3828501457 * value) { ___particle_39 = value; Il2CppCodeGenWriteBarrier((&___particle_39), value); } inline static int32_t get_offset_of_resolvedContentType_40() { return static_cast<int32_t>(offsetof(XmlSchemaComplexType_t3740801802, ___resolvedContentType_40)); } inline int32_t get_resolvedContentType_40() const { return ___resolvedContentType_40; } inline int32_t* get_address_of_resolvedContentType_40() { return &___resolvedContentType_40; } inline void set_resolvedContentType_40(int32_t value) { ___resolvedContentType_40 = value; } inline static int32_t get_offset_of_ValidatedIsAbstract_41() { return static_cast<int32_t>(offsetof(XmlSchemaComplexType_t3740801802, ___ValidatedIsAbstract_41)); } inline bool get_ValidatedIsAbstract_41() const { return ___ValidatedIsAbstract_41; } inline bool* get_address_of_ValidatedIsAbstract_41() { return &___ValidatedIsAbstract_41; } inline void set_ValidatedIsAbstract_41(bool value) { ___ValidatedIsAbstract_41 = value; } inline static int32_t get_offset_of_CollectProcessId_44() { return static_cast<int32_t>(offsetof(XmlSchemaComplexType_t3740801802, ___CollectProcessId_44)); } inline Guid_t get_CollectProcessId_44() const { return ___CollectProcessId_44; } inline Guid_t * get_address_of_CollectProcessId_44() { return &___CollectProcessId_44; } inline void set_CollectProcessId_44(Guid_t value) { ___CollectProcessId_44 = value; } }; struct XmlSchemaComplexType_t3740801802_StaticFields { public: // System.Xml.Schema.XmlSchemaComplexType System.Xml.Schema.XmlSchemaComplexType::anyType XmlSchemaComplexType_t3740801802 * ___anyType_42; // System.Xml.XmlQualifiedName System.Xml.Schema.XmlSchemaComplexType::AnyTypeName XmlQualifiedName_t2760654312 * ___AnyTypeName_43; public: inline static int32_t get_offset_of_anyType_42() { return static_cast<int32_t>(offsetof(XmlSchemaComplexType_t3740801802_StaticFields, ___anyType_42)); } inline XmlSchemaComplexType_t3740801802 * get_anyType_42() const { return ___anyType_42; } inline XmlSchemaComplexType_t3740801802 ** get_address_of_anyType_42() { return &___anyType_42; } inline void set_anyType_42(XmlSchemaComplexType_t3740801802 * value) { ___anyType_42 = value; Il2CppCodeGenWriteBarrier((&___anyType_42), value); } inline static int32_t get_offset_of_AnyTypeName_43() { return static_cast<int32_t>(offsetof(XmlSchemaComplexType_t3740801802_StaticFields, ___AnyTypeName_43)); } inline XmlQualifiedName_t2760654312 * get_AnyTypeName_43() const { return ___AnyTypeName_43; } inline XmlQualifiedName_t2760654312 ** get_address_of_AnyTypeName_43() { return &___AnyTypeName_43; } inline void set_AnyTypeName_43(XmlQualifiedName_t2760654312 * value) { ___AnyTypeName_43 = value; Il2CppCodeGenWriteBarrier((&___AnyTypeName_43), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // XMLSCHEMACOMPLEXTYPE_T3740801802_H #ifndef XMLSCHEMAKEY_T3030860318_H #define XMLSCHEMAKEY_T3030860318_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Xml.Schema.XmlSchemaKey struct XmlSchemaKey_t3030860318 : public XmlSchemaIdentityConstraint_t297318432 { public: public: }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // XMLSCHEMAKEY_T3030860318_H #ifndef XMLSCHEMAKEYREF_T3124006214_H #define XMLSCHEMAKEYREF_T3124006214_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Xml.Schema.XmlSchemaKeyref struct XmlSchemaKeyref_t3124006214 : public XmlSchemaIdentityConstraint_t297318432 { public: // System.Xml.XmlQualifiedName System.Xml.Schema.XmlSchemaKeyref::refer XmlQualifiedName_t2760654312 * ___refer_21; // System.Xml.Schema.XmlSchemaIdentityConstraint System.Xml.Schema.XmlSchemaKeyref::target XmlSchemaIdentityConstraint_t297318432 * ___target_22; public: inline static int32_t get_offset_of_refer_21() { return static_cast<int32_t>(offsetof(XmlSchemaKeyref_t3124006214, ___refer_21)); } inline XmlQualifiedName_t2760654312 * get_refer_21() const { return ___refer_21; } inline XmlQualifiedName_t2760654312 ** get_address_of_refer_21() { return &___refer_21; } inline void set_refer_21(XmlQualifiedName_t2760654312 * value) { ___refer_21 = value; Il2CppCodeGenWriteBarrier((&___refer_21), value); } inline static int32_t get_offset_of_target_22() { return static_cast<int32_t>(offsetof(XmlSchemaKeyref_t3124006214, ___target_22)); } inline XmlSchemaIdentityConstraint_t297318432 * get_target_22() const { return ___target_22; } inline XmlSchemaIdentityConstraint_t297318432 ** get_address_of_target_22() { return &___target_22; } inline void set_target_22(XmlSchemaIdentityConstraint_t297318432 * value) { ___target_22 = value; Il2CppCodeGenWriteBarrier((&___target_22), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // XMLSCHEMAKEYREF_T3124006214_H #ifndef XMLSCHEMAMAXEXCLUSIVEFACET_T786951263_H #define XMLSCHEMAMAXEXCLUSIVEFACET_T786951263_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Xml.Schema.XmlSchemaMaxExclusiveFacet struct XmlSchemaMaxExclusiveFacet_t786951263 : public XmlSchemaFacet_t1906017689 { public: public: }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // XMLSCHEMAMAXEXCLUSIVEFACET_T786951263_H #ifndef XMLSCHEMAMAXINCLUSIVEFACET_T719708644_H #define XMLSCHEMAMAXINCLUSIVEFACET_T719708644_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Xml.Schema.XmlSchemaMaxInclusiveFacet struct XmlSchemaMaxInclusiveFacet_t719708644 : public XmlSchemaFacet_t1906017689 { public: public: }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // XMLSCHEMAMAXINCLUSIVEFACET_T719708644_H #ifndef XMLSCHEMACOMPLEXCONTENTRESTRICTION_T3155540863_H #define XMLSCHEMACOMPLEXCONTENTRESTRICTION_T3155540863_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Xml.Schema.XmlSchemaComplexContentRestriction struct XmlSchemaComplexContentRestriction_t3155540863 : public XmlSchemaContent_t1040349258 { public: // System.Xml.Schema.XmlSchemaAnyAttribute System.Xml.Schema.XmlSchemaComplexContentRestriction::any XmlSchemaAnyAttribute_t963227996 * ___any_17; // System.Xml.Schema.XmlSchemaObjectCollection System.Xml.Schema.XmlSchemaComplexContentRestriction::attributes XmlSchemaObjectCollection_t1064819932 * ___attributes_18; // System.Xml.XmlQualifiedName System.Xml.Schema.XmlSchemaComplexContentRestriction::baseTypeName XmlQualifiedName_t2760654312 * ___baseTypeName_19; // System.Xml.Schema.XmlSchemaParticle System.Xml.Schema.XmlSchemaComplexContentRestriction::particle XmlSchemaParticle_t3828501457 * ___particle_20; public: inline static int32_t get_offset_of_any_17() { return static_cast<int32_t>(offsetof(XmlSchemaComplexContentRestriction_t3155540863, ___any_17)); } inline XmlSchemaAnyAttribute_t963227996 * get_any_17() const { return ___any_17; } inline XmlSchemaAnyAttribute_t963227996 ** get_address_of_any_17() { return &___any_17; } inline void set_any_17(XmlSchemaAnyAttribute_t963227996 * value) { ___any_17 = value; Il2CppCodeGenWriteBarrier((&___any_17), value); } inline static int32_t get_offset_of_attributes_18() { return static_cast<int32_t>(offsetof(XmlSchemaComplexContentRestriction_t3155540863, ___attributes_18)); } inline XmlSchemaObjectCollection_t1064819932 * get_attributes_18() const { return ___attributes_18; } inline XmlSchemaObjectCollection_t1064819932 ** get_address_of_attributes_18() { return &___attributes_18; } inline void set_attributes_18(XmlSchemaObjectCollection_t1064819932 * value) { ___attributes_18 = value; Il2CppCodeGenWriteBarrier((&___attributes_18), value); } inline static int32_t get_offset_of_baseTypeName_19() { return static_cast<int32_t>(offsetof(XmlSchemaComplexContentRestriction_t3155540863, ___baseTypeName_19)); } inline XmlQualifiedName_t2760654312 * get_baseTypeName_19() const { return ___baseTypeName_19; } inline XmlQualifiedName_t2760654312 ** get_address_of_baseTypeName_19() { return &___baseTypeName_19; } inline void set_baseTypeName_19(XmlQualifiedName_t2760654312 * value) { ___baseTypeName_19 = value; Il2CppCodeGenWriteBarrier((&___baseTypeName_19), value); } inline static int32_t get_offset_of_particle_20() { return static_cast<int32_t>(offsetof(XmlSchemaComplexContentRestriction_t3155540863, ___particle_20)); } inline XmlSchemaParticle_t3828501457 * get_particle_20() const { return ___particle_20; } inline XmlSchemaParticle_t3828501457 ** get_address_of_particle_20() { return &___particle_20; } inline void set_particle_20(XmlSchemaParticle_t3828501457 * value) { ___particle_20 = value; Il2CppCodeGenWriteBarrier((&___particle_20), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // XMLSCHEMACOMPLEXCONTENTRESTRICTION_T3155540863_H #ifndef XMLSCHEMAMININCLUSIVEFACET_T18629333_H #define XMLSCHEMAMININCLUSIVEFACET_T18629333_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Xml.Schema.XmlSchemaMinInclusiveFacet struct XmlSchemaMinInclusiveFacet_t18629333 : public XmlSchemaFacet_t1906017689 { public: public: }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // XMLSCHEMAMININCLUSIVEFACET_T18629333_H #ifndef XMLSCHEMANUMERICFACET_T3753040035_H #define XMLSCHEMANUMERICFACET_T3753040035_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Xml.Schema.XmlSchemaNumericFacet struct XmlSchemaNumericFacet_t3753040035 : public XmlSchemaFacet_t1906017689 { public: public: }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // XMLSCHEMANUMERICFACET_T3753040035_H #ifndef EMPTYPARTICLE_T2028271315_H #define EMPTYPARTICLE_T2028271315_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Xml.Schema.XmlSchemaParticle/EmptyParticle struct EmptyParticle_t2028271315 : public XmlSchemaParticle_t3828501457 { public: public: }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // EMPTYPARTICLE_T2028271315_H #ifndef XMLSCHEMAPATTERNFACET_T3316004401_H #define XMLSCHEMAPATTERNFACET_T3316004401_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Xml.Schema.XmlSchemaPatternFacet struct XmlSchemaPatternFacet_t3316004401 : public XmlSchemaFacet_t1906017689 { public: public: }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // XMLSCHEMAPATTERNFACET_T3316004401_H #ifndef XMLSCHEMAMINEXCLUSIVEFACET_T85871952_H #define XMLSCHEMAMINEXCLUSIVEFACET_T85871952_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Xml.Schema.XmlSchemaMinExclusiveFacet struct XmlSchemaMinExclusiveFacet_t85871952 : public XmlSchemaFacet_t1906017689 { public: public: }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // XMLSCHEMAMINEXCLUSIVEFACET_T85871952_H #ifndef XMLSCHEMAFRACTIONDIGITSFACET_T2589598443_H #define XMLSCHEMAFRACTIONDIGITSFACET_T2589598443_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Xml.Schema.XmlSchemaFractionDigitsFacet struct XmlSchemaFractionDigitsFacet_t2589598443 : public XmlSchemaNumericFacet_t3753040035 { public: public: }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // XMLSCHEMAFRACTIONDIGITSFACET_T2589598443_H #ifndef XMLSCHEMALENGTHFACET_T4286280832_H #define XMLSCHEMALENGTHFACET_T4286280832_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Xml.Schema.XmlSchemaLengthFacet struct XmlSchemaLengthFacet_t4286280832 : public XmlSchemaNumericFacet_t3753040035 { public: public: }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // XMLSCHEMALENGTHFACET_T4286280832_H #ifndef XMLSCHEMATOTALDIGITSFACET_T297930215_H #define XMLSCHEMATOTALDIGITSFACET_T297930215_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Xml.Schema.XmlSchemaTotalDigitsFacet struct XmlSchemaTotalDigitsFacet_t297930215 : public XmlSchemaNumericFacet_t3753040035 { public: public: }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // XMLSCHEMATOTALDIGITSFACET_T297930215_H #ifndef XMLSCHEMAMINLENGTHFACET_T686585762_H #define XMLSCHEMAMINLENGTHFACET_T686585762_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Xml.Schema.XmlSchemaMinLengthFacet struct XmlSchemaMinLengthFacet_t686585762 : public XmlSchemaNumericFacet_t3753040035 { public: public: }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // XMLSCHEMAMINLENGTHFACET_T686585762_H #ifndef XMLSCHEMASEQUENCE_T2018345177_H #define XMLSCHEMASEQUENCE_T2018345177_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Xml.Schema.XmlSchemaSequence struct XmlSchemaSequence_t2018345177 : public XmlSchemaGroupBase_t3631079376 { public: // System.Xml.Schema.XmlSchemaObjectCollection System.Xml.Schema.XmlSchemaSequence::items XmlSchemaObjectCollection_t1064819932 * ___items_28; public: inline static int32_t get_offset_of_items_28() { return static_cast<int32_t>(offsetof(XmlSchemaSequence_t2018345177, ___items_28)); } inline XmlSchemaObjectCollection_t1064819932 * get_items_28() const { return ___items_28; } inline XmlSchemaObjectCollection_t1064819932 ** get_address_of_items_28() { return &___items_28; } inline void set_items_28(XmlSchemaObjectCollection_t1064819932 * value) { ___items_28 = value; Il2CppCodeGenWriteBarrier((&___items_28), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // XMLSCHEMASEQUENCE_T2018345177_H #ifndef XMLSCHEMAMAXLENGTHFACET_T2192171319_H #define XMLSCHEMAMAXLENGTHFACET_T2192171319_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Xml.Schema.XmlSchemaMaxLengthFacet struct XmlSchemaMaxLengthFacet_t2192171319 : public XmlSchemaNumericFacet_t3753040035 { public: public: }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // XMLSCHEMAMAXLENGTHFACET_T2192171319_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1300 = { sizeof (XmlSchemaComplexContentRestriction_t3155540863), -1, 0, 0 }; extern const int32_t g_FieldOffsetTable1300[4] = { XmlSchemaComplexContentRestriction_t3155540863::get_offset_of_any_17(), XmlSchemaComplexContentRestriction_t3155540863::get_offset_of_attributes_18(), XmlSchemaComplexContentRestriction_t3155540863::get_offset_of_baseTypeName_19(), XmlSchemaComplexContentRestriction_t3155540863::get_offset_of_particle_20(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1301 = { sizeof (XmlSchemaComplexType_t3740801802), -1, sizeof(XmlSchemaComplexType_t3740801802_StaticFields), 0 }; extern const int32_t g_FieldOffsetTable1301[17] = { XmlSchemaComplexType_t3740801802::get_offset_of_anyAttribute_28(), XmlSchemaComplexType_t3740801802::get_offset_of_attributes_29(), XmlSchemaComplexType_t3740801802::get_offset_of_attributeUses_30(), XmlSchemaComplexType_t3740801802::get_offset_of_attributeWildcard_31(), XmlSchemaComplexType_t3740801802::get_offset_of_block_32(), XmlSchemaComplexType_t3740801802::get_offset_of_blockResolved_33(), XmlSchemaComplexType_t3740801802::get_offset_of_contentModel_34(), XmlSchemaComplexType_t3740801802::get_offset_of_validatableParticle_35(), XmlSchemaComplexType_t3740801802::get_offset_of_contentTypeParticle_36(), XmlSchemaComplexType_t3740801802::get_offset_of_isAbstract_37(), XmlSchemaComplexType_t3740801802::get_offset_of_isMixed_38(), XmlSchemaComplexType_t3740801802::get_offset_of_particle_39(), XmlSchemaComplexType_t3740801802::get_offset_of_resolvedContentType_40(), XmlSchemaComplexType_t3740801802::get_offset_of_ValidatedIsAbstract_41(), XmlSchemaComplexType_t3740801802_StaticFields::get_offset_of_anyType_42(), XmlSchemaComplexType_t3740801802_StaticFields::get_offset_of_AnyTypeName_43(), XmlSchemaComplexType_t3740801802::get_offset_of_CollectProcessId_44(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1302 = { sizeof (XmlSchemaContent_t1040349258), -1, 0, 0 }; extern const int32_t g_FieldOffsetTable1302[1] = { XmlSchemaContent_t1040349258::get_offset_of_actualBaseSchemaType_16(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1303 = { sizeof (XmlSchemaContentModel_t602185179), -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1304 = { sizeof (XmlSchemaContentProcessing_t826201100)+ sizeof (RuntimeObject), sizeof(int32_t), 0, 0 }; extern const int32_t g_FieldOffsetTable1304[5] = { XmlSchemaContentProcessing_t826201100::get_offset_of_value___1() + static_cast<int32_t>(sizeof(RuntimeObject)), 0, 0, 0, 0, }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1305 = { sizeof (XmlSchemaContentType_t3022550233)+ sizeof (RuntimeObject), sizeof(int32_t), 0, 0 }; extern const int32_t g_FieldOffsetTable1305[5] = { XmlSchemaContentType_t3022550233::get_offset_of_value___1() + static_cast<int32_t>(sizeof(RuntimeObject)), 0, 0, 0, 0, }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1306 = { sizeof (XmlSchemaDatatype_t322714710), -1, sizeof(XmlSchemaDatatype_t322714710_StaticFields), 0 }; extern const int32_t g_FieldOffsetTable1306[55] = { XmlSchemaDatatype_t322714710::get_offset_of_WhitespaceValue_0(), XmlSchemaDatatype_t322714710_StaticFields::get_offset_of_wsChars_1(), XmlSchemaDatatype_t322714710::get_offset_of_sb_2(), XmlSchemaDatatype_t322714710_StaticFields::get_offset_of_datatypeAnySimpleType_3(), XmlSchemaDatatype_t322714710_StaticFields::get_offset_of_datatypeString_4(), XmlSchemaDatatype_t322714710_StaticFields::get_offset_of_datatypeNormalizedString_5(), XmlSchemaDatatype_t322714710_StaticFields::get_offset_of_datatypeToken_6(), XmlSchemaDatatype_t322714710_StaticFields::get_offset_of_datatypeLanguage_7(), XmlSchemaDatatype_t322714710_StaticFields::get_offset_of_datatypeNMToken_8(), XmlSchemaDatatype_t322714710_StaticFields::get_offset_of_datatypeNMTokens_9(), XmlSchemaDatatype_t322714710_StaticFields::get_offset_of_datatypeName_10(), XmlSchemaDatatype_t322714710_StaticFields::get_offset_of_datatypeNCName_11(), XmlSchemaDatatype_t322714710_StaticFields::get_offset_of_datatypeID_12(), XmlSchemaDatatype_t322714710_StaticFields::get_offset_of_datatypeIDRef_13(), XmlSchemaDatatype_t322714710_StaticFields::get_offset_of_datatypeIDRefs_14(), XmlSchemaDatatype_t322714710_StaticFields::get_offset_of_datatypeEntity_15(), XmlSchemaDatatype_t322714710_StaticFields::get_offset_of_datatypeEntities_16(), XmlSchemaDatatype_t322714710_StaticFields::get_offset_of_datatypeNotation_17(), XmlSchemaDatatype_t322714710_StaticFields::get_offset_of_datatypeDecimal_18(), XmlSchemaDatatype_t322714710_StaticFields::get_offset_of_datatypeInteger_19(), XmlSchemaDatatype_t322714710_StaticFields::get_offset_of_datatypeLong_20(), XmlSchemaDatatype_t322714710_StaticFields::get_offset_of_datatypeInt_21(), XmlSchemaDatatype_t322714710_StaticFields::get_offset_of_datatypeShort_22(), XmlSchemaDatatype_t322714710_StaticFields::get_offset_of_datatypeByte_23(), XmlSchemaDatatype_t322714710_StaticFields::get_offset_of_datatypeNonNegativeInteger_24(), XmlSchemaDatatype_t322714710_StaticFields::get_offset_of_datatypePositiveInteger_25(), XmlSchemaDatatype_t322714710_StaticFields::get_offset_of_datatypeUnsignedLong_26(), XmlSchemaDatatype_t322714710_StaticFields::get_offset_of_datatypeUnsignedInt_27(), XmlSchemaDatatype_t322714710_StaticFields::get_offset_of_datatypeUnsignedShort_28(), XmlSchemaDatatype_t322714710_StaticFields::get_offset_of_datatypeUnsignedByte_29(), XmlSchemaDatatype_t322714710_StaticFields::get_offset_of_datatypeNonPositiveInteger_30(), XmlSchemaDatatype_t322714710_StaticFields::get_offset_of_datatypeNegativeInteger_31(), XmlSchemaDatatype_t322714710_StaticFields::get_offset_of_datatypeFloat_32(), XmlSchemaDatatype_t322714710_StaticFields::get_offset_of_datatypeDouble_33(), XmlSchemaDatatype_t322714710_StaticFields::get_offset_of_datatypeBase64Binary_34(), XmlSchemaDatatype_t322714710_StaticFields::get_offset_of_datatypeBoolean_35(), XmlSchemaDatatype_t322714710_StaticFields::get_offset_of_datatypeAnyURI_36(), XmlSchemaDatatype_t322714710_StaticFields::get_offset_of_datatypeDuration_37(), XmlSchemaDatatype_t322714710_StaticFields::get_offset_of_datatypeDateTime_38(), XmlSchemaDatatype_t322714710_StaticFields::get_offset_of_datatypeDate_39(), XmlSchemaDatatype_t322714710_StaticFields::get_offset_of_datatypeTime_40(), XmlSchemaDatatype_t322714710_StaticFields::get_offset_of_datatypeHexBinary_41(), XmlSchemaDatatype_t322714710_StaticFields::get_offset_of_datatypeQName_42(), XmlSchemaDatatype_t322714710_StaticFields::get_offset_of_datatypeGYearMonth_43(), XmlSchemaDatatype_t322714710_StaticFields::get_offset_of_datatypeGMonthDay_44(), XmlSchemaDatatype_t322714710_StaticFields::get_offset_of_datatypeGYear_45(), XmlSchemaDatatype_t322714710_StaticFields::get_offset_of_datatypeGMonth_46(), XmlSchemaDatatype_t322714710_StaticFields::get_offset_of_datatypeGDay_47(), XmlSchemaDatatype_t322714710_StaticFields::get_offset_of_datatypeAnyAtomicType_48(), XmlSchemaDatatype_t322714710_StaticFields::get_offset_of_datatypeUntypedAtomic_49(), XmlSchemaDatatype_t322714710_StaticFields::get_offset_of_datatypeDayTimeDuration_50(), XmlSchemaDatatype_t322714710_StaticFields::get_offset_of_datatypeYearMonthDuration_51(), XmlSchemaDatatype_t322714710_StaticFields::get_offset_of_U3CU3Ef__switchU24map3E_52(), XmlSchemaDatatype_t322714710_StaticFields::get_offset_of_U3CU3Ef__switchU24map3F_53(), XmlSchemaDatatype_t322714710_StaticFields::get_offset_of_U3CU3Ef__switchU24map40_54(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1307 = { sizeof (XmlSchemaDerivationMethod_t1774354337)+ sizeof (RuntimeObject), sizeof(int32_t), 0, 0 }; extern const int32_t g_FieldOffsetTable1307[9] = { XmlSchemaDerivationMethod_t1774354337::get_offset_of_value___1() + static_cast<int32_t>(sizeof(RuntimeObject)), 0, 0, 0, 0, 0, 0, 0, 0, }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1308 = { sizeof (XmlSchemaDocumentation_t1182960532), -1, 0, 0 }; extern const int32_t g_FieldOffsetTable1308[3] = { XmlSchemaDocumentation_t1182960532::get_offset_of_language_13(), XmlSchemaDocumentation_t1182960532::get_offset_of_markup_14(), XmlSchemaDocumentation_t1182960532::get_offset_of_source_15(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1309 = { sizeof (XmlSchemaElement_t427880856), -1, 0, 0 }; extern const int32_t g_FieldOffsetTable1309[27] = { XmlSchemaElement_t427880856::get_offset_of_block_27(), XmlSchemaElement_t427880856::get_offset_of_constraints_28(), XmlSchemaElement_t427880856::get_offset_of_defaultValue_29(), XmlSchemaElement_t427880856::get_offset_of_elementType_30(), XmlSchemaElement_t427880856::get_offset_of_elementSchemaType_31(), XmlSchemaElement_t427880856::get_offset_of_final_32(), XmlSchemaElement_t427880856::get_offset_of_fixedValue_33(), XmlSchemaElement_t427880856::get_offset_of_form_34(), XmlSchemaElement_t427880856::get_offset_of_isAbstract_35(), XmlSchemaElement_t427880856::get_offset_of_isNillable_36(), XmlSchemaElement_t427880856::get_offset_of_name_37(), XmlSchemaElement_t427880856::get_offset_of_refName_38(), XmlSchemaElement_t427880856::get_offset_of_schemaType_39(), XmlSchemaElement_t427880856::get_offset_of_schemaTypeName_40(), XmlSchemaElement_t427880856::get_offset_of_substitutionGroup_41(), XmlSchemaElement_t427880856::get_offset_of_schema_42(), XmlSchemaElement_t427880856::get_offset_of_parentIsSchema_43(), XmlSchemaElement_t427880856::get_offset_of_qName_44(), XmlSchemaElement_t427880856::get_offset_of_blockResolved_45(), XmlSchemaElement_t427880856::get_offset_of_finalResolved_46(), XmlSchemaElement_t427880856::get_offset_of_referencedElement_47(), XmlSchemaElement_t427880856::get_offset_of_substitutingElements_48(), XmlSchemaElement_t427880856::get_offset_of_substitutionGroupElement_49(), XmlSchemaElement_t427880856::get_offset_of_actualIsAbstract_50(), XmlSchemaElement_t427880856::get_offset_of_actualIsNillable_51(), XmlSchemaElement_t427880856::get_offset_of_validatedDefaultValue_52(), XmlSchemaElement_t427880856::get_offset_of_validatedFixedValue_53(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1310 = { sizeof (XmlSchemaEnumerationFacet_t2156689038), -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1311 = { sizeof (XmlSchemaException_t3511258692), -1, 0, 0 }; extern const int32_t g_FieldOffsetTable1311[5] = { XmlSchemaException_t3511258692::get_offset_of_hasLineInfo_11(), XmlSchemaException_t3511258692::get_offset_of_lineNumber_12(), XmlSchemaException_t3511258692::get_offset_of_linePosition_13(), XmlSchemaException_t3511258692::get_offset_of_sourceObj_14(), XmlSchemaException_t3511258692::get_offset_of_sourceUri_15(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1312 = { sizeof (XmlSchemaExternal_t3074890143), -1, 0, 0 }; extern const int32_t g_FieldOffsetTable1312[3] = { XmlSchemaExternal_t3074890143::get_offset_of_id_13(), XmlSchemaExternal_t3074890143::get_offset_of_schema_14(), XmlSchemaExternal_t3074890143::get_offset_of_location_15(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1313 = { sizeof (XmlSchemaFacet_t1906017689), -1, sizeof(XmlSchemaFacet_t1906017689_StaticFields), 0 }; extern const int32_t g_FieldOffsetTable1313[3] = { XmlSchemaFacet_t1906017689_StaticFields::get_offset_of_AllFacets_16(), XmlSchemaFacet_t1906017689::get_offset_of_isFixed_17(), XmlSchemaFacet_t1906017689::get_offset_of_val_18(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1314 = { sizeof (Facet_t1501039206)+ sizeof (RuntimeObject), sizeof(int32_t), 0, 0 }; extern const int32_t g_FieldOffsetTable1314[14] = { Facet_t1501039206::get_offset_of_value___1() + static_cast<int32_t>(sizeof(RuntimeObject)), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1315 = { sizeof (XmlSchemaForm_t4264307319)+ sizeof (RuntimeObject), sizeof(int32_t), 0, 0 }; extern const int32_t g_FieldOffsetTable1315[4] = { XmlSchemaForm_t4264307319::get_offset_of_value___1() + static_cast<int32_t>(sizeof(RuntimeObject)), 0, 0, 0, }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1316 = { sizeof (XmlSchemaFractionDigitsFacet_t2589598443), -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1317 = { sizeof (XmlSchemaGroup_t1441741786), -1, 0, 0 }; extern const int32_t g_FieldOffsetTable1317[4] = { XmlSchemaGroup_t1441741786::get_offset_of_name_16(), XmlSchemaGroup_t1441741786::get_offset_of_particle_17(), XmlSchemaGroup_t1441741786::get_offset_of_qualifiedName_18(), XmlSchemaGroup_t1441741786::get_offset_of_isCircularDefinition_19(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1318 = { sizeof (XmlSchemaGroupBase_t3631079376), -1, 0, 0 }; extern const int32_t g_FieldOffsetTable1318[1] = { XmlSchemaGroupBase_t3631079376::get_offset_of_compiledItems_27(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1319 = { sizeof (XmlSchemaGroupRef_t1314446647), -1, 0, 0 }; extern const int32_t g_FieldOffsetTable1319[4] = { XmlSchemaGroupRef_t1314446647::get_offset_of_schema_27(), XmlSchemaGroupRef_t1314446647::get_offset_of_refName_28(), XmlSchemaGroupRef_t1314446647::get_offset_of_referencedGroup_29(), XmlSchemaGroupRef_t1314446647::get_offset_of_busy_30(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1320 = { sizeof (XmlSchemaIdentityConstraint_t297318432), -1, 0, 0 }; extern const int32_t g_FieldOffsetTable1320[5] = { XmlSchemaIdentityConstraint_t297318432::get_offset_of_fields_16(), XmlSchemaIdentityConstraint_t297318432::get_offset_of_name_17(), XmlSchemaIdentityConstraint_t297318432::get_offset_of_qName_18(), XmlSchemaIdentityConstraint_t297318432::get_offset_of_selector_19(), XmlSchemaIdentityConstraint_t297318432::get_offset_of_compiledSelector_20(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1321 = { sizeof (XmlSchemaImport_t3509836441), -1, 0, 0 }; extern const int32_t g_FieldOffsetTable1321[2] = { XmlSchemaImport_t3509836441::get_offset_of_annotation_16(), XmlSchemaImport_t3509836441::get_offset_of_nameSpace_17(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1322 = { sizeof (XmlSchemaInclude_t2307352039), -1, 0, 0 }; extern const int32_t g_FieldOffsetTable1322[1] = { XmlSchemaInclude_t2307352039::get_offset_of_annotation_16(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1323 = { sizeof (XmlSchemaInfo_t997462956), -1, 0, 0 }; extern const int32_t g_FieldOffsetTable1323[7] = { XmlSchemaInfo_t997462956::get_offset_of_isDefault_0(), XmlSchemaInfo_t997462956::get_offset_of_isNil_1(), XmlSchemaInfo_t997462956::get_offset_of_memberType_2(), XmlSchemaInfo_t997462956::get_offset_of_attr_3(), XmlSchemaInfo_t997462956::get_offset_of_elem_4(), XmlSchemaInfo_t997462956::get_offset_of_type_5(), XmlSchemaInfo_t997462956::get_offset_of_validity_6(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1324 = { sizeof (XmlSchemaKey_t3030860318), -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1325 = { sizeof (XmlSchemaKeyref_t3124006214), -1, 0, 0 }; extern const int32_t g_FieldOffsetTable1325[2] = { XmlSchemaKeyref_t3124006214::get_offset_of_refer_21(), XmlSchemaKeyref_t3124006214::get_offset_of_target_22(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1326 = { sizeof (XmlSchemaLengthFacet_t4286280832), -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1327 = { sizeof (XmlSchemaMaxExclusiveFacet_t786951263), -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1328 = { sizeof (XmlSchemaMaxInclusiveFacet_t719708644), -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1329 = { sizeof (XmlSchemaMaxLengthFacet_t2192171319), -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1330 = { sizeof (XmlSchemaMinExclusiveFacet_t85871952), -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1331 = { sizeof (XmlSchemaMinInclusiveFacet_t18629333), -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1332 = { sizeof (XmlSchemaMinLengthFacet_t686585762), -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1333 = { sizeof (XmlSchemaNotation_t2664560277), -1, 0, 0 }; extern const int32_t g_FieldOffsetTable1333[4] = { XmlSchemaNotation_t2664560277::get_offset_of_name_16(), XmlSchemaNotation_t2664560277::get_offset_of_pub_17(), XmlSchemaNotation_t2664560277::get_offset_of_system_18(), XmlSchemaNotation_t2664560277::get_offset_of_qualifiedName_19(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1334 = { sizeof (XmlSchemaNumericFacet_t3753040035), -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1335 = { sizeof (XmlSchemaObject_t1315720168), -1, 0, 0 }; extern const int32_t g_FieldOffsetTable1335[13] = { XmlSchemaObject_t1315720168::get_offset_of_lineNumber_0(), XmlSchemaObject_t1315720168::get_offset_of_linePosition_1(), XmlSchemaObject_t1315720168::get_offset_of_sourceUri_2(), XmlSchemaObject_t1315720168::get_offset_of_namespaces_3(), XmlSchemaObject_t1315720168::get_offset_of_unhandledAttributeList_4(), XmlSchemaObject_t1315720168::get_offset_of_isCompiled_5(), XmlSchemaObject_t1315720168::get_offset_of_errorCount_6(), XmlSchemaObject_t1315720168::get_offset_of_CompilationId_7(), XmlSchemaObject_t1315720168::get_offset_of_ValidationId_8(), XmlSchemaObject_t1315720168::get_offset_of_isRedefineChild_9(), XmlSchemaObject_t1315720168::get_offset_of_isRedefinedComponent_10(), XmlSchemaObject_t1315720168::get_offset_of_redefinedObject_11(), XmlSchemaObject_t1315720168::get_offset_of_parent_12(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1336 = { sizeof (XmlSchemaObjectCollection_t1064819932), -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1337 = { sizeof (XmlSchemaObjectEnumerator_t503074204), -1, 0, 0 }; extern const int32_t g_FieldOffsetTable1337[1] = { XmlSchemaObjectEnumerator_t503074204::get_offset_of_ienum_0(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1338 = { sizeof (XmlSchemaObjectTable_t2546974348), -1, 0, 0 }; extern const int32_t g_FieldOffsetTable1338[1] = { XmlSchemaObjectTable_t2546974348::get_offset_of_table_0(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1339 = { sizeof (XmlSchemaObjectTableEnumerator_t1321079153), -1, 0, 0 }; extern const int32_t g_FieldOffsetTable1339[2] = { XmlSchemaObjectTableEnumerator_t1321079153::get_offset_of_xenum_0(), XmlSchemaObjectTableEnumerator_t1321079153::get_offset_of_tmp_1(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1340 = { sizeof (XmlSchemaParticle_t3828501457), -1, sizeof(XmlSchemaParticle_t3828501457_StaticFields), 0 }; extern const int32_t g_FieldOffsetTable1340[11] = { XmlSchemaParticle_t3828501457::get_offset_of_minOccurs_16(), XmlSchemaParticle_t3828501457::get_offset_of_maxOccurs_17(), XmlSchemaParticle_t3828501457::get_offset_of_minstr_18(), XmlSchemaParticle_t3828501457::get_offset_of_maxstr_19(), XmlSchemaParticle_t3828501457_StaticFields::get_offset_of_empty_20(), XmlSchemaParticle_t3828501457::get_offset_of_validatedMinOccurs_21(), XmlSchemaParticle_t3828501457::get_offset_of_validatedMaxOccurs_22(), XmlSchemaParticle_t3828501457::get_offset_of_recursionDepth_23(), XmlSchemaParticle_t3828501457::get_offset_of_minEffectiveTotalRange_24(), XmlSchemaParticle_t3828501457::get_offset_of_parentIsGroupDefinition_25(), XmlSchemaParticle_t3828501457::get_offset_of_OptimizedParticle_26(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1341 = { sizeof (EmptyParticle_t2028271315), -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1342 = { sizeof (XmlSchemaPatternFacet_t3316004401), -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1343 = { sizeof (XmlSchemaRedefine_t4020109446), -1, 0, 0 }; extern const int32_t g_FieldOffsetTable1343[4] = { XmlSchemaRedefine_t4020109446::get_offset_of_attributeGroups_16(), XmlSchemaRedefine_t4020109446::get_offset_of_groups_17(), XmlSchemaRedefine_t4020109446::get_offset_of_items_18(), XmlSchemaRedefine_t4020109446::get_offset_of_schemaTypes_19(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1344 = { sizeof (XmlSchemaSet_t266093086), -1, 0, 0 }; extern const int32_t g_FieldOffsetTable1344[12] = { XmlSchemaSet_t266093086::get_offset_of_nameTable_0(), XmlSchemaSet_t266093086::get_offset_of_xmlResolver_1(), XmlSchemaSet_t266093086::get_offset_of_schemas_2(), XmlSchemaSet_t266093086::get_offset_of_attributes_3(), XmlSchemaSet_t266093086::get_offset_of_elements_4(), XmlSchemaSet_t266093086::get_offset_of_types_5(), XmlSchemaSet_t266093086::get_offset_of_idCollection_6(), XmlSchemaSet_t266093086::get_offset_of_namedIdentities_7(), XmlSchemaSet_t266093086::get_offset_of_settings_8(), XmlSchemaSet_t266093086::get_offset_of_isCompiled_9(), XmlSchemaSet_t266093086::get_offset_of_CompilationId_10(), XmlSchemaSet_t266093086::get_offset_of_ValidationEventHandler_11(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1345 = { sizeof (XmlSchemaSequence_t2018345177), -1, 0, 0 }; extern const int32_t g_FieldOffsetTable1345[1] = { XmlSchemaSequence_t2018345177::get_offset_of_items_28(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1346 = { sizeof (XmlSchemaSimpleContent_t4264369274), -1, 0, 0 }; extern const int32_t g_FieldOffsetTable1346[1] = { XmlSchemaSimpleContent_t4264369274::get_offset_of_content_16(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1347 = { sizeof (XmlSchemaSimpleContentExtension_t1269327470), -1, 0, 0 }; extern const int32_t g_FieldOffsetTable1347[3] = { XmlSchemaSimpleContentExtension_t1269327470::get_offset_of_any_17(), XmlSchemaSimpleContentExtension_t1269327470::get_offset_of_attributes_18(), XmlSchemaSimpleContentExtension_t1269327470::get_offset_of_baseTypeName_19(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1348 = { sizeof (XmlSchemaSimpleContentRestriction_t2746076865), -1, 0, 0 }; extern const int32_t g_FieldOffsetTable1348[5] = { XmlSchemaSimpleContentRestriction_t2746076865::get_offset_of_any_17(), XmlSchemaSimpleContentRestriction_t2746076865::get_offset_of_attributes_18(), XmlSchemaSimpleContentRestriction_t2746076865::get_offset_of_baseType_19(), XmlSchemaSimpleContentRestriction_t2746076865::get_offset_of_baseTypeName_20(), XmlSchemaSimpleContentRestriction_t2746076865::get_offset_of_facets_21(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1349 = { sizeof (XmlSchemaSimpleType_t2678868104), -1, sizeof(XmlSchemaSimpleType_t2678868104_StaticFields), 0 }; extern const int32_t g_FieldOffsetTable1349[54] = { XmlSchemaSimpleType_t2678868104_StaticFields::get_offset_of_schemaLocationType_28(), XmlSchemaSimpleType_t2678868104::get_offset_of_content_29(), XmlSchemaSimpleType_t2678868104::get_offset_of_islocal_30(), XmlSchemaSimpleType_t2678868104::get_offset_of_recursed_31(), XmlSchemaSimpleType_t2678868104::get_offset_of_variety_32(), XmlSchemaSimpleType_t2678868104_StaticFields::get_offset_of_XsAnySimpleType_33(), XmlSchemaSimpleType_t2678868104_StaticFields::get_offset_of_XsString_34(), XmlSchemaSimpleType_t2678868104_StaticFields::get_offset_of_XsBoolean_35(), XmlSchemaSimpleType_t2678868104_StaticFields::get_offset_of_XsDecimal_36(), XmlSchemaSimpleType_t2678868104_StaticFields::get_offset_of_XsFloat_37(), XmlSchemaSimpleType_t2678868104_StaticFields::get_offset_of_XsDouble_38(), XmlSchemaSimpleType_t2678868104_StaticFields::get_offset_of_XsDuration_39(), XmlSchemaSimpleType_t2678868104_StaticFields::get_offset_of_XsDateTime_40(), XmlSchemaSimpleType_t2678868104_StaticFields::get_offset_of_XsTime_41(), XmlSchemaSimpleType_t2678868104_StaticFields::get_offset_of_XsDate_42(), XmlSchemaSimpleType_t2678868104_StaticFields::get_offset_of_XsGYearMonth_43(), XmlSchemaSimpleType_t2678868104_StaticFields::get_offset_of_XsGYear_44(), XmlSchemaSimpleType_t2678868104_StaticFields::get_offset_of_XsGMonthDay_45(), XmlSchemaSimpleType_t2678868104_StaticFields::get_offset_of_XsGDay_46(), XmlSchemaSimpleType_t2678868104_StaticFields::get_offset_of_XsGMonth_47(), XmlSchemaSimpleType_t2678868104_StaticFields::get_offset_of_XsHexBinary_48(), XmlSchemaSimpleType_t2678868104_StaticFields::get_offset_of_XsBase64Binary_49(), XmlSchemaSimpleType_t2678868104_StaticFields::get_offset_of_XsAnyUri_50(), XmlSchemaSimpleType_t2678868104_StaticFields::get_offset_of_XsQName_51(), XmlSchemaSimpleType_t2678868104_StaticFields::get_offset_of_XsNotation_52(), XmlSchemaSimpleType_t2678868104_StaticFields::get_offset_of_XsNormalizedString_53(), XmlSchemaSimpleType_t2678868104_StaticFields::get_offset_of_XsToken_54(), XmlSchemaSimpleType_t2678868104_StaticFields::get_offset_of_XsLanguage_55(), XmlSchemaSimpleType_t2678868104_StaticFields::get_offset_of_XsNMToken_56(), XmlSchemaSimpleType_t2678868104_StaticFields::get_offset_of_XsNMTokens_57(), XmlSchemaSimpleType_t2678868104_StaticFields::get_offset_of_XsName_58(), XmlSchemaSimpleType_t2678868104_StaticFields::get_offset_of_XsNCName_59(), XmlSchemaSimpleType_t2678868104_StaticFields::get_offset_of_XsID_60(), XmlSchemaSimpleType_t2678868104_StaticFields::get_offset_of_XsIDRef_61(), XmlSchemaSimpleType_t2678868104_StaticFields::get_offset_of_XsIDRefs_62(), XmlSchemaSimpleType_t2678868104_StaticFields::get_offset_of_XsEntity_63(), XmlSchemaSimpleType_t2678868104_StaticFields::get_offset_of_XsEntities_64(), XmlSchemaSimpleType_t2678868104_StaticFields::get_offset_of_XsInteger_65(), XmlSchemaSimpleType_t2678868104_StaticFields::get_offset_of_XsNonPositiveInteger_66(), XmlSchemaSimpleType_t2678868104_StaticFields::get_offset_of_XsNegativeInteger_67(), XmlSchemaSimpleType_t2678868104_StaticFields::get_offset_of_XsLong_68(), XmlSchemaSimpleType_t2678868104_StaticFields::get_offset_of_XsInt_69(), XmlSchemaSimpleType_t2678868104_StaticFields::get_offset_of_XsShort_70(), XmlSchemaSimpleType_t2678868104_StaticFields::get_offset_of_XsByte_71(), XmlSchemaSimpleType_t2678868104_StaticFields::get_offset_of_XsNonNegativeInteger_72(), XmlSchemaSimpleType_t2678868104_StaticFields::get_offset_of_XsUnsignedLong_73(), XmlSchemaSimpleType_t2678868104_StaticFields::get_offset_of_XsUnsignedInt_74(), XmlSchemaSimpleType_t2678868104_StaticFields::get_offset_of_XsUnsignedShort_75(), XmlSchemaSimpleType_t2678868104_StaticFields::get_offset_of_XsUnsignedByte_76(), XmlSchemaSimpleType_t2678868104_StaticFields::get_offset_of_XsPositiveInteger_77(), XmlSchemaSimpleType_t2678868104_StaticFields::get_offset_of_XdtUntypedAtomic_78(), XmlSchemaSimpleType_t2678868104_StaticFields::get_offset_of_XdtAnyAtomicType_79(), XmlSchemaSimpleType_t2678868104_StaticFields::get_offset_of_XdtYearMonthDuration_80(), XmlSchemaSimpleType_t2678868104_StaticFields::get_offset_of_XdtDayTimeDuration_81(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1350 = { sizeof (XmlSchemaSimpleTypeContent_t599285223), -1, 0, 0 }; extern const int32_t g_FieldOffsetTable1350[1] = { XmlSchemaSimpleTypeContent_t599285223::get_offset_of_OwnerType_16(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1351 = { sizeof (XmlSchemaSimpleTypeList_t472803608), -1, 0, 0 }; extern const int32_t g_FieldOffsetTable1351[4] = { XmlSchemaSimpleTypeList_t472803608::get_offset_of_itemType_17(), XmlSchemaSimpleTypeList_t472803608::get_offset_of_itemTypeName_18(), XmlSchemaSimpleTypeList_t472803608::get_offset_of_validatedListItemType_19(), XmlSchemaSimpleTypeList_t472803608::get_offset_of_validatedListItemSchemaType_20(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1352 = { sizeof (XmlSchemaSimpleTypeRestriction_t3925451115), -1, sizeof(XmlSchemaSimpleTypeRestriction_t3925451115_StaticFields), 0 }; extern const int32_t g_FieldOffsetTable1352[18] = { XmlSchemaSimpleTypeRestriction_t3925451115::get_offset_of_baseType_17(), XmlSchemaSimpleTypeRestriction_t3925451115::get_offset_of_baseTypeName_18(), XmlSchemaSimpleTypeRestriction_t3925451115::get_offset_of_facets_19(), XmlSchemaSimpleTypeRestriction_t3925451115::get_offset_of_enumarationFacetValues_20(), XmlSchemaSimpleTypeRestriction_t3925451115::get_offset_of_patternFacetValues_21(), XmlSchemaSimpleTypeRestriction_t3925451115::get_offset_of_rexPatterns_22(), XmlSchemaSimpleTypeRestriction_t3925451115::get_offset_of_lengthFacet_23(), XmlSchemaSimpleTypeRestriction_t3925451115::get_offset_of_maxLengthFacet_24(), XmlSchemaSimpleTypeRestriction_t3925451115::get_offset_of_minLengthFacet_25(), XmlSchemaSimpleTypeRestriction_t3925451115::get_offset_of_fractionDigitsFacet_26(), XmlSchemaSimpleTypeRestriction_t3925451115::get_offset_of_totalDigitsFacet_27(), XmlSchemaSimpleTypeRestriction_t3925451115::get_offset_of_maxInclusiveFacet_28(), XmlSchemaSimpleTypeRestriction_t3925451115::get_offset_of_maxExclusiveFacet_29(), XmlSchemaSimpleTypeRestriction_t3925451115::get_offset_of_minInclusiveFacet_30(), XmlSchemaSimpleTypeRestriction_t3925451115::get_offset_of_minExclusiveFacet_31(), XmlSchemaSimpleTypeRestriction_t3925451115::get_offset_of_fixedFacets_32(), XmlSchemaSimpleTypeRestriction_t3925451115_StaticFields::get_offset_of_lengthStyle_33(), XmlSchemaSimpleTypeRestriction_t3925451115_StaticFields::get_offset_of_listFacets_34(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1353 = { sizeof (XmlSchemaSimpleTypeUnion_t4071426880), -1, 0, 0 }; extern const int32_t g_FieldOffsetTable1353[4] = { XmlSchemaSimpleTypeUnion_t4071426880::get_offset_of_baseTypes_17(), XmlSchemaSimpleTypeUnion_t4071426880::get_offset_of_memberTypes_18(), XmlSchemaSimpleTypeUnion_t4071426880::get_offset_of_validatedTypes_19(), XmlSchemaSimpleTypeUnion_t4071426880::get_offset_of_validatedSchemaTypes_20(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1354 = { sizeof (XmlSchemaTotalDigitsFacet_t297930215), -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1355 = { sizeof (XmlSchemaType_t2033747345), -1, sizeof(XmlSchemaType_t2033747345_StaticFields), 0 }; extern const int32_t g_FieldOffsetTable1355[12] = { XmlSchemaType_t2033747345::get_offset_of_final_16(), XmlSchemaType_t2033747345::get_offset_of_isMixed_17(), XmlSchemaType_t2033747345::get_offset_of_name_18(), XmlSchemaType_t2033747345::get_offset_of_recursed_19(), XmlSchemaType_t2033747345::get_offset_of_BaseSchemaTypeName_20(), XmlSchemaType_t2033747345::get_offset_of_BaseXmlSchemaTypeInternal_21(), XmlSchemaType_t2033747345::get_offset_of_DatatypeInternal_22(), XmlSchemaType_t2033747345::get_offset_of_resolvedDerivedBy_23(), XmlSchemaType_t2033747345::get_offset_of_finalResolved_24(), XmlSchemaType_t2033747345::get_offset_of_QNameInternal_25(), XmlSchemaType_t2033747345_StaticFields::get_offset_of_U3CU3Ef__switchU24map42_26(), XmlSchemaType_t2033747345_StaticFields::get_offset_of_U3CU3Ef__switchU24map43_27(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1356 = { sizeof (XmlSchemaUnique_t2867867737), -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1357 = { sizeof (XmlSchemaUse_t647315988)+ sizeof (RuntimeObject), sizeof(int32_t), 0, 0 }; extern const int32_t g_FieldOffsetTable1357[5] = { XmlSchemaUse_t647315988::get_offset_of_value___1() + static_cast<int32_t>(sizeof(RuntimeObject)), 0, 0, 0, 0, }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1358 = { sizeof (XmlSchemaValidity_t3794542157)+ sizeof (RuntimeObject), sizeof(int32_t), 0, 0 }; extern const int32_t g_FieldOffsetTable1358[4] = { XmlSchemaValidity_t3794542157::get_offset_of_value___1() + static_cast<int32_t>(sizeof(RuntimeObject)), 0, 0, 0, }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1359 = { sizeof (XmlSchemaValidationException_t816160496), -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1360 = { sizeof (XmlSchemaWhiteSpaceFacet_t4158372164), -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1361 = { sizeof (XmlSchemaXPath_t3156455507), -1, sizeof(XmlSchemaXPath_t3156455507_StaticFields), 0 }; extern const int32_t g_FieldOffsetTable1361[6] = { XmlSchemaXPath_t3156455507::get_offset_of_xpath_16(), XmlSchemaXPath_t3156455507::get_offset_of_nsmgr_17(), XmlSchemaXPath_t3156455507::get_offset_of_isSelector_18(), XmlSchemaXPath_t3156455507::get_offset_of_compiledExpression_19(), XmlSchemaXPath_t3156455507::get_offset_of_currentPath_20(), XmlSchemaXPath_t3156455507_StaticFields::get_offset_of_U3CU3Ef__switchU24map4A_21(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1362 = { sizeof (XmlSeverityType_t1894651412)+ sizeof (RuntimeObject), sizeof(int32_t), 0, 0 }; extern const int32_t g_FieldOffsetTable1362[3] = { XmlSeverityType_t1894651412::get_offset_of_value___1() + static_cast<int32_t>(sizeof(RuntimeObject)), 0, 0, }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1363 = { sizeof (ValidationHandler_t3551360050), -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1364 = { sizeof (XmlSchemaUtil_t956145399), -1, sizeof(XmlSchemaUtil_t956145399_StaticFields), 0 }; extern const int32_t g_FieldOffsetTable1364[10] = { XmlSchemaUtil_t956145399_StaticFields::get_offset_of_FinalAllowed_0(), XmlSchemaUtil_t956145399_StaticFields::get_offset_of_ElementBlockAllowed_1(), XmlSchemaUtil_t956145399_StaticFields::get_offset_of_ComplexTypeBlockAllowed_2(), XmlSchemaUtil_t956145399_StaticFields::get_offset_of_StrictMsCompliant_3(), XmlSchemaUtil_t956145399_StaticFields::get_offset_of_U3CU3Ef__switchU24map4B_4(), XmlSchemaUtil_t956145399_StaticFields::get_offset_of_U3CU3Ef__switchU24map4C_5(), XmlSchemaUtil_t956145399_StaticFields::get_offset_of_U3CU3Ef__switchU24map4D_6(), XmlSchemaUtil_t956145399_StaticFields::get_offset_of_U3CU3Ef__switchU24map4E_7(), XmlSchemaUtil_t956145399_StaticFields::get_offset_of_U3CU3Ef__switchU24map4F_8(), XmlSchemaUtil_t956145399_StaticFields::get_offset_of_U3CU3Ef__switchU24map50_9(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1365 = { sizeof (XmlSchemaReader_t1164558392), -1, 0, 0 }; extern const int32_t g_FieldOffsetTable1365[3] = { XmlSchemaReader_t1164558392::get_offset_of_reader_2(), XmlSchemaReader_t1164558392::get_offset_of_handler_3(), XmlSchemaReader_t1164558392::get_offset_of_hasLineInfo_4(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1366 = { sizeof (XmlSchemaValidationFlags_t877176585)+ sizeof (RuntimeObject), sizeof(int32_t), 0, 0 }; extern const int32_t g_FieldOffsetTable1366[7] = { XmlSchemaValidationFlags_t877176585::get_offset_of_value___1() + static_cast<int32_t>(sizeof(RuntimeObject)), 0, 0, 0, 0, 0, 0, }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1367 = { sizeof (XmlTypeCode_t2623622950)+ sizeof (RuntimeObject), sizeof(int32_t), 0, 0 }; extern const int32_t g_FieldOffsetTable1367[56] = { XmlTypeCode_t2623622950::get_offset_of_value___1() + static_cast<int32_t>(sizeof(RuntimeObject)), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1368 = { sizeof (CodeIdentifier_t2202687290), -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1369 = { 0, -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1370 = { sizeof (SchemaTypes_t1741406581)+ sizeof (RuntimeObject), sizeof(int32_t), 0, 0 }; extern const int32_t g_FieldOffsetTable1370[9] = { SchemaTypes_t1741406581::get_offset_of_value___1() + static_cast<int32_t>(sizeof(RuntimeObject)), 0, 0, 0, 0, 0, 0, 0, 0, }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1371 = { sizeof (TypeData_t476999220), -1, sizeof(TypeData_t476999220_StaticFields), 0 }; extern const int32_t g_FieldOffsetTable1371[12] = { TypeData_t476999220::get_offset_of_type_0(), TypeData_t476999220::get_offset_of_elementName_1(), TypeData_t476999220::get_offset_of_sType_2(), TypeData_t476999220::get_offset_of_listItemType_3(), TypeData_t476999220::get_offset_of_typeName_4(), TypeData_t476999220::get_offset_of_fullTypeName_5(), TypeData_t476999220::get_offset_of_listItemTypeData_6(), TypeData_t476999220::get_offset_of_mappedType_7(), TypeData_t476999220::get_offset_of_facet_8(), TypeData_t476999220::get_offset_of_hasPublicConstructor_9(), TypeData_t476999220::get_offset_of_nullableOverride_10(), TypeData_t476999220_StaticFields::get_offset_of_keywords_11(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1372 = { sizeof (TypeTranslator_t3446962748), -1, sizeof(TypeTranslator_t3446962748_StaticFields), 0 }; extern const int32_t g_FieldOffsetTable1372[4] = { TypeTranslator_t3446962748_StaticFields::get_offset_of_nameCache_0(), TypeTranslator_t3446962748_StaticFields::get_offset_of_primitiveTypes_1(), TypeTranslator_t3446962748_StaticFields::get_offset_of_primitiveArrayTypes_2(), TypeTranslator_t3446962748_StaticFields::get_offset_of_nullableTypes_3(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1373 = { sizeof (XmlAnyAttributeAttribute_t1449326428), -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1374 = { sizeof (XmlAnyElementAttribute_t4038919363), -1, 0, 0 }; extern const int32_t g_FieldOffsetTable1374[1] = { XmlAnyElementAttribute_t4038919363::get_offset_of_order_0(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1375 = { sizeof (XmlAttributeAttribute_t2511360870), -1, 0, 0 }; extern const int32_t g_FieldOffsetTable1375[2] = { XmlAttributeAttribute_t2511360870::get_offset_of_attributeName_0(), XmlAttributeAttribute_t2511360870::get_offset_of_dataType_1(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1376 = { sizeof (XmlElementAttribute_t17472343), -1, 0, 0 }; extern const int32_t g_FieldOffsetTable1376[3] = { XmlElementAttribute_t17472343::get_offset_of_elementName_0(), XmlElementAttribute_t17472343::get_offset_of_type_1(), XmlElementAttribute_t17472343::get_offset_of_order_2(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1377 = { sizeof (XmlEnumAttribute_t106705320), -1, 0, 0 }; extern const int32_t g_FieldOffsetTable1377[1] = { XmlEnumAttribute_t106705320::get_offset_of_name_0(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1378 = { sizeof (XmlIgnoreAttribute_t1428424057), -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1379 = { sizeof (XmlNamespaceDeclarationsAttribute_t966425202), -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1380 = { sizeof (XmlRootAttribute_t2306097217), -1, 0, 0 }; extern const int32_t g_FieldOffsetTable1380[3] = { XmlRootAttribute_t2306097217::get_offset_of_elementName_0(), XmlRootAttribute_t2306097217::get_offset_of_isNullable_1(), XmlRootAttribute_t2306097217::get_offset_of_ns_2(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1381 = { sizeof (XmlSerializerNamespaces_t2702737953), -1, 0, 0 }; extern const int32_t g_FieldOffsetTable1381[1] = { XmlSerializerNamespaces_t2702737953::get_offset_of_namespaces_0(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1382 = { sizeof (XmlTextAttribute_t499390083), -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1383 = { sizeof (XmlNodeChangedEventHandler_t1533444722), sizeof(Il2CppMethodPointer), 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1384 = { sizeof (ValidationEventHandler_t791314227), sizeof(Il2CppMethodPointer), 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1385 = { sizeof (U3CPrivateImplementationDetailsU3E_t3057255362), -1, sizeof(U3CPrivateImplementationDetailsU3E_t3057255362_StaticFields), 0 }; extern const int32_t g_FieldOffsetTable1385[8] = { U3CPrivateImplementationDetailsU3E_t3057255362_StaticFields::get_offset_of_U24U24fieldU2D36_0(), U3CPrivateImplementationDetailsU3E_t3057255362_StaticFields::get_offset_of_U24U24fieldU2D37_1(), U3CPrivateImplementationDetailsU3E_t3057255362_StaticFields::get_offset_of_U24U24fieldU2D38_2(), U3CPrivateImplementationDetailsU3E_t3057255362_StaticFields::get_offset_of_U24U24fieldU2D39_3(), U3CPrivateImplementationDetailsU3E_t3057255362_StaticFields::get_offset_of_U24U24fieldU2D40_4(), U3CPrivateImplementationDetailsU3E_t3057255362_StaticFields::get_offset_of_U24U24fieldU2D41_5(), U3CPrivateImplementationDetailsU3E_t3057255362_StaticFields::get_offset_of_U24U24fieldU2D43_6(), U3CPrivateImplementationDetailsU3E_t3057255362_StaticFields::get_offset_of_U24U24fieldU2D44_7(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1386 = { sizeof (U24ArrayTypeU2412_t2490092597)+ sizeof (RuntimeObject), sizeof(U24ArrayTypeU2412_t2490092597 ), 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1387 = { sizeof (U24ArrayTypeU248_t3244137464)+ sizeof (RuntimeObject), sizeof(U24ArrayTypeU248_t3244137464 ), 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1388 = { sizeof (U24ArrayTypeU24256_t1929481983)+ sizeof (RuntimeObject), sizeof(U24ArrayTypeU24256_t1929481983 ), 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1389 = { sizeof (U24ArrayTypeU241280_t4290130235)+ sizeof (RuntimeObject), sizeof(U24ArrayTypeU241280_t4290130235 ), 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1390 = { sizeof (U3CModuleU3E_t692745527), -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1391 = { sizeof (Locale_t4128636108), -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1392 = { sizeof (BigInteger_t2902905090), -1, sizeof(BigInteger_t2902905090_StaticFields), 0 }; extern const int32_t g_FieldOffsetTable1392[4] = { BigInteger_t2902905090::get_offset_of_length_0(), BigInteger_t2902905090::get_offset_of_data_1(), BigInteger_t2902905090_StaticFields::get_offset_of_smallPrimes_2(), BigInteger_t2902905090_StaticFields::get_offset_of_rng_3(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1393 = { sizeof (Sign_t3338384039)+ sizeof (RuntimeObject), sizeof(int32_t), 0, 0 }; extern const int32_t g_FieldOffsetTable1393[4] = { Sign_t3338384039::get_offset_of_value___1() + static_cast<int32_t>(sizeof(RuntimeObject)), 0, 0, 0, }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1394 = { sizeof (ModulusRing_t596511505), -1, 0, 0 }; extern const int32_t g_FieldOffsetTable1394[2] = { ModulusRing_t596511505::get_offset_of_mod_0(), ModulusRing_t596511505::get_offset_of_constant_1(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1395 = { sizeof (Kernel_t1402667220), -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1396 = { sizeof (ConfidenceFactor_t2516000286)+ sizeof (RuntimeObject), sizeof(int32_t), 0, 0 }; extern const int32_t g_FieldOffsetTable1396[7] = { ConfidenceFactor_t2516000286::get_offset_of_value___1() + static_cast<int32_t>(sizeof(RuntimeObject)), 0, 0, 0, 0, 0, 0, }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1397 = { sizeof (PrimalityTests_t1538473976), -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1398 = { sizeof (PrimeGeneratorBase_t446028867), -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1399 = { sizeof (SequentialSearchPrimeGeneratorBase_t2996090509), -1, 0, 0 }; #ifdef __clang__ #pragma clang diagnostic pop #endif
44.933776
202
0.83165
[ "object" ]
9606209077941717fad2ec152fa905220a026f16
3,924
cpp
C++
pcl-mps/src/mps.cpp
isnow4ever/pcl
4a0f386f652835fca53fa84ad3e8e4ebf8181bb3
[ "MIT" ]
2
2017-08-18T03:03:12.000Z
2019-08-31T09:40:27.000Z
pcl-mps/src/mps.cpp
isnow4ever/pcl
4a0f386f652835fca53fa84ad3e8e4ebf8181bb3
[ "MIT" ]
null
null
null
pcl-mps/src/mps.cpp
isnow4ever/pcl
4a0f386f652835fca53fa84ad3e8e4ebf8181bb3
[ "MIT" ]
null
null
null
#include <Eigen/Core> #include <pcl/point_types.h> #include <pcl/point_cloud.h> #include <pcl/common/time.h> #include <pcl/console/print.h> #include <pcl/features/normal_3d_omp.h> #include <pcl/features/fpfh_omp.h> #include <pcl/filters/filter.h> #include <pcl/filters/voxel_grid.h> #include <pcl/io/pcd_io.h> #include <pcl/io/ply_io.h> #include <pcl/segmentation/organized_multi_plane_segmentation.h> #include <pcl/segmentation/sac_segmentation.h> #include <pcl/visualization/pcl_visualizer.h> // Types typedef pcl::PointXYZ PointT; typedef pcl::PointNormal PointNT; typedef pcl::PointCloud<PointT> PointCloudT; typedef pcl::PointCloud<pcl::Normal> PointCloudN; typedef pcl::FPFHSignature33 FeatureT; typedef pcl::FPFHEstimationOMP<PointNT,PointNT,FeatureT> FeatureEstimationT; typedef pcl::PointCloud<FeatureT> FeatureCloudT; typedef pcl::visualization::PointCloudColorHandlerCustom<PointNT> ColorHandlerT; // Align a rigid object to a scene with clutter and occlusions int main (int argc, char **argv) { // Point clouds PointCloudT::Ptr object (new PointCloudT); PointCloudN::Ptr normals(new PointCloudN); FeatureCloudT::Ptr object_features (new FeatureCloudT); std::string filename; filename = "data/blade_data.ply"; if (!pcl::io::loadPLYFile(filename, *object)) { printf("Cannot open ply file!"); } //VoxelGrid Filter Downsampling pcl::VoxelGrid<PointT> grid; const float leaf = 1.00; grid.setLeafSize(leaf, leaf, leaf); grid.setInputCloud(object); grid.filter(*object); pcl::NormalEstimation<pcl::PointXYZ, pcl::Normal> ne; ne.setInputCloud(object); pcl::search::KdTree<pcl::PointXYZ>::Ptr tree(new pcl::search::KdTree<pcl::PointXYZ>()); ne.setSearchMethod(tree); ne.setRadiusSearch(1); ne.compute(*normals); printf("%d", normals->size()); //pcl::ModelCoefficients::Ptr coefficients(new pcl::ModelCoefficients); //pcl::PointIndices::Ptr inliers(new pcl::PointIndices); pcl::OrganizedMultiPlaneSegmentation<pcl::PointXYZ, pcl::Normal, pcl::Label>mps; mps.setMinInliers(1000); mps.setAngularThreshold(0.017453*2.0); mps.setDistanceThreshold(0.02); mps.setInputNormals(normals); mps.setInputCloud(object); std::vector<pcl::PlanarRegion<PointT>, Eigen::aligned_allocator<pcl::PlanarRegion<PointT> > > regions; //std::vector<pcl::ModelCoefficients> model_coefficients; //std::vector<pcl::PointIndices> inlier_indices; //pcl::PointCloud<pcl::Label>::Ptr labels(new pcl::PointCloud<pcl::Label>); //std::vector<pcl::PointIndices> label_indices; //std::vector<pcl::PointIndices> boundary_indices; mps.segmentAndRefine(regions); printf("%d", regions.size()); boost::shared_ptr<pcl::visualization::PCLVisualizer> mpsvis; char name[1024]; unsigned char red[6] = { 255, 0, 0, 255, 255, 0 }; unsigned char grn[6] = { 0, 255, 0, 255, 0, 255 }; unsigned char blu[6] = { 0, 0, 255, 0, 255, 255 }; pcl::PointCloud<PointT>::Ptr contour(new pcl::PointCloud<PointT>); for (size_t i = 0; i < regions.size(); i++) { Eigen::Vector3f centroid = regions[i].getCentroid(); Eigen::Vector4f model = regions[i].getCoefficients(); pcl::PointXYZ pt1 = pcl::PointXYZ(centroid[0], centroid[1], centroid[2]); pcl::PointXYZ pt2 = pcl::PointXYZ(centroid[0] + (0.5f * model[0]), centroid[1] + (0.5f * model[1]), centroid[2] + (0.5f * model[2])); sprintf(name, "normal_%d", unsigned(i)); mpsvis->addArrow(pt2, pt1, 1.0, 0, 0, false, name); contour->points = regions[i].getContour(); sprintf(name, "plane_%02d", int(i)); pcl::visualization::PointCloudColorHandlerCustom <PointT> color(contour, red[i % 6], grn[i % 6], blu[i % 6]); if (!mpsvis->updatePointCloud(contour, color, name)) mpsvis->addPointCloud(contour, color, name); mpsvis->setPointCloudRenderingProperties(pcl::visualization::PCL_VISUALIZER_POINT_SIZE, 5, name); } mpsvis->spinOnce(); system("pause"); return (0); }
36.333333
112
0.714577
[ "object", "vector", "model" ]
960b8d06577aabd99d516aa84ec2795b80810f0d
2,488
cpp
C++
Observer.cpp
raven91/deformable_cell_model_integration
fa9e31ef42044cb42f534f0be0f20d8ead69c34e
[ "MIT" ]
null
null
null
Observer.cpp
raven91/deformable_cell_model_integration
fa9e31ef42044cb42f534f0be0f20d8ead69c34e
[ "MIT" ]
null
null
null
Observer.cpp
raven91/deformable_cell_model_integration
fa9e31ef42044cb42f534f0be0f20d8ead69c34e
[ "MIT" ]
null
null
null
// // Created by Nikita Kruk on 15.03.21. // #include "Observer.hpp" #include <iostream> #include <sstream> Observer::Observer() { node_file_name_ = "/Users/nikita/Documents/Projects/DeformableCellModel/nodes.txt"; node_file_.open(node_file_name_, std::ios::out | std::ios::trunc); if (!node_file_.is_open()) { std::cerr << "Cannot write to a file" << std::endl; exit(-1); } normal_file_name_ = "/Users/nikita/Documents/Projects/DeformableCellModel/normals.txt"; normal_file_.open(normal_file_name_, std::ios::out | std::ios::trunc); if (!normal_file_.is_open()) { std::cerr << "Cannot write to a file" << std::endl; exit(-1); } } Observer::~Observer() { if (node_file_.is_open()) { node_file_.close(); } if (normal_file_.is_open()) { normal_file_.close(); } } void Observer::SaveNodes(const std::vector<CellMesh> &cell_meshes) { for (int cell_idx = 0; cell_idx < cell_meshes.size(); ++cell_idx) { std::ostringstream output_buffer; for (const VectorType &node : cell_meshes[cell_idx].GetNodes()) { output_buffer << node[0] << '\t' << node[1] << '\t' << node[2] << '\t'; } // node output_buffer << std::endl; node_file_ << output_buffer.str(); } // cell_idx } void Observer::SaveNormalsForNodes(const std::vector<CellMesh> &cell_meshes) { for (int cell_idx = 0; cell_idx < cell_meshes.size(); ++cell_idx) { std::ostringstream output_buffer; for (const VectorType &normal : cell_meshes[cell_idx].GetNormalsForNodes()) { output_buffer << normal[0] << '\t' << normal[1] << '\t' << normal[2] << '\t'; } // normal output_buffer << std::endl; normal_file_ << output_buffer.str(); } // cell_idx } void Observer::SaveFaces(const std::vector<CellMesh> &cell_meshes) { for (int cell_idx = 0; cell_idx < cell_meshes.size(); ++cell_idx) { std::ostringstream output_buffer; for (const FaceType &face : cell_meshes[cell_idx].GetFaces()) { for (int node_index : face) { output_buffer << node_index << '\t'; } // node_index } // face output_buffer << std::endl; std::ofstream faces_file("/Users/nikita/Documents/Projects/DeformableCellModel/faces.txt", std::ios::out | std::ios::trunc); if (!faces_file.is_open()) { std::cerr << "Cannot write to a file" << std::endl; exit(-1); } else { faces_file << output_buffer.str(); } faces_file.close(); } // cell_idx }
25.387755
118
0.628215
[ "vector" ]
960cf22755d50d16dad616e7035099cb63a83db3
1,287
cpp
C++
lab4/geometry/Point.cpp
Adrjanjan/JiMP-Exercises
0c5de5878bcf0ede27fedcdf3cebbe081679e180
[ "MIT" ]
null
null
null
lab4/geometry/Point.cpp
Adrjanjan/JiMP-Exercises
0c5de5878bcf0ede27fedcdf3cebbe081679e180
[ "MIT" ]
null
null
null
lab4/geometry/Point.cpp
Adrjanjan/JiMP-Exercises
0c5de5878bcf0ede27fedcdf3cebbe081679e180
[ "MIT" ]
null
null
null
// // Created by adrja on 02.04.2018. // #include "Point.h" #include "Square.h" #include <cmath> #include <iostream> using ::std::cout; using ::std::endl; using ::std::ostream; namespace geometry { Point::Point() : x_(0), y_(0) { //cout << "Konstruktor bezparametrowy" << endl; } Point::Point(double x, double y) { //cout << "Konstruktor parametrowy" << endl; x_ = x; y_ = y; } Point::~Point() { //cout << "Destruktor! Nic nie robie, bo nie musze zwalniać pamięci! " << x_ << " , " << y_; //cout << endl; } double Point::Distance(const Point &other) const { return sqrt(pow(GetX() - other.GetX(), 2) + pow(GetY() - other.GetY(), 2)); } void Point::ToString(ostream *out) const { (*out) << "(" << GetX() << ";" << GetY() << ")"; } double Point::GetX() const { return this->x_; } double Point::GetY() const { return this->y_; } Point &Point::SetX(double x) { this->x_ = x; return *this; } Point &Point::SetY(double y) { this->y_ = y; return *this; } double Distance(const Point &a, const Point &b) { return sqrt(pow(a.GetX() - b.GetX(), 2) + pow(a.GetY() - b.GetY(), 2)); } }
21.098361
100
0.508936
[ "geometry" ]
9610cc029873627916ea1723690c060639002866
128,538
cpp
C++
DEM/Low/src/Render/D3D11/D3D11GPUDriver.cpp
niello/deusexmachina
2f698054fe82d8b40a0a0e58b86d64ffed0de06c
[ "MIT" ]
15
2019-05-07T11:26:13.000Z
2022-01-12T18:26:45.000Z
DEM/Low/src/Render/D3D11/D3D11GPUDriver.cpp
niello/deusexmachina
2f698054fe82d8b40a0a0e58b86d64ffed0de06c
[ "MIT" ]
16
2021-10-04T17:15:31.000Z
2022-03-20T09:34:29.000Z
DEM/Low/src/Render/D3D11/D3D11GPUDriver.cpp
niello/deusexmachina
2f698054fe82d8b40a0a0e58b86d64ffed0de06c
[ "MIT" ]
2
2019-04-28T23:27:48.000Z
2019-05-07T11:26:18.000Z
#include "D3D11GPUDriver.h" #include <Render/D3D11/D3D11DriverFactory.h> #include <Render/D3D11/D3D11DisplayDriver.h> #include <Render/D3D11/D3D11VertexLayout.h> #include <Render/D3D11/D3D11VertexBuffer.h> #include <Render/D3D11/D3D11IndexBuffer.h> #include <Render/D3D11/D3D11Texture.h> #include <Render/D3D11/D3D11RenderTarget.h> #include <Render/D3D11/D3D11DepthStencilBuffer.h> #include <Render/D3D11/D3D11RenderState.h> #include <Render/D3D11/D3D11ConstantBuffer.h> #include <Render/D3D11/D3D11Sampler.h> #include <Render/D3D11/D3D11Shader.h> #include <Render/D3D11/USMShaderMetadata.h> #include <Render/RenderStateDesc.h> #include <Render/SamplerDesc.h> #include <Render/TextureData.h> #include <Render/ImageUtils.h> #include <Events/EventServer.h> #include <System/Win32/OSWindowWin32.h> #include <System/SystemEvents.h> #include <IO/IOServer.h> //!!!DBG TMP! #include <IO/BinaryReader.h> #include <Data/Buffer.h> #include <string> #ifdef DEM_STATS #include <Core/CoreServer.h> #include <Data/StringUtils.h> #endif #define WIN32_LEAN_AND_MEAN #include <d3d11.h> #undef min #undef max //!!!D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE! //each scissor rect belongs to a viewport namespace Render { CD3D11GPUDriver::CD3D11GPUDriver(CD3D11DriverFactory& DriverFactory) : _DriverFactory(&DriverFactory) { } //--------------------------------------------------------------------- CD3D11GPUDriver::~CD3D11GPUDriver() { Release(); } //--------------------------------------------------------------------- bool CD3D11GPUDriver::Init(UPTR AdapterNumber, EGPUDriverType DriverType) { if (!CGPUDriver::Init(AdapterNumber, DriverType)) FAIL; n_assert(AdapterID == Adapter_AutoSelect || _DriverFactory->AdapterExists(AdapterID)); //!!!fix if will be multithreaded, forex job-based! UPTR CreateFlags = D3D11_CREATE_DEVICE_SINGLETHREADED; #if !defined(_DEBUG) && (DEM_RENDER_DEBUG == 0) // Prevents end-users from debugging an application CreateFlags |= D3D11_CREATE_DEVICE_PREVENT_ALTERING_LAYER_SETTINGS_FROM_REGISTRY; #elif (DEM_RENDER_DEBUG != 0) // Enable D3D11 debug layer only in debug builds with render debugging on CreateFlags |= D3D11_CREATE_DEVICE_DEBUG; //const char c_szName[] = "mytexture.jpg"; //pTexture->SetPrivateData( WKPDID_D3DDebugObjectName, sizeof( c_szName ) - 1, c_szName ); // D3D11.1: D3D11_CREATE_DEVICE_DEBUGGABLE - shader debugging //Shader debugging requires a driver that is implemented to the WDDM for Windows 8 (WDDM 1.2) #endif // If we use nullptr adapter (Adapter_AutoSelect), new DXGI factory will be created. We avoid it. IDXGIAdapter1* pAdapter = nullptr; if (AdapterID == Adapter_AutoSelect) AdapterID = 0; if (!SUCCEEDED(_DriverFactory->GetDXGIFactory()->EnumAdapters1(AdapterID, &pAdapter))) FAIL; // NB: All mapped pointers will be SSE-friendly 16-byte aligned for these feature levels, and other // code relies on it. Adding feature levels 9.x may require to change resource mapping code. D3D_FEATURE_LEVEL FeatureLevels[] = { //D3D_FEATURE_LEVEL_11_1, //!!!Can use D3D11.1 and DXGI 1.2 API on Win 7 with platform update! D3D_FEATURE_LEVEL_11_0, D3D_FEATURE_LEVEL_10_1, D3D_FEATURE_LEVEL_10_0 }; UPTR FeatureLevelCount = sizeof_array(FeatureLevels); D3D_FEATURE_LEVEL D3DFeatureLevel; HRESULT hr = D3D11CreateDevice(pAdapter, D3D_DRIVER_TYPE_UNKNOWN, nullptr, CreateFlags, FeatureLevels, FeatureLevelCount, D3D11_SDK_VERSION, &pD3DDevice, &D3DFeatureLevel, &pD3DImmContext); //if (hr == E_INVALIDARG) //{ // // DirectX 11.0 platforms will not recognize D3D_FEATURE_LEVEL_11_1 so we need to retry without it // hr = D3D11CreateDevice( pAdapter, D3D_DRIVER_TYPE_UNKNOWN, nullptr, CreateFlags, FeatureLevels + 1, FeatureLevelCount - 1, // D3D11_SDK_VERSION, &pD3DDevice, &D3DFeatureLevel, &pD3DImmContext); //} pAdapter->Release(); if (FAILED(hr)) { Sys::Log("Failed to create Direct3D11 device object, hr = 0x%x!\n", hr); FAIL; } if (AdapterID == 0) Type = GPU_Hardware; //???else? //!!!in D3D9 type was in device caps! Sys::Log("Device created: %s, feature level 0x%x\n", "HAL", (int)D3DFeatureLevel); UPTR MRTCountCaps = 0; UPTR MaxViewportCountCaps = 0; switch (D3DFeatureLevel) { case D3D_FEATURE_LEVEL_9_1: FeatureLevel = GPU_Level_D3D9_1; MRTCountCaps = D3D_FL9_1_SIMULTANEOUS_RENDER_TARGET_COUNT; MaxViewportCountCaps = 1; break; case D3D_FEATURE_LEVEL_9_2: FeatureLevel = GPU_Level_D3D9_2; MRTCountCaps = D3D_FL9_1_SIMULTANEOUS_RENDER_TARGET_COUNT; MaxViewportCountCaps = 1; break; case D3D_FEATURE_LEVEL_9_3: FeatureLevel = GPU_Level_D3D9_3; MRTCountCaps = D3D_FL9_3_SIMULTANEOUS_RENDER_TARGET_COUNT; MaxViewportCountCaps = 1; break; case D3D_FEATURE_LEVEL_10_0: FeatureLevel = GPU_Level_D3D10_0; MRTCountCaps = D3D10_SIMULTANEOUS_RENDER_TARGET_COUNT; MaxViewportCountCaps = D3D10_VIEWPORT_AND_SCISSORRECT_MAX_INDEX + 1; break; case D3D_FEATURE_LEVEL_10_1: FeatureLevel = GPU_Level_D3D10_1; MRTCountCaps = D3D10_SIMULTANEOUS_RENDER_TARGET_COUNT; MaxViewportCountCaps = D3D10_VIEWPORT_AND_SCISSORRECT_MAX_INDEX + 1; break; case D3D_FEATURE_LEVEL_11_0: FeatureLevel = GPU_Level_D3D11_0; MRTCountCaps = D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT; MaxViewportCountCaps = D3D11_VIEWPORT_AND_SCISSORRECT_MAX_INDEX + 1; break; //case D3D_FEATURE_LEVEL_11_1: default: FeatureLevel = GPU_Level_D3D11_1; MRTCountCaps = D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT; MaxViewportCountCaps = D3D11_VIEWPORT_AND_SCISSORRECT_MAX_INDEX + 1; break; } UPTR MaxVertexStreamsCaps = GetMaxVertexStreams(); CurrRT.SetSize(MRTCountCaps); CurrVB.SetSize(MaxVertexStreamsCaps); CurrVBOffset.SetSize(MaxVertexStreamsCaps); CurrCB.SetSize(ShaderType_COUNT * D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT); CurrSS.SetSize(ShaderType_COUNT * D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT); // To determine whether viewport is set or not at a particular index, we use a bitfield. // So we are not only limited by a D3D11 caps but also by a bit count in a mask. //???!!!use each bit for pair, is there any reason to set VP & SR separately?! //???and also one dirty flag? when set VP do D3D11 remember its SR or it resets SR size? //!!!need static assert! n_assert_dbg(sizeof(VPSRSetFlags) * 4 >= VP_OR_SR_SET_FLAG_COUNT); MaxViewportCount = std::min(MaxViewportCountCaps, VP_OR_SR_SET_FLAG_COUNT); CurrVP = n_new_array(D3D11_VIEWPORT, MaxViewportCount); CurrSR = n_new_array(RECT, MaxViewportCount); VPSRSetFlags.ClearAll(); OK; } //--------------------------------------------------------------------- bool CD3D11GPUDriver::InitSwapChainRenderTarget(CD3D11SwapChain& SC) { n_assert(SC.pSwapChain); // Already initialized, can't reinitialize if (SC.BackBufferRT && SC.BackBufferRT->IsValid()) FAIL; ID3D11Texture2D* pBackBuffer = nullptr; if (FAILED(SC.pSwapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), reinterpret_cast<void**>(&pBackBuffer)))) FAIL; ID3D11RenderTargetView* pRTV = nullptr; HRESULT hr = pD3DDevice->CreateRenderTargetView(pBackBuffer, nullptr, &pRTV); pBackBuffer->Release(); if (FAILED(hr)) FAIL; if (!SC.BackBufferRT) SC.BackBufferRT = n_new(CD3D11RenderTarget); if (!SC.BackBufferRT->As<CD3D11RenderTarget>()->Create(pRTV, nullptr)) { pRTV->Release(); FAIL; } OK; } //--------------------------------------------------------------------- void CD3D11GPUDriver::Release() { if (!pD3DDevice) return; for (auto& Pair : TmpStructuredBuffers) { CTmpCB* pHead = Pair.second; while (pHead) { CTmpCB* pNextHead = pHead->pNext; TmpCBPool.Destroy(pHead); pHead = pNextHead; } } TmpStructuredBuffers.clear(); for (auto& Pair : TmpTextureBuffers) { CTmpCB* pHead = Pair.second; while (pHead) { CTmpCB* pNextHead = pHead->pNext; TmpCBPool.Destroy(pHead); pHead = pNextHead; } } TmpTextureBuffers.clear(); for (auto& Pair : TmpConstantBuffers) { CTmpCB* pHead = Pair.second; while (pHead) { CTmpCB* pNextHead = pHead->pNext; TmpCBPool.Destroy(pHead); pHead = pNextHead; } } TmpConstantBuffers.clear(); while (pPendingCBHead) { CTmpCB* pNextHead = pPendingCBHead->pNext; TmpCBPool.Destroy(pPendingCBHead); pPendingCBHead = pNextHead; } TmpCBPool.Clear(); VertexLayouts.clear(); RenderStates.clear(); Samplers.clear(); //!!!if code won't be reused in Reset(), call DestroySwapChain()! for (auto& SwapChain : SwapChains) if (SwapChain.IsValid()) SwapChain.Destroy(); SwapChains.clear(); SAFE_DELETE_ARRAY(CurrVP); SAFE_DELETE_ARRAY(CurrSR); CurrSRV.clear(); CurrVB.SetSize(0); CurrVBOffset.SetSize(0); CurrCB.SetSize(0); CurrSS.SetSize(0); CurrRT.SetSize(0); CurrDS = nullptr; CurrIB = nullptr; CurrRS = nullptr; NewRS = nullptr; CurrVL = nullptr; pCurrIL = nullptr; //!!!ReleaseQueries(); //#if (DEM_RENDER_DEBUG != 0) // pD3DImmContext->Flush(); //#endif pD3DImmContext->ClearState(); SAFE_RELEASE(pD3DImmContext); //#if DEM_RENDER_DEBUG // ID3D11Debug* pD3D11Debug = nullptr; // pD3DDevice->QueryInterface(__uuidof(ID3D11Debug), reinterpret_cast<void**>(&pD3D11Debug)); // if (pD3D11Debug) // { // pD3D11Debug->ReportLiveDeviceObjects(D3D11_RLDO_DETAIL); // pD3D11Debug->Release(); // } //#endif SAFE_RELEASE(pD3DDevice); // IsInsideFrame = false; } //--------------------------------------------------------------------- bool CD3D11GPUDriver::CheckCaps(ECaps Cap) const { n_assert(pD3DDevice); //pD3DDevice->GetFeatureLevel() //CheckFeatureSupport //CheckFormatSupport switch (Cap) { case Caps_VSTex_R16: case Caps_VSTexFiltering_Linear: case Caps_ReadDepthAsTexture: OK; } FAIL; } //--------------------------------------------------------------------- UPTR CD3D11GPUDriver::GetMaxVertexStreams() const { D3D_FEATURE_LEVEL FeatLevel = pD3DDevice->GetFeatureLevel(); if (FeatLevel >= D3D_FEATURE_LEVEL_11_0) return D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT; else if (FeatLevel >= D3D_FEATURE_LEVEL_10_0) return D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT; else return 4; // Relatively safe value } //--------------------------------------------------------------------- UPTR CD3D11GPUDriver::GetMaxTextureSize(ETextureType Type) const { switch (pD3DDevice->GetFeatureLevel()) { case D3D_FEATURE_LEVEL_9_1: case D3D_FEATURE_LEVEL_9_2: { switch (Type) { case Texture_1D: return D3D_FL9_1_REQ_TEXTURE1D_U_DIMENSION; case Texture_2D: return D3D_FL9_1_REQ_TEXTURE2D_U_OR_V_DIMENSION; case Texture_3D: return D3D_FL9_1_REQ_TEXTURE3D_U_V_OR_W_DIMENSION; case Texture_Cube: return D3D_FL9_1_REQ_TEXTURECUBE_DIMENSION; default: return 0; } } case D3D_FEATURE_LEVEL_9_3: { switch (Type) { case Texture_1D: return D3D_FL9_3_REQ_TEXTURE1D_U_DIMENSION; case Texture_2D: return D3D_FL9_3_REQ_TEXTURE2D_U_OR_V_DIMENSION; case Texture_3D: return D3D_FL9_1_REQ_TEXTURE3D_U_V_OR_W_DIMENSION; case Texture_Cube: return D3D_FL9_3_REQ_TEXTURECUBE_DIMENSION; default: return 0; } } case D3D_FEATURE_LEVEL_10_0: case D3D_FEATURE_LEVEL_10_1: { switch (Type) { case Texture_1D: return D3D10_REQ_TEXTURE1D_U_DIMENSION; case Texture_2D: return D3D10_REQ_TEXTURE2D_U_OR_V_DIMENSION; case Texture_3D: return D3D10_REQ_TEXTURE3D_U_V_OR_W_DIMENSION; case Texture_Cube: return D3D10_REQ_TEXTURECUBE_DIMENSION; default: return 0; } } case D3D_FEATURE_LEVEL_11_0: case D3D_FEATURE_LEVEL_11_1: { switch (Type) { case Texture_1D: return D3D11_REQ_TEXTURE1D_U_DIMENSION; case Texture_2D: return D3D11_REQ_TEXTURE2D_U_OR_V_DIMENSION; case Texture_3D: return D3D11_REQ_TEXTURE3D_U_V_OR_W_DIMENSION; case Texture_Cube: return D3D11_REQ_TEXTURECUBE_DIMENSION; default: return 0; } } default: return 0; } } //--------------------------------------------------------------------- int CD3D11GPUDriver::CreateSwapChain(const CRenderTargetDesc& BackBufferDesc, const CSwapChainDesc& SwapChainDesc, DEM::Sys::COSWindow* pWindow) { if (!pWindow || !pWindow->IsA<DEM::Sys::COSWindowWin32>()) { n_assert2(false, "CD3D9GPUDriver::CreateSwapChain() > invalid or unsupported window passed"); return -1; } auto pWndWin32 = static_cast<DEM::Sys::COSWindowWin32*>(pWindow); //???or destroy and recreate with new params? for (auto& SwapChain : SwapChains) if (SwapChain.TargetWindow.Get() == pWindow) return ERR_CREATION_ERROR; UPTR BBWidth = BackBufferDesc.Width, BBHeight = BackBufferDesc.Height; PrepareWindowAndBackBufferSize(*pWindow, BBWidth, BBHeight); // If VSync, use triple buffering by default, else double //!!! + 1 if front buffer must be included! UPTR BackBufferCount = SwapChainDesc.BackBufferCount ? SwapChainDesc.BackBufferCount : (SwapChainDesc.Flags.Is(SwapChain_VSync) ? 2 : 1); DXGI_FORMAT BackBufferFormat = CD3D11DriverFactory::PixelFormatToDXGIFormat(BackBufferDesc.Format); //???GetDesktopFormat()?! //???use SRGB? if (BackBufferFormat == DXGI_FORMAT_B8G8R8X8_UNORM) BackBufferFormat = DXGI_FORMAT_B8G8R8A8_UNORM; DXGI_SWAP_CHAIN_DESC SCDesc = { 0 }; switch (SwapChainDesc.SwapMode) { case SwapMode_CopyPersist: SCDesc.SwapEffect = DXGI_SWAP_EFFECT_SEQUENTIAL; break; case SwapMode_FlipPersist: { //!!!only from Win8! SCDesc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL; break; // BufferCount to a value between 2 and 16 to prevent a performance penalty as a result of waiting // on DWM to release the previous presentation buffer (c) Docs if (BackBufferCount < 2) BackBufferCount = 2; // Format to DXGI_FORMAT_R16G16B16A16_FLOAT, DXGI_FORMAT_B8G8R8A8_UNORM, or DXGI_FORMAT_R8G8B8A8_UNORM (c) Docs if (BackBufferFormat != DXGI_FORMAT_R16G16B16A16_FLOAT && BackBufferFormat != DXGI_FORMAT_B8G8R8A8_UNORM && BackBufferFormat != DXGI_FORMAT_R8G8B8A8_UNORM) { BackBufferFormat = DXGI_FORMAT_B8G8R8A8_UNORM; } } case SwapMode_CopyDiscard: default: SCDesc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD; break; } SCDesc.BufferDesc.Width = BBWidth; SCDesc.BufferDesc.Height = BBHeight; SCDesc.BufferDesc.Format = BackBufferFormat; SCDesc.BufferDesc.RefreshRate.Numerator = 0; SCDesc.BufferDesc.RefreshRate.Denominator = 0; SCDesc.BufferCount = std::min<UPTR>(BackBufferCount, DXGI_MAX_SWAP_CHAIN_BUFFERS); SCDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; if (BackBufferDesc.UseAsShaderInput) SCDesc.BufferUsage |= DXGI_USAGE_SHADER_INPUT; SCDesc.Windowed = TRUE; // Recommended, use SwitchToFullscreen() SCDesc.OutputWindow = pWndWin32->GetHWND(); SCDesc.Flags = 0; //DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH; // Allows automatic display mode switch on wnd->fullscr if (SCDesc.SwapEffect == DXGI_SWAP_EFFECT_DISCARD) { // It is recommended to use non-MSAA swap chain, render to MSAA RT and then resolve it to the back buffer //???support MSAA or enforce separate MSAA RT? SCDesc.SampleDesc.Count = 1; SCDesc.SampleDesc.Quality = 0; } else { // MSAA not supported for swap effects other than DXGI_SWAP_EFFECT_DISCARD SCDesc.SampleDesc.Count = 1; SCDesc.SampleDesc.Quality = 0; } // Starting with Direct3D 11.1, we recommend not to use CreateSwapChain anymore to create a swap chain. // Instead, use CreateSwapChainForHwnd (c) Docs //!!!can add requirement for a platform update for win 7 and use d3d11.1 + dxgi 1.2 codepath! IDXGIFactory1* pDXGIFactory = _DriverFactory->GetDXGIFactory(); IDXGISwapChain* pSwapChain = nullptr; HRESULT hr = pDXGIFactory->CreateSwapChain(pD3DDevice, &SCDesc, &pSwapChain); // They say if the first failure was due to wrong BufferCount, DX sets it to the correct value if (FAILED(hr) && SCDesc.BufferCount != BackBufferCount) hr = pDXGIFactory->CreateSwapChain(pD3DDevice, &SCDesc, &pSwapChain); if (FAILED(hr)) { Sys::Error("D3D11 swap chain creation error\n"); return ERR_CREATION_ERROR; } auto ItSC = SwapChains.begin(); for (; ItSC != SwapChains.end(); ++ItSC) if (!ItSC->IsValid()) break; if (ItSC == SwapChains.end()) { SwapChains.push_back({}); ItSC = SwapChains.end() - 1; } ItSC->pSwapChain = pSwapChain; if (!InitSwapChainRenderTarget(*ItSC)) { ItSC->Destroy(); return ERR_CREATION_ERROR; } ItSC->TargetWindow = pWindow; ItSC->LastWindowRect = pWindow->GetRect(); ItSC->TargetDisplay = nullptr; ItSC->Desc = SwapChainDesc; // Disable DXGI reaction on Alt+Enter & PrintScreen pDXGIFactory->MakeWindowAssociation(pWndWin32->GetHWND(), DXGI_MWA_NO_WINDOW_CHANGES | DXGI_MWA_NO_ALT_ENTER | DXGI_MWA_NO_PRINT_SCREEN); ItSC->Sub_OnToggleFullscreen = pWindow->Subscribe<CD3D11GPUDriver>(CStrID("OnToggleFullscreen"), this, &CD3D11GPUDriver::OnOSWindowToggleFullscreen); ItSC->Sub_OnClosing = pWindow->Subscribe<CD3D11GPUDriver>(CStrID("OnClosing"), this, &CD3D11GPUDriver::OnOSWindowClosing); return std::distance(SwapChains.begin(), ItSC); } //--------------------------------------------------------------------- bool CD3D11GPUDriver::DestroySwapChain(UPTR SwapChainID) { if (!SwapChainExists(SwapChainID)) FAIL; CD3D11SwapChain& SC = SwapChains[SwapChainID]; for (UPTR i = 0; i < CurrRT.size(); ++i) if (CurrRT[i].Get() == SC.BackBufferRT.Get()) { SetRenderTarget(i, nullptr); break; // Some RT may be only in one slot at a time } SC.Destroy(); OK; } //--------------------------------------------------------------------- bool CD3D11GPUDriver::SwapChainExists(UPTR SwapChainID) const { return SwapChainID < SwapChains.size() && SwapChains[SwapChainID].IsValid(); } //--------------------------------------------------------------------- //!!!call ResizeTarget to resize fullscreen or windowed to resize a target window too! //!!!use what is written now to respond to changes! // Does not resize an OS window, because often is called in response to an OS window resize //???bool ResizeOSWindow? bool CD3D11GPUDriver::ResizeSwapChain(UPTR SwapChainID, unsigned int Width, unsigned int Height) { if (!SwapChainExists(SwapChainID)) FAIL; CD3D11SwapChain& SC = SwapChains[SwapChainID]; const CRenderTargetDesc& BackBufDesc = SC.BackBufferRT->GetDesc(); //???Or automatically choose the 0 width and height to match the client rect for HWNDs? // Then can pass 0 to ResizeBuffers if (!Width) Width = BackBufDesc.Width; if (!Height) Height = BackBufDesc.Height; if (BackBufDesc.Width == Width && BackBufDesc.Height == Height) OK; //???for child window, assert that size passed is a window size? //???or this method must resize target? in fact, need two swap chain resizing methods? //one as command (ResizeTarget), one as handler (ResizeBuffers) UPTR RemovedRTIdx; for (RemovedRTIdx = 0; RemovedRTIdx < CurrRT.size(); ++RemovedRTIdx) if (CurrRT[RemovedRTIdx] == SC.BackBufferRT) { CurrRT[RemovedRTIdx] = nullptr; //!!!commit changes! pD3DImmContext->OMSetRenderTargets(0, nullptr, nullptr); break; } SC.BackBufferRT->Destroy(); UPTR SCFlags = 0; //DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH; // Preserve the existing buffer count and format. HRESULT hr = SC.pSwapChain->ResizeBuffers(0, Width, Height, DXGI_FORMAT_UNKNOWN, SCFlags); n_assert(SUCCEEDED(hr)); if (!InitSwapChainRenderTarget(SC)) { SC.Destroy(); FAIL; } if (RemovedRTIdx < CurrRT.size()) SetRenderTarget(RemovedRTIdx, SC.BackBufferRT); OK; } //--------------------------------------------------------------------- bool CD3D11GPUDriver::SwitchToFullscreen(UPTR SwapChainID, CDisplayDriver* pDisplay, const CDisplayMode* pMode) { if (!SwapChainExists(SwapChainID)) FAIL; if (pDisplay && AdapterID != pDisplay->GetAdapterID()) FAIL; CD3D11SwapChain& SC = SwapChains[SwapChainID]; if (SC.TargetWindow->IsChild()) FAIL; if (pDisplay) SC.TargetDisplay = pDisplay; else { IDXGIOutput* pOutput = nullptr; if (FAILED(SC.pSwapChain->GetContainingOutput(&pOutput))) FAIL; SC.TargetDisplay = _DriverFactory->CreateDisplayDriver(pOutput); if (!SC.TargetDisplay) { pOutput->Release(); FAIL; } } IDXGIOutput* pDXGIOutput = SC.TargetDisplay->As<CD3D11DisplayDriver>()->GetDXGIOutput(); n_assert(pDXGIOutput); // If pMode is nullptr, DXGI will default mode to a desktop mode if // DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH flag is not set and to // a closest mode to a window size if this flag is set. We don't set it. DXGI_MODE_DESC DXGIMode; if (pMode) { // If either Width or Height are 0, both must be 0 (c) Docs for FindClosestMatchingMode() DXGI_MODE_DESC RequestedDXGIMode; RequestedDXGIMode.Width = pMode->Height ? pMode->Width : 0; RequestedDXGIMode.Height = pMode->Width ? pMode->Height : 0; RequestedDXGIMode.Format = CD3D11DriverFactory::PixelFormatToDXGIFormat(pMode->PixelFormat); RequestedDXGIMode.RefreshRate.Numerator = pMode->RefreshRate.Numerator; RequestedDXGIMode.RefreshRate.Denominator = pMode->RefreshRate.Denominator; RequestedDXGIMode.Scaling = DXGI_MODE_SCALING_UNSPECIFIED; RequestedDXGIMode.ScanlineOrdering = DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED; // We don't use a requested mode directly since it may be unsupported. // We find closest supported mode instead. // DX 11.1: IDXGIOutput1::FindClosestMatchingMode1() if (FAILED(pDXGIOutput->FindClosestMatchingMode(&RequestedDXGIMode, &DXGIMode, pD3DDevice))) { SC.TargetDisplay = nullptr; FAIL; } // NB: it is recommended to call ResizeTarget() _before_ SetFullscreenState() if (FAILED(SC.pSwapChain->ResizeTarget(&DXGIMode))) { SC.TargetDisplay = nullptr; FAIL; } } SC.LastWindowRect = SC.TargetWindow->GetRect(); HRESULT hr = SC.pSwapChain->SetFullscreenState(TRUE, pDXGIOutput); if (FAILED(hr)) { if (hr == DXGI_STATUS_MODE_CHANGE_IN_PROGRESS) OK; else FAIL; //???resize back? } // After calling SetFullscreenState, it is advisable to call ResizeTarget again with the // RefreshRate member of DXGI_MODE_DESC zeroed out. This amounts to a no-operation instruction // in DXGI, but it can avoid issues with the refresh rate. (c) Docs if (pMode) { DXGIMode.RefreshRate.Numerator = 0; DXGIMode.RefreshRate.Denominator = 0; if (FAILED(SC.pSwapChain->ResizeTarget(&DXGIMode))) { SC.pSwapChain->SetFullscreenState(FALSE, nullptr); SC.TargetDisplay = nullptr; FAIL; } } OK; } //--------------------------------------------------------------------- bool CD3D11GPUDriver::SwitchToWindowed(UPTR SwapChainID, const Data::CRect* pWindowRect) { if (!SwapChainExists(SwapChainID)) FAIL; CD3D11SwapChain& SC = SwapChains[SwapChainID]; // Windowed viewport can be shared between several monitors SC.TargetDisplay = nullptr; HRESULT hr = SC.pSwapChain->SetFullscreenState(FALSE, nullptr); if (FAILED(hr)) { if (hr == DXGI_STATUS_MODE_CHANGE_IN_PROGRESS) OK; else FAIL; //???resize back? } OK; } //--------------------------------------------------------------------- bool CD3D11GPUDriver::IsFullscreen(UPTR SwapChainID) const { return SwapChainExists(SwapChainID) && SwapChains[SwapChainID].IsFullscreen(); } //--------------------------------------------------------------------- PRenderTarget CD3D11GPUDriver::GetSwapChainRenderTarget(UPTR SwapChainID) const { return SwapChainExists(SwapChainID) ? SwapChains[SwapChainID].BackBufferRT : PRenderTarget(); } //--------------------------------------------------------------------- DEM::Sys::COSWindow* CD3D11GPUDriver::GetSwapChainWindow(UPTR SwapChainID) const { return SwapChainExists(SwapChainID) ? SwapChains[SwapChainID].TargetWindow.Get() : nullptr; } //--------------------------------------------------------------------- PDisplayDriver CD3D11GPUDriver::GetSwapChainDisplay(UPTR SwapChainID) const { if (!SwapChainExists(SwapChainID)) return nullptr; auto& SC = SwapChains[SwapChainID]; if (SC.TargetDisplay) return SC.TargetDisplay; // Windowed swap chain has no dedicated display, return the one // that contains the most part of the swap chain window IDXGIOutput* pOutput = nullptr; if (FAILED(SC.pSwapChain->GetContainingOutput(&pOutput))) FAIL; auto Display = _DriverFactory->CreateDisplayDriver(pOutput); if (!Display) pOutput->Release(); return Display; } //--------------------------------------------------------------------- // NB: Present() should be called as late as possible after EndFrame() // to improve parallelism between the GPU and the CPU bool CD3D11GPUDriver::Present(UPTR SwapChainID) { if (!SwapChainExists(SwapChainID)) FAIL; CD3D11SwapChain& SC = SwapChains[SwapChainID]; return SUCCEEDED(SC.pSwapChain->Present(0, 0)); } //--------------------------------------------------------------------- bool CD3D11GPUDriver::CaptureScreenshot(UPTR SwapChainID, IO::IStream& OutStream) const { Sys::Error("IMPLEMENT ME!!! CD3D11GPUDriver::CaptureScreenshot()\n"); FAIL; } //--------------------------------------------------------------------- //!!!!!!!!!!!!???how to handle set viewport and then set another RT? bool CD3D11GPUDriver::SetViewport(UPTR Index, const CViewport* pViewport) { if (Index >= MaxViewportCount) FAIL; D3D11_VIEWPORT& CurrViewport = CurrVP[Index]; UPTR IsSetBit = (1 << Index); if (pViewport) { if (VPSRSetFlags.Is(IsSetBit) && pViewport->Left == CurrViewport.TopLeftX && pViewport->Top == CurrViewport.TopLeftY && pViewport->Width == CurrViewport.Width && pViewport->Height == CurrViewport.Height && pViewport->MinDepth == CurrViewport.MinDepth && pViewport->MaxDepth == CurrViewport.MaxDepth) { OK; } CurrViewport.TopLeftX = pViewport->Left; CurrViewport.TopLeftY = pViewport->Top; CurrViewport.Width = pViewport->Width; CurrViewport.Height = pViewport->Height; CurrViewport.MinDepth = pViewport->MinDepth; CurrViewport.MaxDepth = pViewport->MaxDepth; VPSRSetFlags.Set(IsSetBit); } else { // TODO: review, maybe hardcoded 640x480 is not the best choice for defaults auto pRT = CurrRT[Index].Get(); CurrViewport.TopLeftX = 0.f; CurrViewport.TopLeftY = 0.f; CurrViewport.Width = pRT ? pRT->GetDesc().Width : 640.f; CurrViewport.Height = pRT ? pRT->GetDesc().Height : 480.f; CurrViewport.MinDepth = 0.f; CurrViewport.MaxDepth = 1.f; VPSRSetFlags.Clear(IsSetBit); } CurrDirtyFlags.Set(GPU_Dirty_VP); OK; } //--------------------------------------------------------------------- bool CD3D11GPUDriver::GetViewport(UPTR Index, CViewport& OutViewport) { if (Index >= MaxViewportCount || (Index > 0 && VPSRSetFlags.IsNot(1 << Index))) FAIL; // If default (0) viewport is not set, it is of the render target size. // RT might be set but not applied, in that case read values from RT. if (Index == 0 && VPSRSetFlags.IsNot(1 << Index) && CurrDirtyFlags.Is(GPU_Dirty_RT)) { for (UPTR i = 0; i < CurrRT.size(); ++i) { if (auto pRT = CurrRT[i].Get()) { OutViewport.Left = 0.f; OutViewport.Top = 0.f; OutViewport.Width = (float)pRT->GetDesc().Width; OutViewport.Height = (float)pRT->GetDesc().Height; OutViewport.MinDepth = 0.f; OutViewport.MaxDepth = 1.f; OK; } } FAIL; } D3D11_VIEWPORT& CurrViewport = CurrVP[Index]; OutViewport.Left = CurrViewport.TopLeftX; OutViewport.Top = CurrViewport.TopLeftY; OutViewport.Width = CurrViewport.Width; OutViewport.Height = CurrViewport.Height; OutViewport.MinDepth = CurrViewport.MinDepth; OutViewport.MaxDepth = CurrViewport.MaxDepth; OK; } //--------------------------------------------------------------------- bool CD3D11GPUDriver::SetScissorRect(UPTR Index, const Data::CRect* pScissorRect) { if (Index >= MaxViewportCount) FAIL; RECT& CurrRect = CurrSR[Index]; UPTR IsSetBit = (1 << (VP_OR_SR_SET_FLAG_COUNT + Index)); // Use higher half of bits for SR if (pScissorRect) { if (VPSRSetFlags.Is(IsSetBit) && pScissorRect->X == CurrRect.left && pScissorRect->Y == CurrRect.top && pScissorRect->Right() == CurrRect.right && pScissorRect->Bottom() == CurrRect.bottom) { OK; } CurrRect.left = pScissorRect->X; CurrRect.top = pScissorRect->Y; CurrRect.right = pScissorRect->Right(); CurrRect.bottom = pScissorRect->Bottom(); VPSRSetFlags.Set(IsSetBit); } else { Sys::Error("FILL WITH RT DEFAULTS!!!\n"); CurrRect.left = -1; CurrRect.top = -1; CurrRect.right = -1; CurrRect.bottom = -1; VPSRSetFlags.Clear(IsSetBit); } CurrDirtyFlags.Set(GPU_Dirty_SR); OK; } //--------------------------------------------------------------------- bool CD3D11GPUDriver::GetScissorRect(UPTR Index, Data::CRect& OutScissorRect) { if (Index >= MaxViewportCount || VPSRSetFlags.IsNot(1 << (VP_OR_SR_SET_FLAG_COUNT + Index))) FAIL; RECT& CurrRect = CurrSR[Index]; OutScissorRect.X = CurrRect.left; OutScissorRect.Y = CurrRect.top; OutScissorRect.W = CurrRect.right - CurrRect.left; OutScissorRect.H = CurrRect.bottom - CurrRect.top; OK; } //--------------------------------------------------------------------- bool CD3D11GPUDriver::SetVertexLayout(CVertexLayout* pVLayout) { if (CurrVL.Get() == pVLayout) OK; CurrVL = static_cast<CD3D11VertexLayout*>(pVLayout); CurrDirtyFlags.Set(GPU_Dirty_VL); OK; } //--------------------------------------------------------------------- bool CD3D11GPUDriver::SetVertexBuffer(UPTR Index, CVertexBuffer* pVB, UPTR OffsetVertex) { if (Index >= CurrVB.size()) FAIL; UPTR Offset = pVB ? OffsetVertex * pVB->GetVertexLayout()->GetVertexSizeInBytes() : 0; if (CurrVB[Index].Get() == pVB && CurrVBOffset[Index] == Offset) OK; CurrVB[Index] = (CD3D11VertexBuffer*)pVB; CurrVBOffset[Index] = Offset; CurrDirtyFlags.Set(GPU_Dirty_VB); OK; } //--------------------------------------------------------------------- bool CD3D11GPUDriver::SetIndexBuffer(CIndexBuffer* pIB) { if (CurrIB.Get() == pIB) OK; CurrIB = (CD3D11IndexBuffer*)pIB; CurrDirtyFlags.Set(GPU_Dirty_IB); OK; } //--------------------------------------------------------------------- bool CD3D11GPUDriver::SetRenderState(CRenderState* pState) { if (CurrRS == pState || NewRS == pState) OK; NewRS = static_cast<CD3D11RenderState*>(pState); CurrDirtyFlags.Set(GPU_Dirty_RS); OK; } //--------------------------------------------------------------------- bool CD3D11GPUDriver::SetRenderTarget(UPTR Index, CRenderTarget* pRT) { if (Index >= CurrRT.size()) FAIL; if (CurrRT[Index].Get() == pRT) OK; #ifdef _DEBUG // Can't set the same RT to more than one slot if (pRT) for (UPTR i = 0; i < CurrRT.size(); ++i) if (CurrRT[i].Get() == pRT) FAIL; #endif CurrRT[Index] = (CD3D11RenderTarget*)pRT; CurrDirtyFlags.Set(GPU_Dirty_RT); OK; } //--------------------------------------------------------------------- bool CD3D11GPUDriver::SetDepthStencilBuffer(CDepthStencilBuffer* pDS) { if (CurrDS.Get() == pDS) OK; CurrDS = (CD3D11DepthStencilBuffer*)pDS; CurrDirtyFlags.Set(GPU_Dirty_DS); OK; } //--------------------------------------------------------------------- CRenderTarget* CD3D11GPUDriver::GetRenderTarget(UPTR Index) const { return CurrRT[Index].Get(); } //--------------------------------------------------------------------- CDepthStencilBuffer* CD3D11GPUDriver::GetDepthStencilBuffer() const { return CurrDS.Get(); } //--------------------------------------------------------------------- bool CD3D11GPUDriver::BindSRV(EShaderType ShaderType, UPTR SlotIndex, ID3D11ShaderResourceView* pSRV, CD3D11ConstantBuffer* pCB) { if (SlotIndex >= D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT) FAIL; auto Register = SlotIndex; if (MaxSRVSlotIndex < SlotIndex) MaxSRVSlotIndex = SlotIndex; SlotIndex |= (ShaderType << 16); // Encode shader type in a high word CSRVRecord* pSRVRec; auto It = CurrSRV.find(SlotIndex); if (It != CurrSRV.cend()) { pSRVRec = &It->second; if (pSRVRec->pSRV == pSRV) OK; // Free temporary buffer previously bound to this slot FreePendingTemporaryBuffer(pSRVRec->CB.Get(), ShaderType, Register); } else { pSRVRec = &CurrSRV.emplace(SlotIndex, CSRVRecord{}).first->second; } pSRVRec->pSRV = pSRV; pSRVRec->CB = pCB; CurrDirtyFlags.Set(GPU_Dirty_SRV); ShaderParamsDirtyFlags.Set(1 << (Shader_Dirty_Resources + ShaderType)); OK; } //--------------------------------------------------------------------- bool CD3D11GPUDriver::BindConstantBuffer(EShaderType ShaderType, EUSMBufferType Type, U32 Register, CD3D11ConstantBuffer* pBuffer) { if (Type == USMBuffer_Constant) { if (Register >= D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT) FAIL; const UPTR Index = Register + ((UPTR)ShaderType) * D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT; if (CurrCB[Index] == pBuffer) OK; // Free temporary buffer previously bound to this slot FreePendingTemporaryBuffer(CurrCB[Index].Get(), ShaderType, Register); CurrCB[Index] = pBuffer; CurrDirtyFlags.Set(GPU_Dirty_CB); ShaderParamsDirtyFlags.Set(1 << (Shader_Dirty_CBuffers + ShaderType)); OK; } else { ID3D11ShaderResourceView* pSRV = pBuffer ? pBuffer->GetD3DSRView() : nullptr; return BindSRV(ShaderType, Register, pSRV, pBuffer); } } //--------------------------------------------------------------------- bool CD3D11GPUDriver::BindResource(EShaderType ShaderType, U32 Register, CD3D11Texture* pResource) { ID3D11ShaderResourceView* pSRV = pResource ? pResource->GetD3DSRView() : nullptr; return BindSRV(ShaderType, Register, pSRV, nullptr); } //--------------------------------------------------------------------- bool CD3D11GPUDriver::BindSampler(EShaderType ShaderType, U32 Register, CD3D11Sampler* pSampler) { if (Register >= D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT) FAIL; const UPTR Index = Register + ((UPTR)ShaderType) * D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT; const CD3D11Sampler* pCurrSamp = CurrSS[Index].Get(); if (pCurrSamp == pSampler) OK; if (pCurrSamp && pSampler && pCurrSamp->GetD3DSampler() == pSampler->GetD3DSampler()) OK; CurrSS[Index] = pSampler; CurrDirtyFlags.Set(GPU_Dirty_SS); ShaderParamsDirtyFlags.Set(1 << (Shader_Dirty_Samplers + ShaderType)); OK; } //--------------------------------------------------------------------- void CD3D11GPUDriver::UnbindSRV(EShaderType ShaderType, UPTR SlotIndex, ID3D11ShaderResourceView* pSRV) { if (SlotIndex >= D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT) return; auto It = CurrSRV.find(SlotIndex | (ShaderType << 16)); if (It == CurrSRV.cend()) return; if (It->second.pSRV != pSRV) return; // Free temporary buffer previously bound to this slot FreePendingTemporaryBuffer(It->second.CB.Get(), ShaderType, SlotIndex); CurrSRV.erase(It); CurrDirtyFlags.Set(GPU_Dirty_SRV); ShaderParamsDirtyFlags.Set(1 << (Shader_Dirty_Resources + ShaderType)); } //--------------------------------------------------------------------- void CD3D11GPUDriver::UnbindConstantBuffer(EShaderType ShaderType, EUSMBufferType Type, U32 Register, CD3D11ConstantBuffer& Buffer) { if (Type == USMBuffer_Constant) { if (Register >= D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT) return; const UPTR Index = Register + ((UPTR)ShaderType) * D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT; if (CurrCB[Index] == &Buffer) { // Free temporary buffer FreePendingTemporaryBuffer(CurrCB[Index], ShaderType, Register); CurrCB[Index] = nullptr; CurrDirtyFlags.Set(GPU_Dirty_CB); ShaderParamsDirtyFlags.Set(1 << (Shader_Dirty_CBuffers + ShaderType)); } } else { UnbindSRV(ShaderType, Register, Buffer.GetD3DSRView()); } } //--------------------------------------------------------------------- void CD3D11GPUDriver::UnbindResource(EShaderType ShaderType, U32 Register, CD3D11Texture& Resource) { UnbindSRV(ShaderType, Register, Resource.GetD3DSRView()); } //--------------------------------------------------------------------- void CD3D11GPUDriver::UnbindSampler(EShaderType ShaderType, U32 Register, CD3D11Sampler& Sampler) { if (Register >= D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT) return; const UPTR Index = Register + ((UPTR)ShaderType) * D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT; if (CurrSS[Index] == &Sampler) { CurrSS[Index] = nullptr; CurrDirtyFlags.Set(GPU_Dirty_SS); ShaderParamsDirtyFlags.Set(1 << (Shader_Dirty_Samplers + ShaderType)); } } //--------------------------------------------------------------------- bool CD3D11GPUDriver::BeginFrame() { #ifdef DEM_STATS PrimitivesRendered = 0; DrawsRendered = 0; #endif OK; } //--------------------------------------------------------------------- void CD3D11GPUDriver::EndFrame() { #ifdef DEM_STATS std::string RTString; for (UPTR i = 0; i < CurrRT.size(); ++i) if (CurrRT[i].IsValidPtr()) RTString += std::to_string((UPTR)CurrRT[i].Get()); if (Core::CCoreServer::HasInstance()) { CoreSrv->SetGlobal<int>("Render_Primitives_" + RTString, PrimitivesRendered); CoreSrv->SetGlobal<int>("Render_Draws_" + RTString, DrawsRendered); } #endif /* //!!!may clear render targets in RP phases, this is not a solution! for (UPTR i = 0; i < CurrRT.GetCount(); ++i) SetRenderTarget(i, nullptr); SetDepthStencilBuffer(nullptr); */ } //--------------------------------------------------------------------- // Even if RTs and DS set are still dirty (not bound), clear operation can be performed. void CD3D11GPUDriver::Clear(UPTR Flags, const vector4& ColorRGBA, float Depth, U8 Stencil) { if (Flags & Clear_Color) { for (UPTR i = 0; i < CurrRT.size(); ++i) { CD3D11RenderTarget* pRT = CurrRT[i].Get(); if (pRT && pRT->IsValid()) pD3DImmContext->ClearRenderTargetView(pRT->GetD3DRTView(), ColorRGBA.v); } } if (CurrDS.IsValidPtr() && ((Flags & Clear_Depth) || (Flags & Clear_Stencil))) ClearDepthStencilBuffer(*CurrDS.Get(), Flags, Depth, Stencil); } //--------------------------------------------------------------------- void CD3D11GPUDriver::ClearRenderTarget(CRenderTarget& RT, const vector4& ColorRGBA) { if (!RT.IsValid()) return; CD3D11RenderTarget& D3D11RT = (CD3D11RenderTarget&)RT; pD3DImmContext->ClearRenderTargetView(D3D11RT.GetD3DRTView(), ColorRGBA.v); } //--------------------------------------------------------------------- void CD3D11GPUDriver::ClearDepthStencilBuffer(CDepthStencilBuffer& DS, UPTR Flags, float Depth, U8 Stencil) { if (!DS.IsValid()) return; CD3D11DepthStencilBuffer& D3D11DS = (CD3D11DepthStencilBuffer&)DS; UINT D3DFlags = 0; if (Flags & Clear_Depth) D3DFlags |= D3D11_CLEAR_DEPTH; DXGI_FORMAT Fmt = CD3D11DriverFactory::PixelFormatToDXGIFormat(D3D11DS.GetDesc().Format); if ((Flags & Clear_Stencil) && CD3D11DriverFactory::DXGIFormatStencilBits(Fmt) > 0) D3DFlags |= D3D11_CLEAR_STENCIL; if (D3DFlags) pD3DImmContext->ClearDepthStencilView(D3D11DS.GetD3DDSView(), D3DFlags, Depth, Stencil); } //--------------------------------------------------------------------- bool CD3D11GPUDriver::InternalDraw(const CPrimitiveGroup& PrimGroup, bool Instanced, UPTR InstanceCount) { n_assert_dbg(pD3DDevice && InstanceCount && (Instanced || InstanceCount == 1)); if (CurrPT != PrimGroup.Topology) { D3D11_PRIMITIVE_TOPOLOGY D3DPrimType; switch (PrimGroup.Topology) { case Prim_PointList: D3DPrimType = D3D11_PRIMITIVE_TOPOLOGY_POINTLIST; break; case Prim_LineList: D3DPrimType = D3D11_PRIMITIVE_TOPOLOGY_LINELIST; break; case Prim_LineStrip: D3DPrimType = D3D11_PRIMITIVE_TOPOLOGY_LINESTRIP; break; case Prim_TriList: D3DPrimType = D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST; break; case Prim_TriStrip: D3DPrimType = D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP; break; default: Sys::Error("CD3D11GPUDriver::Draw() -> Invalid primitive topology!"); FAIL; } pD3DImmContext->IASetPrimitiveTopology(D3DPrimType); CurrPT = PrimGroup.Topology; } if (CurrDirtyFlags.IsAny() && ApplyChanges(CurrDirtyFlags.GetMask()) != 0) FAIL; n_assert_dbg(CurrDirtyFlags.IsNotAll()); if (PrimGroup.IndexCount > 0) { if (Instanced) pD3DImmContext->DrawIndexedInstanced(PrimGroup.IndexCount, InstanceCount, PrimGroup.FirstIndex, 0, 0); else pD3DImmContext->DrawIndexed(PrimGroup.IndexCount, PrimGroup.FirstIndex, 0); } else { if (Instanced) pD3DImmContext->DrawInstanced(PrimGroup.VertexCount, InstanceCount, PrimGroup.FirstVertex, 0); else pD3DImmContext->Draw(PrimGroup.VertexCount, PrimGroup.FirstVertex); } #ifdef DEM_STATS UPTR PrimCount = (PrimGroup.IndexCount > 0) ? PrimGroup.IndexCount : PrimGroup.VertexCount; switch (CurrPT) { case Prim_PointList: break; case Prim_LineList: PrimCount >>= 1; break; case Prim_LineStrip: --PrimCount; break; case Prim_TriList: PrimCount /= 3; break; case Prim_TriStrip: PrimCount -= 2; break; default: PrimCount = 0; break; } PrimitivesRendered += InstanceCount * PrimCount; ++DrawsRendered; #endif OK; } //--------------------------------------------------------------------- UPTR CD3D11GPUDriver::ApplyChanges(UPTR ChangesToUpdate) { Data::CFlags Update(ChangesToUpdate); UPTR Errors = 0; bool InputLayoutDirty = false; if (Update.Is(GPU_Dirty_RS) && CurrDirtyFlags.Is(GPU_Dirty_RS)) { const CD3D11RenderState* pNewRS = NewRS.Get(); if (pNewRS) { CD3D11RenderState* pCurrRS = CurrRS.Get(); UPTR CurrSigID = pCurrRS && pCurrRS->VS.IsValidPtr() ? pCurrRS->VS.Get()->GetInputSignatureID() : 0; UPTR NewSigID = pNewRS->VS.IsValidPtr() ? pNewRS->VS.Get()->GetInputSignatureID() : 0; if (!pCurrRS || NewSigID != CurrSigID) InputLayoutDirty = true; if (!pCurrRS || pNewRS->VS != pCurrRS->VS) pD3DImmContext->VSSetShader(pNewRS->VS.IsValidPtr() ? pNewRS->VS.Get()->GetD3DVertexShader() : nullptr, nullptr, 0); if (!pCurrRS || pNewRS->HS != pCurrRS->HS) pD3DImmContext->HSSetShader(pNewRS->HS.IsValidPtr() ? pNewRS->HS.Get()->GetD3DHullShader() : nullptr, nullptr, 0); if (!pCurrRS || pNewRS->DS != pCurrRS->DS) pD3DImmContext->DSSetShader(pNewRS->DS.IsValidPtr() ? pNewRS->DS.Get()->GetD3DDomainShader() : nullptr, nullptr, 0); if (!pCurrRS || pNewRS->GS != pCurrRS->GS) pD3DImmContext->GSSetShader(pNewRS->GS.IsValidPtr() ? pNewRS->GS.Get()->GetD3DGeometryShader() : nullptr, nullptr, 0); if (!pCurrRS || pNewRS->PS != pCurrRS->PS) pD3DImmContext->PSSetShader(pNewRS->PS.IsValidPtr() ? pNewRS->PS.Get()->GetD3DPixelShader() : nullptr, nullptr, 0); if (!pCurrRS || pNewRS->pBState != pCurrRS->pBState || pNewRS->BlendFactorRGBA[0] != pCurrRS->BlendFactorRGBA[0] || pNewRS->BlendFactorRGBA[1] != pCurrRS->BlendFactorRGBA[1] || pNewRS->BlendFactorRGBA[2] != pCurrRS->BlendFactorRGBA[2] || pNewRS->BlendFactorRGBA[3] != pCurrRS->BlendFactorRGBA[3] || pNewRS->SampleMask != pCurrRS->SampleMask) { pD3DImmContext->OMSetBlendState(pNewRS->pBState, pNewRS->BlendFactorRGBA, pNewRS->SampleMask); } if (!pCurrRS || pNewRS->pDSState != pCurrRS->pDSState || pNewRS->StencilRef != pCurrRS->StencilRef) { pD3DImmContext->OMSetDepthStencilState(pNewRS->pDSState, pNewRS->StencilRef); } if (!pCurrRS || pNewRS->pRState != pCurrRS->pRState) pD3DImmContext->RSSetState(pNewRS->pRState); } else { constexpr float EmptyFloats[4] = { 0 }; pD3DImmContext->VSSetShader(nullptr, nullptr, 0); pD3DImmContext->HSSetShader(nullptr, nullptr, 0); pD3DImmContext->DSSetShader(nullptr, nullptr, 0); pD3DImmContext->GSSetShader(nullptr, nullptr, 0); pD3DImmContext->PSSetShader(nullptr, nullptr, 0); pD3DImmContext->OMSetBlendState(nullptr, EmptyFloats, 0xffffffff); pD3DImmContext->OMSetDepthStencilState(nullptr, 0); pD3DImmContext->RSSetState(nullptr); } CurrRS = std::move(NewRS); CurrDirtyFlags.Clear(GPU_Dirty_RS); } if (Update.Is(GPU_Dirty_VL) && CurrDirtyFlags.Is(GPU_Dirty_VL)) { InputLayoutDirty = true; CurrDirtyFlags.Clear(GPU_Dirty_VL); } if (InputLayoutDirty) { UPTR InputSigID = CurrRS.IsValidPtr() && CurrRS->VS.IsValidPtr() ? CurrRS->VS->GetInputSignatureID() : 0; ID3D11InputLayout* pNewCurrIL = GetD3DInputLayout(*CurrVL, InputSigID); if (pCurrIL != pNewCurrIL) { pD3DImmContext->IASetInputLayout(pNewCurrIL); pCurrIL = pNewCurrIL; } } if (Update.Is(GPU_Dirty_CB) && CurrDirtyFlags.Is(GPU_Dirty_CB)) { ID3D11Buffer* D3DBuffers[D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT]; UPTR Offset = 0; for (UPTR Sh = 0; Sh < ShaderType_COUNT; ++Sh, Offset += D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT) { UPTR ShdDirtyFlag = (1 << (Shader_Dirty_CBuffers + Sh)); if (ShaderParamsDirtyFlags.IsNot(ShdDirtyFlag)) continue; for (UPTR i = 0; i < D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT; ++i) { const CD3D11ConstantBuffer* pCB = CurrCB[Offset + i].Get(); D3DBuffers[i] = pCB ? pCB->GetD3DBuffer() : nullptr; } switch ((EShaderType)Sh) { case ShaderType_Vertex: pD3DImmContext->VSSetConstantBuffers(0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT, D3DBuffers); break; case ShaderType_Pixel: pD3DImmContext->PSSetConstantBuffers(0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT, D3DBuffers); break; case ShaderType_Geometry: pD3DImmContext->GSSetConstantBuffers(0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT, D3DBuffers); break; case ShaderType_Hull: pD3DImmContext->HSSetConstantBuffers(0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT, D3DBuffers); break; case ShaderType_Domain: pD3DImmContext->DSSetConstantBuffers(0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT, D3DBuffers); break; }; ShaderParamsDirtyFlags.Clear(ShdDirtyFlag); } CurrDirtyFlags.Clear(GPU_Dirty_CB); } if (Update.Is(GPU_Dirty_SS) && CurrDirtyFlags.Is(GPU_Dirty_SS)) { ID3D11SamplerState* D3DSamplers[D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT]; UPTR Offset = 0; for (UPTR Sh = 0; Sh < ShaderType_COUNT; ++Sh, Offset += D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT) { UPTR ShdDirtyFlag = (1 << (Shader_Dirty_Samplers + Sh)); if (ShaderParamsDirtyFlags.IsNot(ShdDirtyFlag)) continue; for (UPTR i = 0; i < D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT; ++i) { const CD3D11Sampler* pSamp = CurrSS[Offset + i].Get(); D3DSamplers[i] = pSamp ? pSamp->GetD3DSampler() : nullptr; } switch ((EShaderType)Sh) { case ShaderType_Vertex: pD3DImmContext->VSSetSamplers(0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT, D3DSamplers); break; case ShaderType_Pixel: pD3DImmContext->PSSetSamplers(0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT, D3DSamplers); break; case ShaderType_Geometry: pD3DImmContext->GSSetSamplers(0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT, D3DSamplers); break; case ShaderType_Hull: pD3DImmContext->HSSetSamplers(0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT, D3DSamplers); break; case ShaderType_Domain: pD3DImmContext->DSSetSamplers(0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT, D3DSamplers); break; }; ShaderParamsDirtyFlags.Clear(ShdDirtyFlag); } CurrDirtyFlags.Clear(GPU_Dirty_SS); } // This array is used to set pointer values into a D3D context. It can be force-casted to any type. // We define it on stack and therefore avoid a per-frame dynamic allocation or unsafe _malloca. // VS offsets & strides are stored in this buffer too. constexpr UPTR PtrArraySize = std::max(D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT, std::max((int)(D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT * 3), D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT)); void* PtrArray[PtrArraySize]; if (Update.Is(GPU_Dirty_SRV) && CurrDirtyFlags.Is(GPU_Dirty_SRV)) { if (!CurrSRV.empty()) { const UPTR SRVArrayMemSize = (MaxSRVSlotIndex + 1) * sizeof(ID3D11ShaderResourceView*); ID3D11ShaderResourceView** ppSRV = (ID3D11ShaderResourceView**)PtrArray; ::ZeroMemory(ppSRV, SRVArrayMemSize); UPTR CurrShaderType = ShaderType_Invalid; bool SkipShaderType = true; UPTR FirstSRVSlot; UPTR CurrSRVSlot; for (auto It = CurrSRV.begin(); ; ++It) { UPTR ShaderType; UPTR SRVSlot; const bool AtTheEnd = (It == CurrSRV.cend()); if (!AtTheEnd) { const UPTR CurrKey = It->first; ShaderType = (CurrKey >> 16); SRVSlot = (CurrKey & 0xffff); } if (AtTheEnd || ShaderType != CurrShaderType) { if (!SkipShaderType) { switch ((EShaderType)CurrShaderType) { case ShaderType_Vertex: pD3DImmContext->VSSetShaderResources(FirstSRVSlot, CurrSRVSlot - FirstSRVSlot + 1, ppSRV + FirstSRVSlot); break; case ShaderType_Pixel: pD3DImmContext->PSSetShaderResources(FirstSRVSlot, CurrSRVSlot - FirstSRVSlot + 1, ppSRV + FirstSRVSlot); break; case ShaderType_Geometry: pD3DImmContext->GSSetShaderResources(FirstSRVSlot, CurrSRVSlot - FirstSRVSlot + 1, ppSRV + FirstSRVSlot); break; case ShaderType_Hull: pD3DImmContext->HSSetShaderResources(FirstSRVSlot, CurrSRVSlot - FirstSRVSlot + 1, ppSRV + FirstSRVSlot); break; case ShaderType_Domain: pD3DImmContext->DSSetShaderResources(FirstSRVSlot, CurrSRVSlot - FirstSRVSlot + 1, ppSRV + FirstSRVSlot); break; }; ShaderParamsDirtyFlags.Clear(1 << (Shader_Dirty_Resources + CurrShaderType)); } if (AtTheEnd) break; if (!SkipShaderType) { ::ZeroMemory(ppSRV, SRVArrayMemSize); } CurrShaderType = ShaderType; FirstSRVSlot = SRVSlot; SkipShaderType = ShaderParamsDirtyFlags.IsNot(1 << (Shader_Dirty_Resources + CurrShaderType)); } if (SkipShaderType) continue; ppSRV[SRVSlot] = It->second.pSRV; CurrSRVSlot = SRVSlot; } } CurrDirtyFlags.Clear(GPU_Dirty_SRV); } if (Update.Is(GPU_Dirty_VB) && CurrDirtyFlags.Is(GPU_Dirty_VB)) { const UPTR MaxVBCount = CurrVB.size(); const UPTR PtrsSize = sizeof(ID3D11Buffer*) * MaxVBCount; const UPTR UINTsSize = sizeof(UINT) * MaxVBCount; char* pMem = (char*)PtrArray; n_assert(pMem); ID3D11Buffer** pVBs = (ID3D11Buffer**)pMem; UINT* pStrides = (UINT*)(pMem + PtrsSize); UINT* pOffsets = (UINT*)(pMem + PtrsSize + UINTsSize); //???PERF: skip all nullptr buffers prior to the first non-nullptr and all nullptr after the last non-nullptr and reduce count? for (UPTR i = 0; i < MaxVBCount; ++i) { CD3D11VertexBuffer* pVB = CurrVB[i].Get(); if (pVB) { pVBs[i] = pVB->GetD3DBuffer(); pStrides[i] = (UINT)pVB->GetVertexLayout()->GetVertexSizeInBytes(); pOffsets[i] = (UINT)CurrVBOffset[i]; } else { pVBs[i] = nullptr; pStrides[i] = 0; pOffsets[i] = 0; } } pD3DImmContext->IASetVertexBuffers(0, MaxVBCount, pVBs, pStrides, pOffsets); CurrDirtyFlags.Clear(GPU_Dirty_VB); } if (Update.Is(GPU_Dirty_IB) && CurrDirtyFlags.Is(GPU_Dirty_IB)) { if (CurrIB.IsValidPtr()) { const DXGI_FORMAT Fmt = CurrIB.Get()->GetIndexType() == Index_32 ? DXGI_FORMAT_R32_UINT : DXGI_FORMAT_R16_UINT; pD3DImmContext->IASetIndexBuffer(CurrIB.Get()->GetD3DBuffer(), Fmt, 0); } else pD3DImmContext->IASetIndexBuffer(nullptr, DXGI_FORMAT_UNKNOWN, 0); CurrDirtyFlags.Clear(GPU_Dirty_IB); } CD3D11RenderTarget* pValidRT = nullptr; // All render targets and a depth-stencil buffer are set atomically in D3D11 if (Update.IsAny(GPU_Dirty_RT | GPU_Dirty_DS) && CurrDirtyFlags.IsAny(GPU_Dirty_RT | GPU_Dirty_DS)) { ID3D11RenderTargetView** pRTV = (ID3D11RenderTargetView**)PtrArray; n_assert(pRTV); for (UPTR i = 0; i < CurrRT.size(); ++i) { CD3D11RenderTarget* pRT = CurrRT[i].Get(); if (pRT) { pRTV[i] = pRT->GetD3DRTView(); pValidRT = pRT; } else pRTV[i] = nullptr; } ID3D11DepthStencilView* pDSV = CurrDS.IsValidPtr() ? CurrDS->GetD3DDSView() : nullptr; pD3DImmContext->OMSetRenderTargets(CurrRT.size(), pRTV, pDSV); //OMSetRenderTargetsAndUnorderedAccessViews // If at least one valid RT and at least one default (unset) VP exist, we check // if RT dimensions are changed, and refill all default (unset) VPs properly. // If no valid RTs are set, we cancel VP updating as it has no meaning. if (pValidRT) { UPTR RTWidth = pValidRT->GetDesc().Width; UPTR RTHeight = pValidRT->GetDesc().Height; bool UnsetVPFound = false; for (UPTR i = 0; i < MaxViewportCount; ++i) { if (VPSRSetFlags.Is(1 << i)) continue; D3D11_VIEWPORT& D3DVP = CurrVP[i]; if (!UnsetVPFound) { // All other default values are fixed: X = 0, Y = 0, MinDepth = 0.f, MaxDepth = 1.f if ((UPTR)D3DVP.Width == RTWidth && (UPTR)D3DVP.Height == RTHeight) break; UnsetVPFound = true; CurrDirtyFlags.Set(GPU_Dirty_VP); Update.Set(GPU_Dirty_VP); } // If we are here, RT dimensions were changed, so update default VP values D3DVP.Width = (float)RTWidth; D3DVP.Height = (float)RTHeight; } } else CurrDirtyFlags.Clear(GPU_Dirty_VP); CurrDirtyFlags.Clear(GPU_Dirty_RT | GPU_Dirty_DS); } // Viewports if (Update.Is(GPU_Dirty_VP) && CurrDirtyFlags.Is(GPU_Dirty_VP)) { // Find the last set VP, as we must set all viewports from 0'th to it. // At least one default viewport must be specified, so NumVP is no less than 1. UPTR NumVP = MaxViewportCount; for (; NumVP > 1; --NumVP) if (VPSRSetFlags.Is(1 << (NumVP - 1))) break; pD3DImmContext->RSSetViewports(NumVP, CurrVP); CurrDirtyFlags.Clear(GPU_Dirty_VP); } // Scissor rects //???set viewports and scissor rects atomically? //???what hapens with set SRs when VPs are set? if (Update.Is(GPU_Dirty_SR) && CurrDirtyFlags.Is(GPU_Dirty_SR)) { // Find the last set SR, as we must set all rects from 0'th to it // 16 high bits of VPSRSetFlags are SR flags UPTR NumSR = VP_OR_SR_SET_FLAG_COUNT; for (; NumSR > 1; --NumSR) if (VPSRSetFlags.Is(1 << (VP_OR_SR_SET_FLAG_COUNT + NumSR - 1))) break; pD3DImmContext->RSSetScissorRects(NumSR, NumSR ? CurrSR : nullptr); CurrDirtyFlags.Clear(GPU_Dirty_SR); } return Errors; } //--------------------------------------------------------------------- // Gets or creates an actual layout for the given vertex layout and shader input signature ID3D11InputLayout* CD3D11GPUDriver::GetD3DInputLayout(CD3D11VertexLayout& VertexLayout, UPTR ShaderInputSignatureID, const Data::IBuffer* pSignature) { if (!ShaderInputSignatureID) return nullptr; ID3D11InputLayout* pLayout = VertexLayout.GetD3DInputLayout(ShaderInputSignatureID); if (pLayout) return pLayout; const D3D11_INPUT_ELEMENT_DESC* pD3DDesc = VertexLayout.GetCachedD3DLayoutDesc(); if (!pD3DDesc) return nullptr; if (!pSignature) { pSignature = _DriverFactory->FindShaderInputSignature(ShaderInputSignatureID); if (!pSignature) return nullptr; } if (FAILED(pD3DDevice->CreateInputLayout(pD3DDesc, VertexLayout.GetComponentCount(), pSignature->GetConstPtr(), pSignature->GetSize(), &pLayout))) return nullptr; n_verify_dbg(VertexLayout.AddLayoutObject(ShaderInputSignatureID, pLayout)); return pLayout; } //--------------------------------------------------------------------- // Creates transparent user object PVertexLayout CD3D11GPUDriver::CreateVertexLayout(const CVertexComponent* pComponents, UPTR Count) { const UPTR MAX_VERTEX_COMPONENTS = 32; if (!pComponents || !Count || Count > MAX_VERTEX_COMPONENTS) return nullptr; CStrID Signature = CVertexLayout::BuildSignature(pComponents, Count); auto It = VertexLayouts.find(Signature); if (It != VertexLayouts.cend()) return It->second.Get(); UPTR MaxVertexStreams = GetMaxVertexStreams(); D3D11_INPUT_ELEMENT_DESC DeclData[MAX_VERTEX_COMPONENTS] = { 0 }; for (UPTR i = 0; i < Count; ++i) { const CVertexComponent& Component = pComponents[i]; UPTR StreamIndex = Component.Stream; if (StreamIndex >= MaxVertexStreams) return nullptr; D3D11_INPUT_ELEMENT_DESC& DeclElement = DeclData[i]; switch (Component.Semantic) { case EVertexComponentSemantic::Position: DeclElement.SemanticName = "POSITION"; break; case EVertexComponentSemantic::Normal: DeclElement.SemanticName = "NORMAL"; break; case EVertexComponentSemantic::Tangent: DeclElement.SemanticName = "TANGENT"; break; case EVertexComponentSemantic::Bitangent: DeclElement.SemanticName = "BINORMAL"; break; case EVertexComponentSemantic::TexCoord: DeclElement.SemanticName = "TEXCOORD"; break; case EVertexComponentSemantic::Color: DeclElement.SemanticName = "COLOR"; break; case EVertexComponentSemantic::BoneWeights: DeclElement.SemanticName = "BLENDWEIGHT"; break; case EVertexComponentSemantic::BoneIndices: DeclElement.SemanticName = "BLENDINDICES"; break; case EVertexComponentSemantic::UserDefined: DeclElement.SemanticName = Component.UserDefinedName; break; default: return nullptr; } DeclElement.SemanticIndex = Component.Index; switch (Component.Format) { case EVertexComponentFormat::Float32_1: DeclElement.Format = DXGI_FORMAT_R32_FLOAT; break; case EVertexComponentFormat::Float32_2: DeclElement.Format = DXGI_FORMAT_R32G32_FLOAT; break; case EVertexComponentFormat::Float32_3: DeclElement.Format = DXGI_FORMAT_R32G32B32_FLOAT; break; case EVertexComponentFormat::Float32_4: DeclElement.Format = DXGI_FORMAT_R32G32B32A32_FLOAT; break; case EVertexComponentFormat::Float16_2: DeclElement.Format = DXGI_FORMAT_R16G16_FLOAT; break; case EVertexComponentFormat::Float16_4: DeclElement.Format = DXGI_FORMAT_R16G16B16A16_FLOAT; break; case EVertexComponentFormat::UInt8_4: DeclElement.Format = DXGI_FORMAT_R8G8B8A8_UINT; break; case EVertexComponentFormat::UInt8_4_Norm: DeclElement.Format = DXGI_FORMAT_R8G8B8A8_UNORM; break; case EVertexComponentFormat::SInt16_2: DeclElement.Format = DXGI_FORMAT_R16G16_SINT; break; case EVertexComponentFormat::SInt16_4: DeclElement.Format = DXGI_FORMAT_R16G16B16A16_SINT; break; case EVertexComponentFormat::SInt16_2_Norm: DeclElement.Format = DXGI_FORMAT_R16G16_SNORM; break; case EVertexComponentFormat::SInt16_4_Norm: DeclElement.Format = DXGI_FORMAT_R16G16B16A16_SNORM; break; case EVertexComponentFormat::UInt16_2_Norm: DeclElement.Format = DXGI_FORMAT_R16G16_UNORM; break; case EVertexComponentFormat::UInt16_4_Norm: DeclElement.Format = DXGI_FORMAT_R16G16B16A16_UNORM; break; default: return nullptr; } DeclElement.InputSlot = StreamIndex; DeclElement.AlignedByteOffset = (Component.OffsetInVertex == VertexComponentOffsetAuto) ? D3D11_APPEND_ALIGNED_ELEMENT : Component.OffsetInVertex; if (Component.PerInstanceData) { DeclElement.InputSlotClass = D3D11_INPUT_PER_INSTANCE_DATA; DeclElement.InstanceDataStepRate = 1; } else { DeclElement.InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA; DeclElement.InstanceDataStepRate = 0; } } PD3D11VertexLayout Layout = n_new(CD3D11VertexLayout); if (!Layout->Create(pComponents, Count, DeclData)) return nullptr; VertexLayouts.emplace(Signature, Layout); return Layout.Get(); } //--------------------------------------------------------------------- PVertexBuffer CD3D11GPUDriver::CreateVertexBuffer(CVertexLayout& VertexLayout, UPTR VertexCount, UPTR AccessFlags, const void* pData) { if (!pD3DDevice || !VertexCount || !VertexLayout.GetVertexSizeInBytes()) return nullptr; D3D11_USAGE Usage; UINT CPUAccess; if (!GetUsageAccess(AccessFlags, !!pData, Usage, CPUAccess)) return nullptr; D3D11_BUFFER_DESC Desc; Desc.Usage = Usage; Desc.ByteWidth = VertexCount * VertexLayout.GetVertexSizeInBytes(); Desc.BindFlags = D3D11_BIND_VERTEX_BUFFER; Desc.CPUAccessFlags = CPUAccess; Desc.MiscFlags = 0; D3D11_SUBRESOURCE_DATA* pInitData = nullptr; D3D11_SUBRESOURCE_DATA InitData; if (pData) { InitData.pSysMem = pData; pInitData = &InitData; } ID3D11Buffer* pD3DBuf = nullptr; if (FAILED(pD3DDevice->CreateBuffer(&Desc, pInitData, &pD3DBuf))) return nullptr; PD3D11VertexBuffer VB = n_new(CD3D11VertexBuffer); if (!VB->Create(VertexLayout, pD3DBuf)) { pD3DBuf->Release(); return nullptr; } return VB.Get(); } //--------------------------------------------------------------------- PIndexBuffer CD3D11GPUDriver::CreateIndexBuffer(EIndexType IndexType, UPTR IndexCount, UPTR AccessFlags, const void* pData) { if (!pD3DDevice || !IndexCount) return nullptr; D3D11_USAGE Usage; UINT CPUAccess; if (!GetUsageAccess(AccessFlags, !!pData, Usage, CPUAccess)) return nullptr; D3D11_BUFFER_DESC Desc; Desc.Usage = Usage; Desc.ByteWidth = IndexCount * (UPTR)IndexType; Desc.BindFlags = D3D11_BIND_INDEX_BUFFER; Desc.CPUAccessFlags = CPUAccess; Desc.MiscFlags = 0; D3D11_SUBRESOURCE_DATA* pInitData = nullptr; D3D11_SUBRESOURCE_DATA InitData; if (pData) { InitData.pSysMem = pData; pInitData = &InitData; } ID3D11Buffer* pD3DBuf = nullptr; if (FAILED(pD3DDevice->CreateBuffer(&Desc, pInitData, &pD3DBuf))) return nullptr; PD3D11IndexBuffer IB = n_new(CD3D11IndexBuffer); if (!IB->Create(IndexType, pD3DBuf)) { pD3DBuf->Release(); return nullptr; } return IB.Get(); } //--------------------------------------------------------------------- //!!!shader reflection doesn't return StructuredBuffer element count! So we must pass it here and ignore parameter for other buffers! //!!!or we must determine buffer size in shader comments(annotations?) / in effect desc! PD3D11ConstantBuffer CD3D11GPUDriver::InternalCreateConstantBuffer(EUSMBufferType Type, U32 Size, UPTR AccessFlags, const CConstantBuffer* pData, bool Temporary) { D3D11_USAGE Usage; UINT CPUAccess; if (!GetUsageAccess(AccessFlags, !!pData, Usage, CPUAccess)) return nullptr; D3D11_BUFFER_DESC Desc; Desc.Usage = Usage; Desc.CPUAccessFlags = CPUAccess; UPTR TotalSize = Size; // * ElementCount; //!!!for StructuredBuffer! or precompute in metadata? if (Type == USMBuffer_Constant) { UPTR ElementCount = (TotalSize + 15) >> 4; if (ElementCount > D3D11_REQ_CONSTANT_BUFFER_ELEMENT_COUNT) return nullptr; Desc.ByteWidth = ElementCount << 4; Desc.BindFlags = (Usage == D3D11_USAGE_STAGING) ? 0 : D3D11_BIND_CONSTANT_BUFFER; } else { Desc.ByteWidth = TotalSize; Desc.BindFlags = (Usage == D3D11_USAGE_STAGING) ? 0 : D3D11_BIND_SHADER_RESOURCE; } if (Type == USMBuffer_Structured) { Desc.MiscFlags = D3D11_RESOURCE_MISC_BUFFER_STRUCTURED; Desc.StructureByteStride = Size; } else { Desc.MiscFlags = 0; Desc.StructureByteStride = 0; } D3D11_SUBRESOURCE_DATA* pInitData = nullptr; D3D11_SUBRESOURCE_DATA InitData; if (pData) { if (!pData->IsA<CD3D11ConstantBuffer>()) return nullptr; const CD3D11ConstantBuffer* pDataCB11 = (const CD3D11ConstantBuffer*)pData; InitData.pSysMem = pDataCB11->GetRAMCopy(); pInitData = &InitData; } ID3D11Buffer* pD3DBuf = nullptr; if (FAILED(pD3DDevice->CreateBuffer(&Desc, pInitData, &pD3DBuf))) return nullptr; ID3D11ShaderResourceView* pSRV = nullptr; if (Desc.BindFlags & D3D11_BIND_SHADER_RESOURCE) { D3D11_SHADER_RESOURCE_VIEW_DESC SRVDesc; SRVDesc.Format = DXGI_FORMAT_R32G32B32A32_FLOAT; SRVDesc.ViewDimension = D3D11_SRV_DIMENSION_BUFFER; SRVDesc.Buffer.FirstElement = 0; SRVDesc.Buffer.NumElements = TotalSize / (4 * sizeof(float)); if (FAILED(pD3DDevice->CreateShaderResourceView(pD3DBuf, &SRVDesc, &pSRV))) { pD3DBuf->Release(); return nullptr; } } PD3D11ConstantBuffer CB = n_new(CD3D11ConstantBuffer(pD3DBuf, pSRV, Temporary)); if (!CB->IsValid()) return nullptr; //???or add manual control / some flag in a metadata? if (Usage != D3D11_USAGE_IMMUTABLE) { if (!CB->CreateRAMCopy()) return nullptr; } return CB; } //--------------------------------------------------------------------- //!!!shader reflection doesn't return StructuredBuffer element count! So we must pass it here and ignore parameter for other buffers! //!!!or we must determine buffer size in shader comments(annotations?) / in effect desc! PConstantBuffer CD3D11GPUDriver::CreateConstantBuffer(IConstantBufferParam& Param, UPTR AccessFlags, const CConstantBuffer* pData) { auto pUSMParam = Param.As<CUSMConstantBufferParam>(); if (!pD3DDevice || !pUSMParam || !pUSMParam->GetSize()) return nullptr; return InternalCreateConstantBuffer(pUSMParam->GetType(), pUSMParam->GetSize(), AccessFlags, pData, false); } //--------------------------------------------------------------------- PConstantBuffer CD3D11GPUDriver::CreateTemporaryConstantBuffer(IConstantBufferParam& Param) { auto pUSMParam = Param.As<CUSMConstantBufferParam>(); if (!pD3DDevice || !pUSMParam || !pUSMParam->GetSize()) return nullptr; // We create temporary buffers sized by powers of 2, to make reuse easier (the same // principle as for a small allocator). 16 bytes is the smallest possible buffer. UPTR NextPow2Size = std::max<U32>(16, NextPow2(pUSMParam->GetSize())/* * ElementCount; //!!!for StructuredBuffer!*/); auto& BufferPool = (pUSMParam->GetType() == USMBuffer_Structured) ? TmpStructuredBuffers : (pUSMParam->GetType() == USMBuffer_Texture) ? TmpTextureBuffers : TmpConstantBuffers; auto It = BufferPool.find(NextPow2Size); if (It != BufferPool.cend()) { if (CTmpCB* pHead = It->second) { It->second = pHead->pNext; PConstantBuffer CB = pHead->CB.Get(); TmpCBPool.Destroy(pHead); return CB; } } return InternalCreateConstantBuffer(pUSMParam->GetType(), NextPow2Size, Access_CPU_Write | Access_GPU_Read, nullptr, true); } //--------------------------------------------------------------------- // NB: when buffer is freed, we can reuse it immediately due to dynamic CB renaming, see: // https://developer.nvidia.com/content/constant-buffers-without-constant-pain-0 void CD3D11GPUDriver::FreeTemporaryConstantBuffer(CConstantBuffer& Buffer) { CD3D11ConstantBuffer& CB11 = (CD3D11ConstantBuffer&)Buffer; UPTR BufferSize = CB11.GetSizeInBytes(); #ifdef _DEBUG n_assert(BufferSize == NextPow2(CB11.GetSizeInBytes())); #endif CTmpCB* pNewNode = TmpCBPool.Construct(); pNewNode->CB = &CB11; if (IsConstantBufferBound(&CB11)) { pNewNode->pNext = pPendingCBHead; pPendingCBHead = pNewNode; } else { EUSMBufferType Type = CB11.GetType(); auto& BufferPool = (Type == USMBuffer_Structured) ? TmpStructuredBuffers : (Type == USMBuffer_Texture) ? TmpTextureBuffers : TmpConstantBuffers; auto It = BufferPool.find(BufferSize); if (It != BufferPool.cend()) { pNewNode->pNext = It->second; It->second = pNewNode; } else { pNewNode->pNext = nullptr; BufferPool.emplace(BufferSize, pNewNode); } } } //--------------------------------------------------------------------- bool CD3D11GPUDriver::IsConstantBufferBound(const CD3D11ConstantBuffer* pBuffer, EShaderType ExceptStage, UPTR ExceptSlot) { if (!pBuffer) FAIL; if (pBuffer->GetType() == USMBuffer_Constant) { if (ExceptStage == ShaderType_Invalid) { for (UPTR i = 0; i < CurrCB.size(); ++i) if (CurrCB[i] == pBuffer) OK; } else { UPTR ExceptIndex = ExceptSlot + ((UPTR)ExceptStage) * D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT; for (UPTR i = 0; i < CurrCB.size(); ++i) { if (i == ExceptIndex) continue; if (CurrCB[i] == pBuffer) OK; } } } else { if (ExceptStage == ShaderType_Invalid) { for (const auto& Pair : CurrSRV) if (Pair.second.CB == pBuffer) OK; } else { UPTR ExceptIndex = ExceptSlot | (ExceptStage << 16); for (const auto& [Key, Value] : CurrSRV) { if (Key == ExceptIndex) continue; if (Value.CB == pBuffer) OK; } } } FAIL; } //--------------------------------------------------------------------- void CD3D11GPUDriver::FreePendingTemporaryBuffer(const CD3D11ConstantBuffer* pBuffer, EShaderType Stage, UPTR Slot) { // Check whether there are pending buffers, this buffer is temporary and this buffer is not bound if (!pPendingCBHead || !pBuffer || !pBuffer->IsTemporary() || IsConstantBufferBound(pBuffer, Stage, Slot)) return; EUSMBufferType Type = pBuffer->GetType(); auto& BufferPool = (Type == USMBuffer_Structured) ? TmpStructuredBuffers : (Type == USMBuffer_Texture) ? TmpTextureBuffers : TmpConstantBuffers; CTmpCB* pPrevNode = nullptr; CTmpCB* pCurrNode = pPendingCBHead; while (pCurrNode) { if (pCurrNode->CB == pBuffer) { if (pPrevNode) pPrevNode->pNext = pCurrNode->pNext; else pPendingCBHead = pCurrNode->pNext; UPTR BufferSize = pBuffer->GetSizeInBytes(); n_assert_dbg(BufferSize == NextPow2(pBuffer->GetSizeInBytes())); auto It = BufferPool.find(BufferSize); if (It != BufferPool.cend()) { pCurrNode->pNext = It->second; It->second = pCurrNode; } else { pCurrNode->pNext = nullptr; BufferPool.emplace(BufferSize, pCurrNode); } break; } pPrevNode = pCurrNode; pCurrNode = pCurrNode->pNext; } } //--------------------------------------------------------------------- // if Data->MipDataProvided, order is ArrayElement[0] { Mip[0] ... Mip[N] } ... ArrayElement[M] { Mip[0] ... Mip[N] }, // else order is ArrayElement[0] { Mip[0] } ... ArrayElement[M] { Mip[0] }, where Mip[0] is an original data. PTexture CD3D11GPUDriver::CreateTexture(PTextureData Data, UPTR AccessFlags) { if (!pD3DDevice || !Data || !Data->Desc.Width || !Data->Desc.Height) return nullptr; const CTextureDesc& Desc = Data->Desc; if (Desc.Type != Texture_1D && Desc.Type != Texture_2D && Desc.Type != Texture_Cube && Desc.Type != Texture_3D) { Sys::Error("CD3D11GPUDriver::CreateTexture() > Unknown texture type %d\n", Desc.Type); return nullptr; } const void* pData = Data->Data ? Data->Data->GetConstPtr() : nullptr; DXGI_FORMAT DXGIFormat = CD3D11DriverFactory::PixelFormatToDXGIFormat(Desc.Format); UPTR QualityLvlCount = 0; if (Desc.MSAAQuality != MSAA_None) { if (FAILED(pD3DDevice->CheckMultisampleQualityLevels(DXGIFormat, (int)Desc.MSAAQuality, &QualityLvlCount)) || !QualityLvlCount) return nullptr; pData = nullptr; // MSAA resources can't be initialized with data } D3D11_USAGE Usage; UINT CPUAccess; if (!GetUsageAccess(AccessFlags, !!pData, Usage, CPUAccess)) return nullptr; UPTR MipLevels = Desc.MipLevels; UPTR ArraySize = (Desc.Type == Texture_3D) ? 1 : ((Desc.Type == Texture_Cube) ? 6 * Desc.ArraySize : Desc.ArraySize); UPTR MiscFlags = 0; //???if (MipLevels != 1) D3D11_RESOURCE_MISC_RESOURCE_CLAMP for ID3D11DeviceContext::SetResourceMinLOD() UPTR BindFlags = (Usage != D3D11_USAGE_STAGING) ? D3D11_BIND_SHADER_RESOURCE : 0; // Dynamic SRV: The resource can only be created with a single subresource. // The resource cannot be a texture array. The resource cannot be a mipmap chain. (c) Docs if (Usage == D3D11_USAGE_DYNAMIC && (MipLevels != 1 || ArraySize != 1)) { #ifdef _DEBUG Sys::DbgOut("CD3D11GPUDriver::CreateTexture() > Dynamic texture requested %d mips and %d array slices. D3D11 requires 1 for both. Values are changed to 1.\n", MipLevels, ArraySize); #endif MipLevels = 1; ArraySize = 1; } D3D11_SUBRESOURCE_DATA* pInitData = nullptr; if (pData) { UPTR BlockSize = CD3D11DriverFactory::DXGIFormatBlockSize(DXGIFormat); if (!MipLevels) MipLevels = GetMipLevelCount(Desc.Width, Desc.Height, BlockSize); n_assert_dbg(MipLevels <= D3D11_REQ_MIP_LEVELS); if (MipLevels > D3D11_REQ_MIP_LEVELS) MipLevels = D3D11_REQ_MIP_LEVELS; UPTR BPP = CD3D11DriverFactory::DXGIFormatBitsPerPixel(DXGIFormat); n_assert_dbg(BPP > 0); //???truncate MipCount if 1x1 size is reached before the last mip? //???texture and/or utility [inline] methods GetRowPitch(level, w, [h], fmt), GetSlicePitch(level, w, h, fmt OR rowpitch, h)? UPTR Pitch[D3D11_REQ_MIP_LEVELS], SlicePitch[D3D11_REQ_MIP_LEVELS]; if (BlockSize == 1) { for (UPTR Mip = 0; Mip < MipLevels; ++Mip) { UPTR MipWidth = Desc.Width >> Mip; UPTR MipHeight = Desc.Height >> Mip; if (!MipWidth) MipWidth = 1; if (!MipHeight) MipHeight = 1; Pitch[Mip] = (MipWidth * BPP + 7) >> 3; // Round up to the nearest byte SlicePitch[Mip] = Pitch[Mip] * MipHeight; } } else { for (UPTR Mip = 0; Mip < MipLevels; ++Mip) { UPTR MipWidth = Desc.Width >> Mip; UPTR MipHeight = Desc.Height >> Mip; if (!MipWidth) MipWidth = 1; if (!MipHeight) MipHeight = 1; UPTR BlockCountW = (MipWidth + BlockSize - 1) / BlockSize; UPTR BlockCountH = (MipHeight + BlockSize - 1) / BlockSize; Pitch[Mip] = (BlockCountW * BlockSize * BlockSize * BPP) >> 3; SlicePitch[Mip] = Pitch[Mip] * BlockCountH; } } // GPU mipmap generation is supported only for SRV + RT textures and is intended for // generating mips for texture render targets. Static mips are either pregenerated by a // toolchain or are omitted to save HDD loading time and will be generated now on CPU. // Order is ArrayElement[0] { Mip[1] ... Mip[N] } ... ArrayElement[M] { Mip[1] ... Mip[N] }. // Most detailed data Mip[0] is not copied to this buffer. Can also generate mips async in loader. char* pGeneratedMips = nullptr; if (!Data->MipDataProvided && MipLevels > 1) { NOT_IMPLEMENTED; //!!!generate mips by DirectXTex code or smth like that! #ifdef _DEBUG if (!pGeneratedMips) Sys::DbgOut("CD3D11GPUDriver::CreateTexture() > Mipmaps are not generated\n"); #endif } pInitData = n_new_array(D3D11_SUBRESOURCE_DATA, MipLevels * ArraySize); D3D11_SUBRESOURCE_DATA* pCurrInitData = pInitData; U8* pCurrData = (U8*)pData; for (UPTR Elm = 0; Elm < ArraySize; ++Elm) { pCurrInitData->pSysMem = pCurrData; pCurrInitData->SysMemPitch = Pitch[0]; pCurrInitData->SysMemSlicePitch = SlicePitch[0]; pCurrData += SlicePitch[0]; //!!!* MipDepth! ++pCurrInitData; for (UPTR Mip = 1; Mip < MipLevels; ++Mip) { if (Data->MipDataProvided) { pCurrInitData->pSysMem = pCurrData; pCurrInitData->SysMemPitch = Pitch[Mip]; pCurrInitData->SysMemSlicePitch = SlicePitch[Mip]; pCurrData += SlicePitch[Mip]; //!!!* MipDepth! ++pCurrInitData; } else if (pGeneratedMips) { pCurrInitData->pSysMem = pGeneratedMips; pCurrInitData->SysMemPitch = Pitch[Mip]; pCurrInitData->SysMemSlicePitch = SlicePitch[Mip]; pGeneratedMips += SlicePitch[Mip]; //!!!* MipDepth! ++pCurrInitData; } else { pCurrInitData->pSysMem = nullptr; pCurrInitData->SysMemPitch = 0; pCurrInitData->SysMemSlicePitch = 0; ++pCurrInitData; } } } } ID3D11Resource* pTexRsrc = nullptr; if (Desc.Type == Texture_1D) { D3D11_TEXTURE1D_DESC D3DDesc = { 0 }; D3DDesc.Width = Desc.Width; D3DDesc.MipLevels = MipLevels; D3DDesc.ArraySize = ArraySize; D3DDesc.Format = DXGIFormat; D3DDesc.Usage = Usage; D3DDesc.BindFlags = BindFlags; D3DDesc.CPUAccessFlags = CPUAccess; D3DDesc.MiscFlags = MiscFlags; ID3D11Texture1D* pD3DTex = nullptr; HRESULT hr = pD3DDevice->CreateTexture1D(&D3DDesc, pInitData, &pD3DTex); SAFE_DELETE_ARRAY(pInitData); if (FAILED(hr)) return nullptr; pTexRsrc = pD3DTex; } else if (Desc.Type == Texture_2D || Desc.Type == Texture_Cube) { D3D11_TEXTURE2D_DESC D3DDesc = { 0 }; D3DDesc.Width = Desc.Width; D3DDesc.Height = Desc.Height; D3DDesc.MipLevels = MipLevels; D3DDesc.ArraySize = ArraySize; D3DDesc.Format = DXGIFormat; D3DDesc.Usage = Usage; D3DDesc.BindFlags = BindFlags; D3DDesc.CPUAccessFlags = CPUAccess; D3DDesc.MiscFlags = MiscFlags; if (Desc.Type == Texture_Cube) D3DDesc.MiscFlags |= D3D11_RESOURCE_MISC_TEXTURECUBE; if (Desc.MSAAQuality == MSAA_None) { D3DDesc.SampleDesc.Count = 1; D3DDesc.SampleDesc.Quality = 0; } else { D3DDesc.SampleDesc.Count = static_cast<int>(Desc.MSAAQuality); D3DDesc.SampleDesc.Quality = QualityLvlCount - 1; // Can use predefined D3D11_STANDARD_MULTISAMPLE_PATTERN, D3D11_CENTER_MULTISAMPLE_PATTERN } ID3D11Texture2D* pD3DTex = nullptr; HRESULT hr = pD3DDevice->CreateTexture2D(&D3DDesc, pInitData, &pD3DTex); SAFE_DELETE_ARRAY(pInitData); if (FAILED(hr)) return nullptr; pTexRsrc = pD3DTex; } else if (Desc.Type == Texture_3D) { D3D11_TEXTURE3D_DESC D3DDesc = { 0 }; D3DDesc.Width = Desc.Width; D3DDesc.Height = Desc.Height; D3DDesc.Depth = Desc.Depth; D3DDesc.MipLevels = MipLevels; D3DDesc.Format = DXGIFormat; D3DDesc.Usage = Usage; D3DDesc.BindFlags = BindFlags; D3DDesc.CPUAccessFlags = CPUAccess; D3DDesc.MiscFlags = MiscFlags; ID3D11Texture3D* pD3DTex = nullptr; HRESULT hr = pD3DDevice->CreateTexture3D(&D3DDesc, pInitData, &pD3DTex); SAFE_DELETE_ARRAY(pInitData); if (FAILED(hr)) return nullptr; pTexRsrc = pD3DTex; } else { SAFE_DELETE_ARRAY(pInitData); return nullptr; } ID3D11ShaderResourceView* pSRV = nullptr; if ((BindFlags & D3D11_BIND_SHADER_RESOURCE) && FAILED(pD3DDevice->CreateShaderResourceView(pTexRsrc, nullptr, &pSRV))) { pTexRsrc->Release(); return nullptr; } PD3D11Texture Tex = n_new(CD3D11Texture); if (Tex.IsNullPtr()) return nullptr; if (!Tex->Create(Data, Usage, AccessFlags, pTexRsrc, pSRV)) { pSRV->Release(); pTexRsrc->Release(); return nullptr; } return Tex.Get(); } //--------------------------------------------------------------------- PSampler CD3D11GPUDriver::CreateSampler(const CSamplerDesc& Desc) { D3D11_SAMPLER_DESC D3DDesc; D3DDesc.AddressU = GetD3DTexAddressMode(Desc.AddressU); D3DDesc.AddressV = GetD3DTexAddressMode(Desc.AddressV); D3DDesc.AddressW = GetD3DTexAddressMode(Desc.AddressW); memcpy(D3DDesc.BorderColor, Desc.BorderColorRGBA, sizeof(D3DDesc.BorderColor)); D3DDesc.ComparisonFunc = GetD3DCmpFunc(Desc.CmpFunc); D3DDesc.Filter = GetD3DTexFilter(Desc.Filter, (Desc.CmpFunc != Cmp_Never)); D3DDesc.MaxAnisotropy = std::clamp<unsigned int>(Desc.MaxAnisotropy, 1, 16); D3DDesc.MaxLOD = Desc.CoarsestMipMapLOD; D3DDesc.MinLOD = Desc.FinestMipMapLOD; D3DDesc.MipLODBias = Desc.MipMapLODBias; ID3D11SamplerState* pD3DSamplerState = nullptr; if (FAILED(pD3DDevice->CreateSamplerState(&D3DDesc, &pD3DSamplerState))) return nullptr; // Since sampler creation should be load-time, it is not performance critical. // We can omit it and allow to create duplicate samplers, but maintaining uniquity // serves both for memory saving and early exits on redundant binding. for (auto& Sampler : Samplers) { if (Sampler->GetD3DSampler() == pD3DSamplerState) { pD3DSamplerState->Release(); return Sampler; } } PD3D11Sampler Samp = n_new(CD3D11Sampler); if (!Samp->Create(pD3DSamplerState)) { pD3DSamplerState->Release(); return nullptr; } Samplers.push_back(Samp); return Samp.Get(); } //--------------------------------------------------------------------- //???allow arrays? allow 3D and cubes? will need RT.Create or CreateRenderTarget(Texture, SurfaceLocation) PRenderTarget CD3D11GPUDriver::CreateRenderTarget(const CRenderTargetDesc& Desc) { DXGI_FORMAT Fmt = CD3D11DriverFactory::PixelFormatToDXGIFormat(Desc.Format); UPTR QualityLvlCount = 0; if (Desc.MSAAQuality != MSAA_None) if (FAILED(pD3DDevice->CheckMultisampleQualityLevels(Fmt, (int)Desc.MSAAQuality, &QualityLvlCount)) || !QualityLvlCount) return nullptr; D3D11_TEXTURE2D_DESC D3DDesc = {0}; D3DDesc.Width = Desc.Width; D3DDesc.Height = Desc.Height; D3DDesc.MipLevels = Desc.UseAsShaderInput ? Desc.MipLevels : 1; D3DDesc.ArraySize = 1; D3DDesc.Format = Fmt; if (Desc.MSAAQuality == MSAA_None) { D3DDesc.SampleDesc.Count = 1; D3DDesc.SampleDesc.Quality = 0; } else { D3DDesc.SampleDesc.Count = (int)Desc.MSAAQuality; D3DDesc.SampleDesc.Quality = QualityLvlCount - 1; // Can use predefined D3D11_STANDARD_MULTISAMPLE_PATTERN, D3D11_CENTER_MULTISAMPLE_PATTERN } D3DDesc.Usage = D3D11_USAGE_DEFAULT; D3DDesc.BindFlags = D3D11_BIND_RENDER_TARGET; D3DDesc.CPUAccessFlags = 0; D3DDesc.MiscFlags = 0; if (Desc.UseAsShaderInput) { D3DDesc.BindFlags |= D3D11_BIND_SHADER_RESOURCE; if (Desc.MipLevels != 1) D3DDesc.MiscFlags |= D3D11_RESOURCE_MISC_GENERATE_MIPS; // | D3D11_RESOURCE_MISC_RESOURCE_CLAMP } ID3D11Texture2D* pTexture = nullptr; if (FAILED(pD3DDevice->CreateTexture2D(&D3DDesc, nullptr, &pTexture))) return nullptr; ID3D11RenderTargetView* pRTV = nullptr; if (FAILED(pD3DDevice->CreateRenderTargetView(pTexture, nullptr, &pRTV))) { pTexture->Release(); return nullptr; } ID3D11ShaderResourceView* pSRV = nullptr; if (Desc.UseAsShaderInput) { if (FAILED(pD3DDevice->CreateShaderResourceView(pTexture, nullptr, &pSRV))) { pRTV->Release(); pTexture->Release(); return nullptr; } } pTexture->Release(); PD3D11RenderTarget RT = n_new(CD3D11RenderTarget); if (!RT->Create(pRTV, pSRV)) { if (pSRV) pSRV->Release(); pRTV->Release(); return nullptr; } return RT.Get(); } //--------------------------------------------------------------------- PDepthStencilBuffer CD3D11GPUDriver::CreateDepthStencilBuffer(const CRenderTargetDesc& Desc) { DXGI_FORMAT DSVFmt = CD3D11DriverFactory::PixelFormatToDXGIFormat(Desc.Format); if (DSVFmt == DXGI_FORMAT_UNKNOWN) FAIL; DXGI_FORMAT RsrcFmt, SRVFmt; if (Desc.UseAsShaderInput) { RsrcFmt = CD3D11DriverFactory::GetCorrespondingFormat(DSVFmt, FmtType_Typeless); if (RsrcFmt == DXGI_FORMAT_UNKNOWN) FAIL; SRVFmt = CD3D11DriverFactory::GetCorrespondingFormat(RsrcFmt, FmtType_Float, false); if (SRVFmt == DXGI_FORMAT_UNKNOWN) FAIL; } else RsrcFmt = DSVFmt; //???check DSV or texture fmt? UPTR QualityLvlCount = 0; if (Desc.MSAAQuality != MSAA_None) if (FAILED(pD3DDevice->CheckMultisampleQualityLevels(DSVFmt, (int)Desc.MSAAQuality, &QualityLvlCount)) || !QualityLvlCount) return nullptr; D3D11_TEXTURE2D_DESC D3DDesc = {0}; D3DDesc.Width = Desc.Width; D3DDesc.Height = Desc.Height; D3DDesc.MipLevels = 1; D3DDesc.ArraySize = 1; D3DDesc.Format = RsrcFmt; if (Desc.MSAAQuality == MSAA_None) { D3DDesc.SampleDesc.Count = 1; D3DDesc.SampleDesc.Quality = 0; } else { D3DDesc.SampleDesc.Count = (int)Desc.MSAAQuality; D3DDesc.SampleDesc.Quality = QualityLvlCount - 1; // Can use predefined D3D11_STANDARD_MULTISAMPLE_PATTERN, D3D11_CENTER_MULTISAMPLE_PATTERN } D3DDesc.Usage = D3D11_USAGE_DEFAULT; D3DDesc.BindFlags = D3D11_BIND_DEPTH_STENCIL; if (Desc.UseAsShaderInput) D3DDesc.BindFlags |= D3D11_BIND_SHADER_RESOURCE; D3DDesc.CPUAccessFlags = 0; D3DDesc.MiscFlags = 0; ID3D11Texture2D* pTexture = nullptr; if (FAILED(pD3DDevice->CreateTexture2D(&D3DDesc, nullptr, &pTexture))) return nullptr; D3D11_DEPTH_STENCIL_VIEW_DESC DSVDesc; if (Desc.MSAAQuality == MSAA_None) { DSVDesc.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2D; DSVDesc.Texture2D.MipSlice = 0; } else DSVDesc.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2DMS; DSVDesc.Format = DSVFmt; DSVDesc.Flags = 0; // D3D11_DSV_READ_ONLY_DEPTH, D3D11_DSV_READ_ONLY_STENCIL ID3D11DepthStencilView* pDSV = nullptr; if (FAILED(pD3DDevice->CreateDepthStencilView(pTexture, &DSVDesc, &pDSV))) { pTexture->Release(); return nullptr; } ID3D11ShaderResourceView* pSRV = nullptr; if (Desc.UseAsShaderInput) { D3D11_SHADER_RESOURCE_VIEW_DESC SRVDesc; if (Desc.MSAAQuality == MSAA_None) { SRVDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D; SRVDesc.Texture2D.MipLevels = -1; SRVDesc.Texture2D.MostDetailedMip = 0; } else SRVDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2DMS; SRVDesc.Format = SRVFmt; if (FAILED(pD3DDevice->CreateShaderResourceView(pTexture, &SRVDesc, &pSRV))) { pDSV->Release(); pTexture->Release(); return nullptr; } } pTexture->Release(); PD3D11DepthStencilBuffer DS = n_new(CD3D11DepthStencilBuffer); if (!DS->Create(pDSV, pSRV)) { if (pSRV) pSRV->Release(); pDSV->Release(); return nullptr; } return DS.Get(); } //--------------------------------------------------------------------- //???is AddRef invoked if runtime finds existing state? //!!!can create solid and wireframe variants of the same state for the fast switching! //???unused substates force default? say, stencil off - all stencil settings are default, //not to duplicate states. PRenderState CD3D11GPUDriver::CreateRenderState(const CRenderStateDesc& Desc) { ID3D11RasterizerState* pRState = nullptr; ID3D11DepthStencilState* pDSState = nullptr; ID3D11BlendState* pBState = nullptr; // Not supported (implement in D3D11 shaders): // - Misc_AlphaTestEnable // - AlphaTestRef // - AlphaTestFunc // - Misc_ClipPlaneEnable << 0 .. 5 // Convert absolute depth bias to D3D11-style. // Depth buffer is always floating-point, let it be 32-bit, with 23 bits for mantissa. float DepthBias = Desc.DepthBias * (float)(1 << 23); D3D11_RASTERIZER_DESC RDesc; RDesc.FillMode = Desc.Flags.Is(CRenderStateDesc::Rasterizer_Wireframe) ? D3D11_FILL_WIREFRAME : D3D11_FILL_SOLID; const bool CullFront = Desc.Flags.Is(CRenderStateDesc::Rasterizer_CullFront); const bool CullBack = Desc.Flags.Is(CRenderStateDesc::Rasterizer_CullBack); if (!CullFront && !CullBack) RDesc.CullMode = D3D11_CULL_NONE; else if (CullBack) RDesc.CullMode = D3D11_CULL_BACK; else RDesc.CullMode = D3D11_CULL_FRONT; RDesc.FrontCounterClockwise = Desc.Flags.Is(CRenderStateDesc::Rasterizer_FrontCCW); RDesc.DepthBias = (INT)DepthBias; RDesc.DepthBiasClamp = Desc.DepthBiasClamp; RDesc.SlopeScaledDepthBias = Desc.SlopeScaledDepthBias; RDesc.DepthClipEnable = Desc.Flags.Is(CRenderStateDesc::Rasterizer_DepthClipEnable); RDesc.ScissorEnable = Desc.Flags.Is(CRenderStateDesc::Rasterizer_ScissorEnable); RDesc.MultisampleEnable = Desc.Flags.Is(CRenderStateDesc::Rasterizer_MSAAEnable); RDesc.AntialiasedLineEnable = Desc.Flags.Is(CRenderStateDesc::Rasterizer_MSAALinesEnable); if (FAILED(pD3DDevice->CreateRasterizerState(&RDesc, &pRState))) goto ProcessFailure; D3D11_DEPTH_STENCIL_DESC DSDesc; DSDesc.DepthEnable = Desc.Flags.Is(CRenderStateDesc::DS_DepthEnable); DSDesc.DepthWriteMask = Desc.Flags.Is(CRenderStateDesc::DS_DepthWriteEnable) ? D3D11_DEPTH_WRITE_MASK_ALL : D3D11_DEPTH_WRITE_MASK_ZERO; DSDesc.DepthFunc = GetD3DCmpFunc(Desc.DepthFunc); DSDesc.StencilEnable = Desc.Flags.Is(CRenderStateDesc::DS_StencilEnable); DSDesc.StencilReadMask = Desc.StencilReadMask; DSDesc.StencilWriteMask = Desc.StencilWriteMask; DSDesc.FrontFace.StencilFunc = GetD3DCmpFunc(Desc.StencilFrontFace.StencilFunc); DSDesc.FrontFace.StencilPassOp = GetD3DStencilOp(Desc.StencilFrontFace.StencilPassOp); DSDesc.FrontFace.StencilFailOp = GetD3DStencilOp(Desc.StencilFrontFace.StencilFailOp); DSDesc.FrontFace.StencilDepthFailOp = GetD3DStencilOp(Desc.StencilFrontFace.StencilDepthFailOp); DSDesc.BackFace.StencilFunc = GetD3DCmpFunc(Desc.StencilBackFace.StencilFunc); DSDesc.BackFace.StencilPassOp = GetD3DStencilOp(Desc.StencilBackFace.StencilPassOp); DSDesc.BackFace.StencilFailOp = GetD3DStencilOp(Desc.StencilBackFace.StencilFailOp); DSDesc.BackFace.StencilDepthFailOp = GetD3DStencilOp(Desc.StencilBackFace.StencilDepthFailOp); if (FAILED(pD3DDevice->CreateDepthStencilState(&DSDesc, &pDSState))) goto ProcessFailure; D3D11_BLEND_DESC BDesc; BDesc.IndependentBlendEnable = Desc.Flags.Is(CRenderStateDesc::Blend_Independent); BDesc.AlphaToCoverageEnable = Desc.Flags.Is(CRenderStateDesc::Blend_AlphaToCoverage); for (UPTR i = 0; i < 8; ++i) { D3D11_RENDER_TARGET_BLEND_DESC& RTDesc = BDesc.RenderTarget[i]; if (i == 0 || BDesc.IndependentBlendEnable) { const CRenderStateDesc::CRTBlend& SrcRTDesc = Desc.RTBlend[i]; RTDesc.BlendEnable = Desc.Flags.Is(CRenderStateDesc::Blend_RTBlendEnable << i); RTDesc.SrcBlend = GetD3DBlendArg(SrcRTDesc.SrcBlendArg); RTDesc.DestBlend = GetD3DBlendArg(SrcRTDesc.DestBlendArg); RTDesc.BlendOp = GetD3DBlendOp(SrcRTDesc.BlendOp); RTDesc.SrcBlendAlpha = GetD3DBlendArg(SrcRTDesc.SrcBlendArgAlpha); RTDesc.DestBlendAlpha = GetD3DBlendArg(SrcRTDesc.DestBlendArgAlpha); RTDesc.BlendOpAlpha = GetD3DBlendOp(SrcRTDesc.BlendOpAlpha); RTDesc.RenderTargetWriteMask = SrcRTDesc.WriteMask & 0x0f; } else { RTDesc.BlendEnable = FALSE; RTDesc.SrcBlend = D3D11_BLEND_ONE; RTDesc.DestBlend = D3D11_BLEND_ZERO; RTDesc.BlendOp = D3D11_BLEND_OP_ADD; RTDesc.SrcBlendAlpha = D3D11_BLEND_ONE; RTDesc.DestBlendAlpha = D3D11_BLEND_ZERO; RTDesc.BlendOpAlpha = D3D11_BLEND_OP_ADD; RTDesc.RenderTargetWriteMask = 0; } } if (FAILED(pD3DDevice->CreateBlendState(&BDesc, &pBState))) goto ProcessFailure; // Since render state creation should be load-time, it is not performance critical. If we // skip this and create new CRenderState, sorting will consider them as different state sets. for (auto& RS : RenderStates) { CD3D11RenderState* pRS = RS.Get(); if (pRS->VS == Desc.VertexShader && pRS->PS == Desc.PixelShader && pRS->GS == Desc.GeometryShader && pRS->HS == Desc.HullShader && pRS->DS == Desc.DomainShader && pRS->pRState == pRState && pRS->pDSState == pDSState && pRS->pBState == pBState && pRS->StencilRef == Desc.StencilRef && pRS->BlendFactorRGBA[0] == Desc.BlendFactorRGBA[0] && pRS->BlendFactorRGBA[1] == Desc.BlendFactorRGBA[1] && pRS->BlendFactorRGBA[2] == Desc.BlendFactorRGBA[2] && pRS->BlendFactorRGBA[3] == Desc.BlendFactorRGBA[3] && pRS->SampleMask == Desc.SampleMask) { return pRS; //???release state interfaces? } } { PD3D11RenderState RS = n_new(CD3D11RenderState); RS->VS = (CD3D11Shader*)Desc.VertexShader.Get(); RS->PS = (CD3D11Shader*)Desc.PixelShader.Get(); RS->GS = (CD3D11Shader*)Desc.GeometryShader.Get(); RS->HS = (CD3D11Shader*)Desc.HullShader.Get(); RS->DS = (CD3D11Shader*)Desc.DomainShader.Get(); RS->pRState = pRState; RS->pDSState = pDSState; RS->pBState = pBState; RS->StencilRef = Desc.StencilRef; RS->BlendFactorRGBA[0] = Desc.BlendFactorRGBA[0]; RS->BlendFactorRGBA[1] = Desc.BlendFactorRGBA[1]; RS->BlendFactorRGBA[2] = Desc.BlendFactorRGBA[2]; RS->BlendFactorRGBA[3] = Desc.BlendFactorRGBA[3]; RS->SampleMask = Desc.SampleMask; //???store alpha ref as shader var? store clip plane enable as flag that signs to set clip plane vars? RenderStates.push_back(RS); return RS; } ProcessFailure: if (pRState) pRState->Release(); if (pDSState) pDSState->Release(); if (pBState) pBState->Release(); return nullptr; } //--------------------------------------------------------------------- PShader CD3D11GPUDriver::CreateShader(IO::IStream& Stream, bool LoadParamTable) { IO::CBinaryReader R(Stream); U32 ShaderFormatCode; if (!R.Read(ShaderFormatCode) || !SupportsShaderFormat(ShaderFormatCode)) return nullptr; U32 MinFeatureLevel; if (!R.Read(MinFeatureLevel) || static_cast<EGPUFeatureLevel>(MinFeatureLevel) > FeatureLevel) return nullptr; U8 ShaderTypeCode; if (!R.Read(ShaderTypeCode)) return nullptr; Render::EShaderType ShaderType = static_cast<EShaderType>(ShaderTypeCode); U32 MetadataSize; if (!R.Read(MetadataSize)) return nullptr; U32 InputSignatureID; if (!R.Read(InputSignatureID)) return nullptr; MetadataSize -= sizeof(U32); U64 RequiresFlags; if (!R.Read(RequiresFlags)) return nullptr; MetadataSize -= sizeof(U64); // TODO: check GPU against RequiresFlags PShaderParamTable Params; if (LoadParamTable) { Params = LoadShaderParamTable(ShaderFormatCode, Stream); if (!Params) return nullptr; } else { if (!Stream.Seek(MetadataSize, IO::Seek_Current)) return nullptr; } // Read the shader binary from rest of the stream auto ShaderBinary = Stream.ReadAll(); if (!ShaderBinary || !ShaderBinary->GetSize()) return nullptr; PD3D11Shader Shader; switch (ShaderType) { case ShaderType_Vertex: { ID3D11VertexShader* pVS = nullptr; if (FAILED(pD3DDevice->CreateVertexShader(ShaderBinary->GetConstPtr(), ShaderBinary->GetSize(), nullptr, &pVS))) return nullptr; Shader = n_new(CD3D11Shader(pVS, InputSignatureID, Params)); break; } case ShaderType_Pixel: { ID3D11PixelShader* pPS = nullptr; if (FAILED(pD3DDevice->CreatePixelShader(ShaderBinary->GetConstPtr(), ShaderBinary->GetSize(), nullptr, &pPS))) return nullptr; Shader = n_new(CD3D11Shader(pPS, Params)); break; } case ShaderType_Geometry: { //???need stream output? or separate method? or separate shader type? ID3D11GeometryShader* pGS = nullptr; if (FAILED(pD3DDevice->CreateGeometryShader(ShaderBinary->GetConstPtr(), ShaderBinary->GetSize(), nullptr, &pGS))) return nullptr; Shader = n_new(CD3D11Shader(pGS, InputSignatureID, Params)); break; } case ShaderType_Hull: { ID3D11HullShader* pHS = nullptr; if (FAILED(pD3DDevice->CreateHullShader(ShaderBinary->GetConstPtr(), ShaderBinary->GetSize(), nullptr, &pHS))) return nullptr; Shader = n_new(CD3D11Shader(pHS, Params)); break; } case ShaderType_Domain: { ID3D11DomainShader* pDS = nullptr; if (FAILED(pD3DDevice->CreateDomainShader(ShaderBinary->GetConstPtr(), ShaderBinary->GetSize(), nullptr, &pDS))) return nullptr; Shader = n_new(CD3D11Shader(pDS, Params)); break; } default: return nullptr; }; if (!Shader->IsValid()) return nullptr; if (ShaderType == Render::ShaderType_Vertex || ShaderType == Render::ShaderType_Geometry) { // Vertex shader input comes from input assembler stage (IA). In D3D10 and later // input layouts are created from VS input signatures (or at least are validated // against them). Input layout, once created, can be reused with any vertex shader // with the same input signature. /* // If no signature, can load this shader itself with some unique ID, for example negative. // This must never happen for shaders built in DEM, so we omit handling this case. if (InputSignatureID == 0) { if (!_DriverFactory->RegisterShaderInputSignature(InputSignatureID, std::move(Data))) return nullptr; } */ if (!_DriverFactory->FindShaderInputSignature(InputSignatureID)) { //!!!DBG TMP! std::string FileName("Data:shaders/d3d_usm/sig/"); FileName += std::to_string(InputSignatureID); FileName += ".sig"; IO::PStream File = IOSrv->CreateStream(FileName.c_str(), IO::SAM_READ, IO::SAP_SEQUENTIAL); if (!File || !File->IsOpened()) return nullptr; auto Buffer = File->ReadAll(); if (!Buffer) return nullptr; if (!_DriverFactory->RegisterShaderInputSignature(InputSignatureID, std::move(Buffer))) return nullptr; } } return Shader.Get(); } //--------------------------------------------------------------------- PShaderParamTable CD3D11GPUDriver::LoadShaderParamTable(uint32_t ShaderFormatCode, IO::IStream& Stream) { if (!SupportsShaderFormat(ShaderFormatCode)) return nullptr; IO::CBinaryReader R(Stream); U32 Count; if (!R.Read(Count)) return nullptr; std::vector<PConstantBufferParam> Buffers(Count); for (auto& BufferPtr : Buffers) { auto Name = R.Read<CStrID>(); auto Register = R.Read<U32>(); auto Size = R.Read<U32>(); EUSMBufferType Type; switch (Register >> 30) { case 0: Type = USMBuffer_Constant; break; case 1: Type = USMBuffer_Texture; break; case 2: Type = USMBuffer_Structured; break; default: return nullptr; }; Register &= 0x3fffffff; // Clear bits 30 and 31 BufferPtr = n_new(CUSMConstantBufferParam(Name, 0, Type, Register, Size)); } if (!R.Read(Count)) return nullptr; std::vector<PShaderStructureInfo> Structs(Count); // Precreate for valid referencing (see StructIndex) for (auto& StructPtr : Structs) StructPtr = n_new(CShaderStructureInfo); for (auto& StructPtr : Structs) { auto& Struct = *StructPtr; std::vector<PShaderConstantInfo> Members(R.Read<U32>()); for (auto& MemberPtr : Members) { MemberPtr = n_new(CUSMConstantInfo()); auto& Member = *static_cast<CUSMConstantInfo*>(MemberPtr.Get()); if (!R.Read(Member.Name)) return nullptr; U32 StructIndex; if (!R.Read(StructIndex)) return nullptr; if (StructIndex != static_cast<U32>(-1)) Member.Struct = Structs[StructIndex]; Member.Type = static_cast<EUSMConstType>(R.Read<U8>()); if (!R.Read(Member.LocalOffset)) return nullptr; if (!R.Read(Member.ElementStride)) return nullptr; if (!R.Read(Member.ElementCount)) return nullptr; if (!R.Read(Member.Columns)) return nullptr; if (!R.Read(Member.Rows)) return nullptr; if (!R.Read(Member.Flags)) return nullptr; Member.CalculateCachedValues(); } Struct.SetMembers(std::move(Members)); } if (!R.Read(Count)) return nullptr; std::vector<CShaderConstantParam> Consts(Count); for (auto& Const : Consts) { U8 ShaderTypeMask; if (!R.Read(ShaderTypeMask)) return nullptr; PUSMConstantInfo Info = n_new(CUSMConstantInfo()); if (!R.Read(Info->Name)) return nullptr; if (!R.Read(Info->BufferIndex)) return nullptr; if (Info->BufferIndex >= Buffers.size()) return nullptr; U32 StructIndex; if (!R.Read(StructIndex)) return nullptr; if (StructIndex != static_cast<U32>(-1)) Info->Struct = Structs[StructIndex]; Info->Type = static_cast<EUSMConstType>(R.Read<U8>()); if (!R.Read(Info->LocalOffset)) return nullptr; if (!R.Read(Info->ElementStride)) return nullptr; if (!R.Read(Info->ElementCount)) return nullptr; if (!R.Read(Info->Columns)) return nullptr; if (!R.Read(Info->Rows)) return nullptr; if (!R.Read(Info->Flags)) return nullptr; auto pBuffer = static_cast<CUSMConstantBufferParam*>(Buffers[Info->BufferIndex].Get()); pBuffer->AddShaderTypes(ShaderTypeMask); Info->CalculateCachedValues(); Const = CShaderConstantParam(Info); } if (!R.Read(Count)) return nullptr; std::vector<PResourceParam> Resources(Count); for (auto& ResourcePtr : Resources) { auto ShaderTypeMask = R.Read<U8>(); auto Name = R.Read<CStrID>(); auto Type = static_cast<EUSMResourceType>(R.Read<U8>()); auto RegisterStart = R.Read<U32>(); auto RegisterCount = R.Read<U32>(); ResourcePtr = n_new(CUSMResourceParam(Name, ShaderTypeMask, Type, RegisterStart, RegisterCount)); } if (!R.Read(Count)) return nullptr; std::vector<PSamplerParam> Samplers(Count); for (auto& SamplerPtr : Samplers) { auto ShaderTypeMask = R.Read<U8>(); auto Name = R.Read<CStrID>(); auto RegisterStart = R.Read<U32>(); auto RegisterCount = R.Read<U32>(); SamplerPtr = n_new(CUSMSamplerParam(Name, ShaderTypeMask, RegisterStart, RegisterCount)); } return n_new(CShaderParamTable(std::move(Consts), std::move(Buffers), std::move(Resources), std::move(Samplers))); } //--------------------------------------------------------------------- // Pointer will be 16-byte aligned bool CD3D11GPUDriver::MapResource(void** ppOutData, const CVertexBuffer& Resource, EResourceMapMode Mode) { n_assert_dbg(Resource.IsA<CD3D11VertexBuffer>()); if (!ppOutData) FAIL; ID3D11Buffer* pVB = ((const CD3D11VertexBuffer&)Resource).GetD3DBuffer(); if (!pVB) FAIL; //???set locked flag on resource or can check it by API? //???assert or check CPU access?! or Resource.CanMap()? D3D11_MAP MapType; UPTR MapFlags; GetD3DMapTypeAndFlags(Mode, MapType, MapFlags); D3D11_MAPPED_SUBRESOURCE D3DData; if (FAILED(pD3DImmContext->Map(pVB, 0, MapType, MapFlags, &D3DData))) FAIL; *ppOutData = D3DData.pData; OK; } //--------------------------------------------------------------------- //!!!DUPLICATE CODE, move to internal MapD3DBuffer()?! // Pointer will be 16-byte aligned bool CD3D11GPUDriver::MapResource(void** ppOutData, const CIndexBuffer& Resource, EResourceMapMode Mode) { n_assert_dbg(Resource.IsA<CD3D11IndexBuffer>()); if (!ppOutData) FAIL; ID3D11Buffer* pIB = ((const CD3D11IndexBuffer&)Resource).GetD3DBuffer(); if (!pIB) FAIL; //???set locked flag on resource or can check it by API? //???assert or check CPU access?! or Resource.CanMap()? D3D11_MAP MapType; UPTR MapFlags; GetD3DMapTypeAndFlags(Mode, MapType, MapFlags); D3D11_MAPPED_SUBRESOURCE D3DData; if (FAILED(pD3DImmContext->Map(pIB, 0, MapType, MapFlags, &D3DData))) FAIL; *ppOutData = D3DData.pData; OK; } //--------------------------------------------------------------------- // Pointer will be 16-byte aligned bool CD3D11GPUDriver::MapResource(CImageData& OutData, const CTexture& Resource, EResourceMapMode Mode, UPTR ArraySlice, UPTR MipLevel) { n_assert_dbg(Resource.IsA<CD3D11Texture>()); ID3D11Resource* pD3DTexRsrc = ((const CD3D11Texture&)Resource).GetD3DResource(); if (!pD3DTexRsrc) FAIL; //???set locked flag on SUBresource or can check it by API? //???assert or check CPU access?! or Resource.CanMap()? const CTextureDesc& TexDesc = Resource.GetDesc(); /* // Perform cubemap face mapping, if necesary. Can avoid it if cubemap faces are loaded in ECubeMapFace order. if (TexDesc.Type == Texture_Cube) { UPTR ArrayIndex = ArraySlice / 6; UPTR Face = ArraySlice - (ArrayIndex * 6); switch ((ECubeMapFace)Face) { case CubeFace_PosX: return D3DCUBEMAP_FACE_POSITIVE_X; case CubeFace_NegX: return D3DCUBEMAP_FACE_NEGATIVE_X; case CubeFace_PosY: return D3DCUBEMAP_FACE_POSITIVE_Y; case CubeFace_NegY: return D3DCUBEMAP_FACE_NEGATIVE_Y; case CubeFace_PosZ: return D3DCUBEMAP_FACE_POSITIVE_Z; case CubeFace_NegZ: return D3DCUBEMAP_FACE_NEGATIVE_Z; } } */ D3D11_MAP MapType; UPTR MapFlags; GetD3DMapTypeAndFlags(Mode, MapType, MapFlags); D3D11_MAPPED_SUBRESOURCE D3DData; if (FAILED(pD3DImmContext->Map(pD3DTexRsrc, D3D11CalcSubresource(MipLevel, ArraySlice, TexDesc.MipLevels), MapType, MapFlags, &D3DData))) FAIL; OutData.pData = (char*)D3DData.pData; OutData.RowPitch = D3DData.RowPitch; OutData.SlicePitch = D3DData.DepthPitch; FAIL; } //--------------------------------------------------------------------- bool CD3D11GPUDriver::UnmapResource(const CVertexBuffer& Resource) { n_assert_dbg(Resource.IsA<CD3D11VertexBuffer>()); //???!!!return are outstanding locks or resource was unlocked?! ID3D11Buffer* pVB = ((const CD3D11VertexBuffer&)Resource).GetD3DBuffer(); if (!pVB) FAIL; pD3DImmContext->Unmap(pVB, 0); OK; } //--------------------------------------------------------------------- bool CD3D11GPUDriver::UnmapResource(const CIndexBuffer& Resource) { n_assert_dbg(Resource.IsA<CD3D11IndexBuffer>()); //???!!!return are outstanding locks or resource was unlocked?! ID3D11Buffer* pIB = ((const CD3D11IndexBuffer&)Resource).GetD3DBuffer(); if (!pIB) FAIL; pD3DImmContext->Unmap(pIB, 0); OK; } //--------------------------------------------------------------------- bool CD3D11GPUDriver::UnmapResource(const CTexture& Resource, UPTR ArraySlice, UPTR MipLevel) { n_assert_dbg(Resource.IsA<CD3D11Texture>()); ID3D11Resource* pD3DTexRsrc = ((const CD3D11Texture&)Resource).GetD3DResource(); if (!pD3DTexRsrc) FAIL; const CTextureDesc& TexDesc = Resource.GetDesc(); /* // Perform cubemap face mapping, if necesary. Can avoid it if cubemap faces are loaded in ECubeMapFace order. if (TexDesc.Type == Texture_Cube) { UPTR ArrayIndex = ArraySlice / 6; UPTR Face = ArraySlice - (ArrayIndex * 6); switch ((ECubeMapFace)Face) { case CubeFace_PosX: return D3DCUBEMAP_FACE_POSITIVE_X; case CubeFace_NegX: return D3DCUBEMAP_FACE_NEGATIVE_X; case CubeFace_PosY: return D3DCUBEMAP_FACE_POSITIVE_Y; case CubeFace_NegY: return D3DCUBEMAP_FACE_NEGATIVE_Y; case CubeFace_PosZ: return D3DCUBEMAP_FACE_POSITIVE_Z; case CubeFace_NegZ: return D3DCUBEMAP_FACE_NEGATIVE_Z; } } */ pD3DImmContext->Unmap(pD3DTexRsrc, D3D11CalcSubresource(MipLevel, ArraySlice, TexDesc.MipLevels)); OK; } //--------------------------------------------------------------------- bool CD3D11GPUDriver::ReadFromD3DBuffer(void* pDest, ID3D11Buffer* pBuf, D3D11_USAGE Usage, UPTR BufferSize, UPTR Size, UPTR Offset) { if (!pDest || !pBuf || !BufferSize) FAIL; UPTR RequestedSize = Size ? Size : BufferSize; UPTR SizeToCopy = std::min(RequestedSize, BufferSize - Offset); if (!SizeToCopy) OK; const bool IsNonMappable = (Usage == D3D11_USAGE_DEFAULT || Usage == D3D11_USAGE_IMMUTABLE); ID3D11Buffer* pBufToMap = nullptr; if (IsNonMappable) { // Instead of creation may use ring buffer of precreated resources! D3D11_BUFFER_DESC D3DDesc; pBuf->GetDesc(&D3DDesc); D3DDesc.Usage = D3D11_USAGE_STAGING; D3DDesc.BindFlags = 0; D3DDesc.MiscFlags = 0; D3DDesc.CPUAccessFlags = D3D11_CPU_ACCESS_READ; if (FAILED(pD3DDevice->CreateBuffer(&D3DDesc, nullptr, &pBufToMap))) FAIL; // PERF: Async, immediate reading may cause stall. Allow processing multiple read requests per call or make ReadFromResource async? pD3DImmContext->CopyResource(pBufToMap, pBuf); } else pBufToMap = pBuf; D3D11_MAPPED_SUBRESOURCE D3DData; if (FAILED(pD3DImmContext->Map(pBufToMap, 0, D3D11_MAP_READ, 0, &D3DData))) { if (IsNonMappable) pBufToMap->Release(); // Or return it to the ring buffer FAIL; } memcpy(pDest, (char*)D3DData.pData + Offset, SizeToCopy); pD3DImmContext->Unmap(pBufToMap, 0); if (IsNonMappable) pBufToMap->Release(); // Or return it to the ring buffer OK; } //--------------------------------------------------------------------- bool CD3D11GPUDriver::ReadFromResource(void* pDest, const CVertexBuffer& Resource, UPTR Size, UPTR Offset) { n_assert_dbg(Resource.IsA<CD3D11VertexBuffer>()); const CD3D11VertexBuffer& VB11 = (const CD3D11VertexBuffer&)Resource; return ReadFromD3DBuffer(pDest, VB11.GetD3DBuffer(), VB11.GetD3DUsage(), VB11.GetSizeInBytes(), Size, Offset); } //--------------------------------------------------------------------- bool CD3D11GPUDriver::ReadFromResource(void* pDest, const CIndexBuffer& Resource, UPTR Size, UPTR Offset) { n_assert_dbg(Resource.IsA<CD3D11IndexBuffer>()); const CD3D11IndexBuffer& IB11 = (const CD3D11IndexBuffer&)Resource; return ReadFromD3DBuffer(pDest, IB11.GetD3DBuffer(), IB11.GetD3DUsage(), IB11.GetSizeInBytes(), Size, Offset); } //--------------------------------------------------------------------- bool CD3D11GPUDriver::ReadFromResource(const CImageData& Dest, const CTexture& Resource, UPTR ArraySlice, UPTR MipLevel, const Data::CBox* pRegion) { n_assert_dbg(Resource.IsA<CD3D11Texture>()); const CTextureDesc& Desc = Resource.GetDesc(); if (!Dest.pData || MipLevel >= Desc.MipLevels) FAIL; UPTR RealArraySize = (Desc.Type == Texture_Cube) ? 6 * Desc.ArraySize : Desc.ArraySize; if (ArraySlice >= RealArraySize) FAIL; const CD3D11Texture& Tex11 = (const CD3D11Texture&)Resource; ID3D11Resource* pTexRsrc = Tex11.GetD3DResource(); D3D11_USAGE Usage = Tex11.GetD3DUsage(); UPTR Dims = Resource.GetDimensionCount(); if (!pTexRsrc || !Dims) FAIL; DXGI_FORMAT DXGIFormat = CD3D11DriverFactory::PixelFormatToDXGIFormat(Desc.Format); UPTR BPP = CD3D11DriverFactory::DXGIFormatBitsPerPixel(DXGIFormat); if (!BPP) FAIL; UPTR TotalSizeX = std::max<UPTR>(Desc.Width >> MipLevel, 1); UPTR TotalSizeY = std::max<UPTR>(Desc.Height >> MipLevel, 1); UPTR TotalSizeZ = std::max<UPTR>(Desc.Depth >> MipLevel, 1); CCopyImageParams Params; Params.BitsPerPixel = BPP; if (!CalcValidImageRegion(pRegion, Dims, TotalSizeX, TotalSizeY, TotalSizeZ, Params.Offset[0], Params.Offset[1], Params.Offset[2], Params.CopySize[0], Params.CopySize[1], Params.CopySize[2])) { OK; } const bool IsNonMappable = (Usage == D3D11_USAGE_DEFAULT || Usage == D3D11_USAGE_IMMUTABLE); UPTR ImageCopyFlags = CopyImage_AdjustSrc; ID3D11Resource* pRsrcToMap = nullptr; if (IsNonMappable) { // Instead of creation may use ring buffer of precreated resources! const ETextureType TexType = Desc.Type; switch (TexType) { case Texture_1D: { D3D11_TEXTURE1D_DESC D3DDesc; Tex11.GetD3DTexture1D()->GetDesc(&D3DDesc); D3DDesc.MipLevels = 1; D3DDesc.ArraySize = 1; D3DDesc.Width = TotalSizeX; D3DDesc.Usage = D3D11_USAGE_STAGING; D3DDesc.BindFlags = 0; D3DDesc.MiscFlags = 0; D3DDesc.CPUAccessFlags = D3D11_CPU_ACCESS_READ; ID3D11Texture1D* pTex = nullptr; if (FAILED(pD3DDevice->CreateTexture1D(&D3DDesc, nullptr, &pTex))) FAIL; pRsrcToMap = pTex; break; } case Texture_2D: case Texture_Cube: { D3D11_TEXTURE2D_DESC D3DDesc; Tex11.GetD3DTexture2D()->GetDesc(&D3DDesc); D3DDesc.MipLevels = 1; D3DDesc.ArraySize = 1; D3DDesc.Width = TotalSizeX; D3DDesc.Height = TotalSizeY; D3DDesc.Usage = D3D11_USAGE_STAGING; D3DDesc.BindFlags = 0; D3DDesc.MiscFlags = 0; D3DDesc.CPUAccessFlags = D3D11_CPU_ACCESS_READ; ID3D11Texture2D* pTex = nullptr; if (FAILED(pD3DDevice->CreateTexture2D(&D3DDesc, nullptr, &pTex))) FAIL; pRsrcToMap = pTex; break; } case Texture_3D: { D3D11_TEXTURE3D_DESC D3DDesc; Tex11.GetD3DTexture3D()->GetDesc(&D3DDesc); D3DDesc.MipLevels = 1; D3DDesc.Width = TotalSizeX; D3DDesc.Height = TotalSizeY; D3DDesc.Depth = TotalSizeZ; D3DDesc.Usage = D3D11_USAGE_STAGING; D3DDesc.BindFlags = 0; D3DDesc.MiscFlags = 0; D3DDesc.CPUAccessFlags = D3D11_CPU_ACCESS_READ; ID3D11Texture3D* pTex = nullptr; if (FAILED(pD3DDevice->CreateTexture3D(&D3DDesc, nullptr, &pTex))) FAIL; pRsrcToMap = pTex; ImageCopyFlags |= CopyImage_3DImage; break; } default: FAIL; }; // PERF: Async, immediate reading may cause stall. Allow processing multiple read requests per call or make ReadFromResource async? pD3DImmContext->CopySubresourceRegion(pRsrcToMap, 0, 0, 0, 0, pTexRsrc, D3D11CalcSubresource(MipLevel, ArraySlice, Desc.MipLevels), nullptr); } else pRsrcToMap = pTexRsrc; D3D11_MAPPED_SUBRESOURCE MappedTex; if (FAILED(pD3DImmContext->Map(pRsrcToMap, 0, D3D11_MAP_READ, 0, &MappedTex))) { if (IsNonMappable) pRsrcToMap->Release(); // Or return it to the ring buffer FAIL; } CImageData SrcData; SrcData.pData = (char*)MappedTex.pData; SrcData.RowPitch = MappedTex.RowPitch; SrcData.SlicePitch = MappedTex.DepthPitch; Params.TotalSize[0] = TotalSizeX; Params.TotalSize[1] = TotalSizeY; if (CD3D11DriverFactory::DXGIFormatBlockSize(DXGIFormat) > 1) ImageCopyFlags |= CopyImage_BlockCompressed; CopyImage(SrcData, Dest, ImageCopyFlags, Params); pD3DImmContext->Unmap(pRsrcToMap, 0); if (IsNonMappable) pRsrcToMap->Release(); // Or return it to the ring buffer OK; } //--------------------------------------------------------------------- bool CD3D11GPUDriver::WriteToD3DBuffer(ID3D11Buffer* pBuf, D3D11_USAGE Usage, UPTR BufferSize, const void* pData, UPTR Size, UPTR Offset) { if (!pBuf || Usage == D3D11_USAGE_IMMUTABLE || !pData || !BufferSize) FAIL; UPTR RequestedSize = Size ? Size : BufferSize; UPTR SizeToCopy = std::min(RequestedSize, BufferSize - Offset); if (!SizeToCopy) OK; const int UpdateWhole = (!Offset && SizeToCopy == BufferSize); if (Usage == D3D11_USAGE_DEFAULT) //???update staging here too? need perf test! { if (UpdateWhole) pD3DImmContext->UpdateSubresource(pBuf, 0, nullptr, pData, 0, 0); else { D3D11_BOX D3DBox; D3DBox.left = Offset; D3DBox.right = Offset + SizeToCopy; D3DBox.top = 0; D3DBox.bottom = 1; D3DBox.front = 0; D3DBox.back = 1; pD3DImmContext->UpdateSubresource(pBuf, 0, &D3DBox, pData, 0, 0); } } else { const int IsDynamic = (Usage == D3D11_USAGE_DYNAMIC); #if defined(_DEBUG) && DEM_RENDER_DEBUG if (IsDynamic && !UpdateWhole) Sys::Log("Render, Warning: partial write-discard to D3D11 dynamic buffer\n"); #endif D3D11_MAP MapType = IsDynamic ? D3D11_MAP_WRITE_DISCARD : D3D11_MAP_WRITE; D3D11_MAPPED_SUBRESOURCE D3DData; if (FAILED(pD3DImmContext->Map(pBuf, 0, MapType, 0, &D3DData))) FAIL; memcpy(((char*)D3DData.pData) + Offset, pData, SizeToCopy); pD3DImmContext->Unmap(pBuf, 0); } OK; } //--------------------------------------------------------------------- bool CD3D11GPUDriver::WriteToResource(CVertexBuffer& Resource, const void* pData, UPTR Size, UPTR Offset) { n_assert_dbg(Resource.IsA<CD3D11VertexBuffer>()); const CD3D11VertexBuffer& VB11 = (const CD3D11VertexBuffer&)Resource; return WriteToD3DBuffer(VB11.GetD3DBuffer(), VB11.GetD3DUsage(), VB11.GetSizeInBytes(), pData, Size, Offset); } //--------------------------------------------------------------------- bool CD3D11GPUDriver::WriteToResource(CIndexBuffer& Resource, const void* pData, UPTR Size, UPTR Offset) { n_assert_dbg(Resource.IsA<CD3D11IndexBuffer>()); const CD3D11IndexBuffer& IB11 = (const CD3D11IndexBuffer&)Resource; return WriteToD3DBuffer(IB11.GetD3DBuffer(), IB11.GetD3DUsage(), IB11.GetSizeInBytes(), pData, Size, Offset); } //--------------------------------------------------------------------- bool CD3D11GPUDriver::WriteToResource(CTexture& Resource, const CImageData& SrcData, UPTR ArraySlice, UPTR MipLevel, const Data::CBox* pRegion) { n_assert_dbg(Resource.IsA<CD3D11Texture>()); const CTextureDesc& Desc = Resource.GetDesc(); if (!SrcData.pData || MipLevel >= Desc.MipLevels) FAIL; UPTR RealArraySize = (Desc.Type == Texture_Cube) ? 6 * Desc.ArraySize : Desc.ArraySize; if (ArraySlice >= RealArraySize) FAIL; const CD3D11Texture& Tex11 = (const CD3D11Texture&)Resource; ID3D11Resource* pTexRsrc = Tex11.GetD3DResource(); D3D11_USAGE Usage = Tex11.GetD3DUsage(); UPTR Dims = Resource.GetDimensionCount(); if (!pTexRsrc || Usage == D3D11_USAGE_IMMUTABLE || !Dims) FAIL; UPTR TotalSizeX = std::max<UPTR>(Desc.Width >> MipLevel, 1); UPTR TotalSizeY = std::max<UPTR>(Desc.Height >> MipLevel, 1); UPTR TotalSizeZ = std::max<UPTR>(Desc.Depth >> MipLevel, 1); CCopyImageParams Params; UPTR OffsetX, OffsetY, OffsetZ, SizeX, SizeY, SizeZ; if (!CalcValidImageRegion(pRegion, Dims, TotalSizeX, TotalSizeY, TotalSizeZ, OffsetX, OffsetY, OffsetZ, SizeX, SizeY, SizeZ)) { OK; } if (Usage == D3D11_USAGE_DEFAULT) //???update staging here too? need perf test! { //!!!only non-DS and non-MSAA! //!!!can also use staging ring buffer! PERF? D3D11_BOX D3DBox; // In texels D3DBox.left = OffsetX; D3DBox.right = OffsetX + SizeX; D3DBox.top = OffsetY; D3DBox.bottom = OffsetY + SizeY; D3DBox.front = OffsetZ; D3DBox.back = OffsetZ + SizeZ; pD3DImmContext->UpdateSubresource(pTexRsrc, D3D11CalcSubresource(MipLevel, ArraySlice, Desc.MipLevels), &D3DBox, SrcData.pData, SrcData.RowPitch, SrcData.SlicePitch); OK; } DXGI_FORMAT DXGIFormat = CD3D11DriverFactory::PixelFormatToDXGIFormat(Desc.Format); // No format conversion for now, src & dest texel formats must match UPTR BPP = CD3D11DriverFactory::DXGIFormatBitsPerPixel(DXGIFormat); if (!BPP) FAIL; D3D11_MAP MapType; if (Usage == D3D11_USAGE_DYNAMIC) { const bool UpdateWhole = !pRegion || (SizeX == TotalSizeX && (Dims < 2 || SizeY == TotalSizeY && (Dims < 3 || SizeZ == TotalSizeZ))); MapType = UpdateWhole ? D3D11_MAP_WRITE_DISCARD : D3D11_MAP_WRITE_NO_OVERWRITE; } else MapType = D3D11_MAP_WRITE; D3D11_MAPPED_SUBRESOURCE D3DData; if (FAILED(pD3DImmContext->Map(pTexRsrc, 0, MapType, 0, &D3DData))) FAIL; CImageData DestData; DestData.pData = (char*)D3DData.pData; DestData.RowPitch = D3DData.RowPitch; DestData.SlicePitch = D3DData.DepthPitch; Params.BitsPerPixel = BPP; Params.Offset[0] = OffsetX; Params.Offset[1] = OffsetY; Params.Offset[2] = OffsetZ; Params.CopySize[0] = SizeX; Params.CopySize[1] = SizeY; Params.CopySize[2] = SizeZ; Params.TotalSize[0] = TotalSizeX; Params.TotalSize[1] = TotalSizeY; UPTR ImageCopyFlags = CopyImage_AdjustDest; if (CD3D11DriverFactory::DXGIFormatBlockSize(DXGIFormat) > 1) ImageCopyFlags |= CopyImage_BlockCompressed; if (Desc.Type == Texture_3D) ImageCopyFlags |= CopyImage_3DImage; CopyImage(SrcData, DestData, ImageCopyFlags, Params); pD3DImmContext->Unmap(pTexRsrc, 0); OK; } //--------------------------------------------------------------------- // Especially useful for VRAM-only D3D11_USAGE_DEFAULT buffers. May not support partial updates. bool CD3D11GPUDriver::WriteToResource(CConstantBuffer& Resource, const void* pData, UPTR Size, UPTR Offset) { n_assert_dbg(Resource.IsA<CD3D11ConstantBuffer>()); CD3D11ConstantBuffer& CB11 = (CD3D11ConstantBuffer&)Resource; // Can't write to D3D 11.0 constant buffers partially if (Offset || (Size && Size != CB11.GetSizeInBytes())) FAIL; ID3D11Buffer* pBuffer = CB11.GetD3DBuffer(); D3D11_USAGE D3DUsage = CB11.GetD3DUsage(); if (D3DUsage == D3D11_USAGE_DEFAULT) { pD3DImmContext->UpdateSubresource(pBuffer, 0, nullptr, pData, 0, 0); } else if (D3DUsage == D3D11_USAGE_DYNAMIC) { if (CB11.GetMappedVRAM()) FAIL; // Buffer is already mapped, can't write with a commit D3D11_MAPPED_SUBRESOURCE MappedSubRsrc; if (FAILED(pD3DImmContext->Map(pBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &MappedSubRsrc))) FAIL; memcpy(MappedSubRsrc.pData, pData, CB11.GetSizeInBytes()); pD3DImmContext->Unmap(pBuffer, 0); } else FAIL; CB11.ResetRAMCopy(pData); OK; } //--------------------------------------------------------------------- // Only dynamic buffers and buffers with a RAM copy support setting constants. // Default buffers support only the whole buffer update via WriteToResource(). bool CD3D11GPUDriver::BeginShaderConstants(CConstantBuffer& Buffer) { n_assert_dbg(Buffer.IsA<CD3D11ConstantBuffer>()); CD3D11ConstantBuffer& CB11 = (CD3D11ConstantBuffer&)Buffer; ID3D11Buffer* pBuffer = CB11.GetD3DBuffer(); D3D11_USAGE D3DUsage = CB11.GetD3DUsage(); // Invalid or read-only if (!pBuffer || D3DUsage == D3D11_USAGE_IMMUTABLE) FAIL; // Writes to the RAM copy, no additional actions required if (CB11.UsesRAMCopy()) { CB11.OnBegin(); OK; } // VRAM-only, non-mappable, can't write constants without a RAM copy if (D3DUsage != D3D11_USAGE_DYNAMIC) FAIL; if (!CB11.GetMappedVRAM()) { D3D11_MAPPED_SUBRESOURCE MappedSubRsrc; if (FAILED(pD3DImmContext->Map(pBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &MappedSubRsrc))) FAIL; CB11.OnBegin(MappedSubRsrc.pData); } OK; } //--------------------------------------------------------------------- bool CD3D11GPUDriver::CommitShaderConstants(CConstantBuffer& Buffer) { n_assert_dbg(Buffer.IsA<CD3D11ConstantBuffer>()); CD3D11ConstantBuffer& CB11 = (CD3D11ConstantBuffer&)Buffer; ID3D11Buffer* pBuffer = CB11.GetD3DBuffer(); D3D11_USAGE D3DUsage = CB11.GetD3DUsage(); if (CB11.UsesRAMCopy()) { // Commit RAM copy to VRAM or to a staging resource if (!CB11.IsDirty()) OK; if (D3DUsage == D3D11_USAGE_DEFAULT) { pD3DImmContext->UpdateSubresource(pBuffer, 0, nullptr, CB11.GetRAMCopy(), 0, 0); } else if (D3DUsage == D3D11_USAGE_DYNAMIC || D3DUsage == D3D11_USAGE_STAGING) { D3D11_MAPPED_SUBRESOURCE MappedSubRsrc; if (FAILED(pD3DImmContext->Map(pBuffer, 0, (D3DUsage == D3D11_USAGE_DYNAMIC) ? D3D11_MAP_WRITE_DISCARD : D3D11_MAP_WRITE, 0, &MappedSubRsrc))) FAIL; memcpy(MappedSubRsrc.pData, CB11.GetRAMCopy(), CB11.GetSizeInBytes()); pD3DImmContext->Unmap(pBuffer, 0); } else FAIL; } else if (D3DUsage == D3D11_USAGE_DYNAMIC) { // Unmap previously mapped VRAM-only dynamic buffer if (CB11.GetMappedVRAM()) { // Buffer was mapped with discard. Ensure something was written, otherwise contents are invalid. n_assert_dbg(CB11.IsDirty()); pD3DImmContext->Unmap(pBuffer, 0); } } CB11.OnCommit(); OK; } //--------------------------------------------------------------------- D3D_DRIVER_TYPE CD3D11GPUDriver::GetD3DDriverType(EGPUDriverType DriverType) { // WARP adapter is skipped. // You also create the render-only device when you specify D3D_DRIVER_TYPE_WARP in the DriverType parameter // of D3D11CreateDevice because the WARP device also uses the render-only WARP adapter (c) Docs switch (DriverType) { case GPU_AutoSelect: return D3D_DRIVER_TYPE_UNKNOWN; case GPU_Hardware: return D3D_DRIVER_TYPE_HARDWARE; case GPU_Reference: return D3D_DRIVER_TYPE_REFERENCE; case GPU_Software: return D3D_DRIVER_TYPE_SOFTWARE; case GPU_Null: return D3D_DRIVER_TYPE_NULL; default: Sys::Error("CD3D11GPUDriver::GetD3DDriverType() > invalid GPU driver type"); return D3D_DRIVER_TYPE_UNKNOWN; }; } //--------------------------------------------------------------------- EGPUDriverType CD3D11GPUDriver::GetDEMDriverType(D3D_DRIVER_TYPE DriverType) { switch (DriverType) { case D3D_DRIVER_TYPE_UNKNOWN: return GPU_AutoSelect; case D3D_DRIVER_TYPE_HARDWARE: return GPU_Hardware; case D3D_DRIVER_TYPE_WARP: return GPU_Reference; case D3D_DRIVER_TYPE_REFERENCE: return GPU_Reference; case D3D_DRIVER_TYPE_SOFTWARE: return GPU_Software; case D3D_DRIVER_TYPE_NULL: return GPU_Null; default: Sys::Error("CD3D11GPUDriver::GetD3DDriverType() > invalid D3D_DRIVER_TYPE"); return GPU_AutoSelect; }; } //--------------------------------------------------------------------- bool CD3D11GPUDriver::GetUsageAccess(UPTR InAccessFlags, bool InitDataProvided, D3D11_USAGE& OutUsage, UINT& OutCPUAccess) { Data::CFlags AccessFlags(InAccessFlags); if (AccessFlags.IsNot(Access_CPU_Write | Access_CPU_Read)) { // No CPU access needed, use GPU memory if (InAccessFlags == Access_GPU_Read || InAccessFlags == 0) { // Use the best read-only GPU memory OutUsage = InitDataProvided ? D3D11_USAGE_IMMUTABLE : D3D11_USAGE_DEFAULT; } else { // Use read-write GPU memory OutUsage = D3D11_USAGE_DEFAULT; } } else if (InAccessFlags == (Access_GPU_Read | Access_CPU_Write)) { // Special case - dynamic resources, frequently updateable from CPU side OutUsage = D3D11_USAGE_DYNAMIC; } else if (AccessFlags.IsNot(Access_GPU_Write | Access_GPU_Read)) { // No GPU access needed, system RAM resource. // Can't be a depth-stencil buffer or a multisampled render target. OutUsage = D3D11_USAGE_STAGING; } else FAIL; // Unsupported combination of access capabilities OutCPUAccess = 0; if (InAccessFlags & Access_CPU_Read) OutCPUAccess |= D3D11_CPU_ACCESS_READ; if (InAccessFlags & Access_CPU_Write) OutCPUAccess |= D3D11_CPU_ACCESS_WRITE; OK; } //--------------------------------------------------------------------- void CD3D11GPUDriver::GetD3DMapTypeAndFlags(EResourceMapMode MapMode, D3D11_MAP& OutMapType, UPTR& OutMapFlags) { OutMapFlags = 0; switch (MapMode) { case Map_Read: { OutMapType = D3D11_MAP_READ; return; } case Map_Write: { OutMapType = D3D11_MAP_WRITE; return; } case Map_ReadWrite: { OutMapType = D3D11_MAP_READ_WRITE; return; } case Map_WriteDiscard: { OutMapType = D3D11_MAP_WRITE_DISCARD; return; } case Map_WriteNoOverwrite: { OutMapType = D3D11_MAP_WRITE_NO_OVERWRITE; return; } default: { Sys::Error("CD3D11GPUDriver::GetD3DMapTypeAndFlags() > Invalid map mode\n"); return; } } } //--------------------------------------------------------------------- D3D11_COMPARISON_FUNC CD3D11GPUDriver::GetD3DCmpFunc(ECmpFunc Func) { switch (Func) { case Cmp_Never: return D3D11_COMPARISON_NEVER; case Cmp_Less: return D3D11_COMPARISON_LESS; case Cmp_LessEqual: return D3D11_COMPARISON_LESS_EQUAL; case Cmp_Greater: return D3D11_COMPARISON_GREATER; case Cmp_GreaterEqual: return D3D11_COMPARISON_GREATER_EQUAL; case Cmp_Equal: return D3D11_COMPARISON_EQUAL; case Cmp_NotEqual: return D3D11_COMPARISON_NOT_EQUAL; case Cmp_Always: return D3D11_COMPARISON_ALWAYS; default: { Sys::Error("CD3D11GPUDriver::GetD3DCmpFunc() > invalid function"); return D3D11_COMPARISON_NEVER; } } } //--------------------------------------------------------------------- D3D11_STENCIL_OP CD3D11GPUDriver::GetD3DStencilOp(EStencilOp Operation) { switch (Operation) { case StencilOp_Keep: return D3D11_STENCIL_OP_KEEP; case StencilOp_Zero: return D3D11_STENCIL_OP_ZERO; case StencilOp_Replace: return D3D11_STENCIL_OP_REPLACE; case StencilOp_Inc: return D3D11_STENCIL_OP_INCR; case StencilOp_IncSat: return D3D11_STENCIL_OP_INCR_SAT; case StencilOp_Dec: return D3D11_STENCIL_OP_DECR; case StencilOp_DecSat: return D3D11_STENCIL_OP_DECR_SAT; case StencilOp_Invert: return D3D11_STENCIL_OP_INVERT; default: { Sys::Error("CD3D11GPUDriver::GetD3DStencilOp() > invalid operation"); return D3D11_STENCIL_OP_KEEP; } } } //--------------------------------------------------------------------- D3D11_BLEND CD3D11GPUDriver::GetD3DBlendArg(EBlendArg Arg) { switch (Arg) { case BlendArg_Zero: return D3D11_BLEND_ZERO; case BlendArg_One: return D3D11_BLEND_ONE; case BlendArg_SrcColor: return D3D11_BLEND_SRC_COLOR; case BlendArg_InvSrcColor: return D3D11_BLEND_INV_SRC_COLOR; case BlendArg_Src1Color: return D3D11_BLEND_SRC1_COLOR; case BlendArg_InvSrc1Color: return D3D11_BLEND_INV_SRC1_COLOR; case BlendArg_SrcAlpha: return D3D11_BLEND_SRC_ALPHA; case BlendArg_SrcAlphaSat: return D3D11_BLEND_SRC_ALPHA_SAT; case BlendArg_InvSrcAlpha: return D3D11_BLEND_INV_SRC_ALPHA; case BlendArg_Src1Alpha: return D3D11_BLEND_SRC1_ALPHA; case BlendArg_InvSrc1Alpha: return D3D11_BLEND_INV_SRC1_ALPHA; case BlendArg_DestColor: return D3D11_BLEND_DEST_COLOR; case BlendArg_InvDestColor: return D3D11_BLEND_INV_DEST_COLOR; case BlendArg_DestAlpha: return D3D11_BLEND_DEST_ALPHA; case BlendArg_InvDestAlpha: return D3D11_BLEND_INV_DEST_ALPHA; case BlendArg_BlendFactor: return D3D11_BLEND_BLEND_FACTOR; case BlendArg_InvBlendFactor: return D3D11_BLEND_INV_BLEND_FACTOR; default: { Sys::Error("CD3D11GPUDriver::GetD3DBlendArg() > invalid argument"); return D3D11_BLEND_ZERO; } } } //--------------------------------------------------------------------- D3D11_BLEND_OP CD3D11GPUDriver::GetD3DBlendOp(EBlendOp Operation) { switch (Operation) { case BlendOp_Add: return D3D11_BLEND_OP_ADD; case BlendOp_Sub: return D3D11_BLEND_OP_SUBTRACT; case BlendOp_RevSub: return D3D11_BLEND_OP_REV_SUBTRACT; case BlendOp_Min: return D3D11_BLEND_OP_MIN; case BlendOp_Max: return D3D11_BLEND_OP_MAX; default: Sys::Error("CD3D11GPUDriver::GetD3DBlendOp() > invalid operation"); return D3D11_BLEND_OP_ADD; } } //--------------------------------------------------------------------- D3D11_TEXTURE_ADDRESS_MODE CD3D11GPUDriver::GetD3DTexAddressMode(ETexAddressMode Mode) { switch (Mode) { case TexAddr_Wrap: return D3D11_TEXTURE_ADDRESS_WRAP; case TexAddr_Mirror: return D3D11_TEXTURE_ADDRESS_MIRROR; case TexAddr_Clamp: return D3D11_TEXTURE_ADDRESS_CLAMP; case TexAddr_Border: return D3D11_TEXTURE_ADDRESS_BORDER; case TexAddr_MirrorOnce: return D3D11_TEXTURE_ADDRESS_MIRROR_ONCE; default: Sys::Error("CD3D11GPUDriver::GetD3DTexAddressMode() > invalid mode"); return D3D11_TEXTURE_ADDRESS_WRAP; } } //--------------------------------------------------------------------- D3D11_FILTER CD3D11GPUDriver::GetD3DTexFilter(ETexFilter Filter, bool Comparison) { switch (Filter) { case TexFilter_MinMagMip_Point: return Comparison ? D3D11_FILTER_COMPARISON_MIN_MAG_MIP_POINT : D3D11_FILTER_MIN_MAG_MIP_POINT; case TexFilter_MinMag_Point_Mip_Linear: return Comparison ? D3D11_FILTER_COMPARISON_MIN_MAG_POINT_MIP_LINEAR : D3D11_FILTER_MIN_MAG_POINT_MIP_LINEAR; case TexFilter_Min_Point_Mag_Linear_Mip_Point: return Comparison ? D3D11_FILTER_COMPARISON_MIN_POINT_MAG_LINEAR_MIP_POINT : D3D11_FILTER_MIN_POINT_MAG_LINEAR_MIP_POINT; case TexFilter_Min_Point_MagMip_Linear: return Comparison ? D3D11_FILTER_COMPARISON_MIN_POINT_MAG_MIP_LINEAR : D3D11_FILTER_MIN_POINT_MAG_MIP_LINEAR; case TexFilter_Min_Linear_MagMip_Point: return Comparison ? D3D11_FILTER_COMPARISON_MIN_LINEAR_MAG_MIP_POINT : D3D11_FILTER_MIN_LINEAR_MAG_MIP_POINT; case TexFilter_Min_Linear_Mag_Point_Mip_Linear: return Comparison ? D3D11_FILTER_COMPARISON_MIN_LINEAR_MAG_POINT_MIP_LINEAR : D3D11_FILTER_MIN_LINEAR_MAG_POINT_MIP_LINEAR; case TexFilter_MinMag_Linear_Mip_Point: return Comparison ? D3D11_FILTER_COMPARISON_MIN_MAG_LINEAR_MIP_POINT : D3D11_FILTER_MIN_MAG_LINEAR_MIP_POINT; case TexFilter_MinMagMip_Linear: return Comparison ? D3D11_FILTER_COMPARISON_MIN_MAG_MIP_LINEAR : D3D11_FILTER_MIN_MAG_MIP_LINEAR; case TexFilter_Anisotropic: return Comparison ? D3D11_FILTER_COMPARISON_ANISOTROPIC : D3D11_FILTER_ANISOTROPIC; default: Sys::Error("CD3D11GPUDriver::GetD3DTexFilter() > invalid mode"); return D3D11_FILTER_MIN_MAG_MIP_POINT; } } //--------------------------------------------------------------------- bool CD3D11GPUDriver::OnOSWindowClosing(Events::CEventDispatcher* pDispatcher, const Events::CEventBase& Event) { DEM::Sys::COSWindow* pWnd = (DEM::Sys::COSWindow*)pDispatcher; for (UPTR i = 0; i < SwapChains.size(); ++i) { CD3D11SwapChain& SC = SwapChains[i]; if (SC.TargetWindow.Get() == pWnd) { DestroySwapChain(i); OK; // Only one swap chain is allowed for each window } } OK; } //--------------------------------------------------------------------- bool CD3D11GPUDriver::OnOSWindowToggleFullscreen(Events::CEventDispatcher* pDispatcher, const Events::CEventBase& Event) { DEM::Sys::COSWindow* pWnd = (DEM::Sys::COSWindow*)pDispatcher; for (UPTR i = 0; i < SwapChains.size(); ++i) { CD3D11SwapChain& SC = SwapChains[i]; if (SC.TargetWindow.Get() == pWnd) { if (SC.IsFullscreen()) n_verify(SwitchToWindowed(i)); else n_verify(SwitchToFullscreen(i)); OK; } } OK; } //--------------------------------------------------------------------- /* case WM_PAINT: { PAINTSTRUCT ps; HDC hdc = BeginPaint( hWnd, &ps ); EndPaint( hWnd, &ps ); return 0; } */ }
33.772465
183
0.703823
[ "render", "object", "vector", "3d", "solid" ]
9612a21155f48c7bea82921f93637b39ddb44cab
1,760
cpp
C++
vpc/src/v2/model/DeleteSecurityGroupRuleRequest.cpp
yangzhaofeng/huaweicloud-sdk-cpp-v3
4f3caac5ba9a9b75b4e5fd61683d1c4d57ec1c23
[ "Apache-2.0" ]
5
2021-03-03T08:23:43.000Z
2022-02-16T02:16:39.000Z
vpc/src/v2/model/DeleteSecurityGroupRuleRequest.cpp
yangzhaofeng/huaweicloud-sdk-cpp-v3
4f3caac5ba9a9b75b4e5fd61683d1c4d57ec1c23
[ "Apache-2.0" ]
null
null
null
vpc/src/v2/model/DeleteSecurityGroupRuleRequest.cpp
yangzhaofeng/huaweicloud-sdk-cpp-v3
4f3caac5ba9a9b75b4e5fd61683d1c4d57ec1c23
[ "Apache-2.0" ]
7
2021-02-26T13:53:35.000Z
2022-03-18T02:36:43.000Z
#include "huaweicloud/vpc/v2/model/DeleteSecurityGroupRuleRequest.h" namespace HuaweiCloud { namespace Sdk { namespace Vpc { namespace V2 { namespace Model { DeleteSecurityGroupRuleRequest::DeleteSecurityGroupRuleRequest() { securityGroupRuleId_ = ""; securityGroupRuleIdIsSet_ = false; } DeleteSecurityGroupRuleRequest::~DeleteSecurityGroupRuleRequest() = default; void DeleteSecurityGroupRuleRequest::validate() { } web::json::value DeleteSecurityGroupRuleRequest::toJson() const { web::json::value val = web::json::value::object(); if(securityGroupRuleIdIsSet_) { val[utility::conversions::to_string_t("security_group_rule_id")] = ModelBase::toJson(securityGroupRuleId_); } return val; } bool DeleteSecurityGroupRuleRequest::fromJson(const web::json::value& val) { bool ok = true; if(val.has_field(utility::conversions::to_string_t("security_group_rule_id"))) { const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("security_group_rule_id")); if(!fieldValue.is_null()) { std::string refVal; ok &= ModelBase::fromJson(fieldValue, refVal); setSecurityGroupRuleId(refVal); } } return ok; } std::string DeleteSecurityGroupRuleRequest::getSecurityGroupRuleId() const { return securityGroupRuleId_; } void DeleteSecurityGroupRuleRequest::setSecurityGroupRuleId(const std::string& value) { securityGroupRuleId_ = value; securityGroupRuleIdIsSet_ = true; } bool DeleteSecurityGroupRuleRequest::securityGroupRuleIdIsSet() const { return securityGroupRuleIdIsSet_; } void DeleteSecurityGroupRuleRequest::unsetsecurityGroupRuleId() { securityGroupRuleIdIsSet_ = false; } } } } } }
21.463415
115
0.730682
[ "object", "model" ]
9615c3d167071e086b5b9f4e072fc261855b3e2c
15,430
cpp
C++
animatron.cpp
Atrix256/Animatron
85ba4dede18ff08cf9fba8d433c9cccc167e0414
[ "MIT" ]
17
2020-09-26T09:07:09.000Z
2020-11-04T22:14:41.000Z
animatron.cpp
Atrix256/Animatron
85ba4dede18ff08cf9fba8d433c9cccc167e0414
[ "MIT" ]
1
2020-10-10T23:50:27.000Z
2020-10-10T23:50:27.000Z
animatron.cpp
Atrix256/Animatron
85ba4dede18ff08cf9fba8d433c9cccc167e0414
[ "MIT" ]
null
null
null
#include "animatron.h" #include "utils.h" #include "cas.h" #include "entities.h" #include <algorithm> #include <direct.h> #define STB_IMAGE_IMPLEMENTATION #include "stb/stb_image.h" #define STB_IMAGE_WRITE_IMPLEMENTATION #include "stb/stb_image_write.h" bool ValidateAndFixupDocument(Data::Document& document) { // make sure the build folder exists _mkdir("build"); // verify if (document.program != "animatron") { printf("Invalid animatron file!\n"); return false; } if (document.config.program != "animatronconfig") { printf("Invalid animatron config file!\n"); return false; } // version fixup if (document.versionMajor != c_documentVersionMajor || document.versionMinor != c_documentVersionMinor) { printf("Wrong version number: %i.%i, not %i.%i\n", document.versionMajor, document.versionMinor, c_documentVersionMajor, c_documentVersionMinor); return false; } if (document.config.versionMajor != c_configVersionMajor || document.config.versionMinor != c_configVersionMinor) { printf("Wrong config version number: %i.%i, not %i.%i\n", document.config.versionMajor, document.config.versionMinor, c_configVersionMajor, c_configVersionMinor); return false; } // give names to any entities which don't have names { for (size_t index = 0; index < document.entities.size(); ++index) { if (document.entities[index].id.empty()) { char buffer[256]; sprintf_s(buffer, "__ entity %zu", index); document.entities[index].id = buffer; } } } // sort the keyframes by time ascending to put them in order std::sort( document.keyFrames.begin(), document.keyFrames.end(), [](const Data::KeyFrame& a, const Data::KeyFrame& b) { return a.time < b.time; } ); // data interpretation and fixup { if (document.renderSizeX == 0) document.renderSizeX = document.outputSizeX; if (document.renderSizeY == 0) document.renderSizeY = document.outputSizeY; if (document.samplesPerPixel < 1) document.samplesPerPixel = 1; } // Make the sampling jitter sequence for the document MakeJitterSequence(document); // Load blue noise texture for dithering or dissolve etc { int blueNoiseComponents = 0; stbi_uc* pixels = stbi_load("internal/BlueNoiseRGBA.png", &document.blueNoiseWidth, &document.blueNoiseHeight, &blueNoiseComponents, 4); if (pixels == nullptr || document.blueNoiseWidth == 0 || document.blueNoiseHeight == 0) { printf("Could not load internal/BlueNoiseRGBA.png"); return false; } document.blueNoisePixels.resize(document.blueNoiseWidth * document.blueNoiseHeight); memcpy((unsigned char*)&document.blueNoisePixels[0], pixels, document.blueNoiseWidth * document.blueNoiseHeight * 4); stbi_image_free(pixels); } // Do one time initialization of entities { int entityIndex = -1; for (Data::Entity& entity : document.entities) { bool error = false; entityIndex++; // do per frame entity initialization switch (entity.data._index) { #include "df_serialize/df_serialize/_common.h" #define VARIANT_TYPE(_TYPE, _NAME, _DEFAULT, _DESCRIPTION) \ case Data::EntityVariant::c_index_##_NAME: error = ! _TYPE##_Action::Initialize(document, entity, entityIndex); break; #include "df_serialize/df_serialize/_fillunsetdefines.h" #include "schemas/schemas_entities.h" default: { printf("unhandled entity type in variant\n"); break; } } if (error) { printf("entity %s failed to initialize.\n", entity.id.c_str()); return false; } } } // initialize CAS. it's ok if this is called multiple times. if (!CAS::Get().Init()) { printf("Could not init CAS\n"); return false; } // make a timeline for each entity by just starting with the entity definition for (const Data::Entity& entity : document.entities) { Data::RuntimeEntityTimeline newTimeline; newTimeline.id = entity.id; newTimeline.zorder = entity.zorder; newTimeline.createTime = entity.createTime; newTimeline.destroyTime = entity.destroyTime; Data::RuntimeEntityTimelineKeyframe newKeyFrame; newKeyFrame.time = entity.createTime; newKeyFrame.entity = entity; newTimeline.keyFrames.push_back(newKeyFrame); document.runtimeEntityTimelinesMap[entity.id] = newTimeline; } // process each key frame to fill out the timelines further for (const Data::KeyFrame& keyFrame : document.keyFrames) { auto it = document.runtimeEntityTimelinesMap.find(keyFrame.entityId); if (it == document.runtimeEntityTimelinesMap.end()) { printf("Could not find entity %s for keyframe!\n", keyFrame.entityId.c_str()); continue; } // ignore events outside the lifetime of the entity if ((keyFrame.time < it->second.createTime) || (it->second.destroyTime >= 0.0f && keyFrame.time > it->second.destroyTime)) continue; // make a new key frame entry Data::RuntimeEntityTimelineKeyframe newKeyFrame; newKeyFrame.time = keyFrame.time; newKeyFrame.blendControlPoints = keyFrame.blendControlPoints; // start the keyframe entity values at the last keyframe value, so people only make keyframes for the things they want to change newKeyFrame.entity = it->second.keyFrames.rbegin()->entity; // load the sparse json data over the keyframe data if (!keyFrame.newValue.empty()) { bool error = false; switch (newKeyFrame.entity.data._index) { #include "df_serialize/df_serialize/_common.h" #define VARIANT_TYPE(_TYPE, _NAME, _DEFAULT, _DESCRIPTION) \ case Data::EntityVariant::c_index_##_NAME: error = !ReadFromJSONBuffer(newKeyFrame.entity.data.##_NAME, keyFrame.newValue); break; #include "df_serialize/df_serialize/_fillunsetdefines.h" #include "schemas/schemas_entities.h" default: { printf("unhandled entity type in variant\n"); return false; } } if (error) { printf("Could not read json data for keyframe! entity %s, time %f.\n", keyFrame.entityId.c_str(), keyFrame.time); return false; } } it->second.keyFrames.push_back(newKeyFrame); } // put the entities into a list sorted by z order ascending // stable sort to keep a deterministic ordering of elements for ties { for (auto& pair : document.runtimeEntityTimelinesMap) document.runtimeEntityTimelines.push_back(&pair.second); std::stable_sort( document.runtimeEntityTimelines.begin(), document.runtimeEntityTimelines.end(), [](const Data::RuntimeEntityTimeline* a, const Data::RuntimeEntityTimeline* b) { return a->zorder < b->zorder; } ); } return true; } bool RenderFrame(const Data::Document& document, int frameIndex, ThreadContext& threadContext, Context& context, int& recycledFrameIndex, size_t& frameHash) { std::vector<Data::ColorPMA>& pixels = threadContext.pixelsPMA; // setup for the frame float frameTime = FrameIndexToSeconds(document, frameIndex); EntityActionFrameContext frameContext; frameContext.frameIndex = frameIndex; frameContext.frameTime = frameTime; pixels.resize(document.renderSizeX * document.renderSizeY); std::fill(pixels.begin(), pixels.end(), Data::ColorPMA{ 0.0f, 0.0f, 0.0f, 1.0f }); // Get the key frame interpolated state of each entity first, so that they can look at eachother (like 3d objects looking at their camera) frameHash = 0; Hash(frameHash, document.renderSizeX); Hash(frameHash, document.renderSizeY); std::unordered_map<std::string, Data::Entity> entityMap; { for (const Data::RuntimeEntityTimeline* timeline_ : document.runtimeEntityTimelines) { // skip any entity that doesn't currently exist const Data::RuntimeEntityTimeline& timeline = *timeline_; if (frameTime < timeline.createTime || (timeline.destroyTime >= 0.0f && frameTime > timeline.destroyTime)) continue; // find where we are in the time line int cursorIndex = 0; while (cursorIndex + 1 < timeline.keyFrames.size() && timeline.keyFrames[cursorIndex + 1].time < frameTime) cursorIndex++; // interpolate keyframes if we are between two key frames Data::Entity entity; if (cursorIndex + 1 < timeline.keyFrames.size()) { // calculate the blend percentage from the key frame percentage and the control points float blendPercent = 0.0f; if (cursorIndex + 1 < timeline.keyFrames.size()) { float t = frameTime - timeline.keyFrames[cursorIndex].time; t /= (timeline.keyFrames[cursorIndex + 1].time - timeline.keyFrames[cursorIndex].time); float CPA = timeline.keyFrames[cursorIndex + 1].blendControlPoints.A; float CPB = timeline.keyFrames[cursorIndex + 1].blendControlPoints.B; float CPC = timeline.keyFrames[cursorIndex + 1].blendControlPoints.C; float CPD = timeline.keyFrames[cursorIndex + 1].blendControlPoints.D; blendPercent = Clamp(CubicBezierInterpolation(CPA, CPB, CPC, CPD, t), 0.0f, 1.0f); } // Get the entity(ies) involved const Data::Entity& entity1 = timeline.keyFrames[cursorIndex].entity; const Data::Entity& entity2 = timeline.keyFrames[cursorIndex + 1].entity; // Do the lerp between keyframe entities // Set entity to entity1 first though to catch anything that isn't serialized (and not lerped) entity = entity1; Lerp(entity1, entity2, entity, blendPercent); } // otherwise we are beyond the last key frame, so just set the value else { entity = timeline.keyFrames[cursorIndex].entity; } // do per frame entity initialization bool error = false; switch (entity.data._index) { #include "df_serialize/df_serialize/_common.h" #define VARIANT_TYPE(_TYPE, _NAME, _DEFAULT, _DESCRIPTION) \ case Data::EntityVariant::c_index_##_NAME: \ { \ error = ! _TYPE##_Action::FrameInitialize(document, entity, frameContext); \ _TYPE##_Action::ExtraFrameHash(document, entity, frameContext, frameHash); \ break; \ } #include "df_serialize/df_serialize/_fillunsetdefines.h" #include "schemas/schemas_entities.h" default: { printf("unhandled entity type in variant\n"); break; } } if (error) { printf("entity %s failed to FrameInitialize\n", timeline.id.c_str()); return false; } Hash(frameHash, entity); entityMap[timeline.id] = entity; } } // if we have already rendered a frame with this hash, just copy that file { const FrameCache::FrameData& recycleFrame = context.frameCache.GetFrame(frameHash); recycledFrameIndex = recycleFrame.frameIndex; if (recycleFrame.frameIndex >= 0) { threadContext.pixelsU8 = recycleFrame.pixels; return true; } } // otherwise, render it again // process the entities in zorder for (const Data::RuntimeEntityTimeline* timeline_ : document.runtimeEntityTimelines) { // skip any entity that doesn't currently exist const Data::RuntimeEntityTimeline& timeline = *timeline_; auto it = entityMap.find(timeline.id); if (it == entityMap.end()) continue; // do the entity action bool error = false; const Data::Entity& entity = it->second; switch (entity.data._index) { #include "df_serialize/df_serialize/_common.h" #define VARIANT_TYPE(_TYPE, _NAME, _DEFAULT, _DESCRIPTION) \ case Data::EntityVariant::c_index_##_NAME: error = ! _TYPE##_Action::DoAction(document, entityMap, pixels, entity, threadContext.threadId, frameContext); break; #include "df_serialize/df_serialize/_fillunsetdefines.h" #include "schemas/schemas_entities.h" default: { printf("unhandled entity type in variant\n"); break; } } if (error) return false; } // convert from PMA to non PMA threadContext.pixels.resize(threadContext.pixelsPMA.size()); for (size_t index = 0; index < threadContext.pixelsPMA.size(); ++index) threadContext.pixels[index] = FromPremultipliedAlpha(threadContext.pixelsPMA[index]); // resize from the rendered size to the output size Resize(threadContext.pixels, document.renderSizeX, document.renderSizeY, document.outputSizeX, document.outputSizeY); // Do blue noise dithering if we should if (document.blueNoiseDither) { for (size_t iy = 0; iy < document.outputSizeY; ++iy) { const Data::ColorU8* blueNoiseRow = &document.blueNoisePixels[(iy % document.blueNoiseHeight) * document.blueNoiseWidth]; Data::Color* destPixel = &threadContext.pixels[iy * document.outputSizeX]; for (size_t ix = 0; ix < document.outputSizeX; ++ix) { destPixel->R += (float(blueNoiseRow[ix % document.blueNoiseWidth].R) / 255.0f) / 255.0f; destPixel->G += (float(blueNoiseRow[ix % document.blueNoiseWidth].G) / 255.0f) / 255.0f; destPixel->B += (float(blueNoiseRow[ix % document.blueNoiseWidth].B) / 255.0f) / 255.0f; destPixel->A += (float(blueNoiseRow[ix % document.blueNoiseWidth].A) / 255.0f) / 255.0f; destPixel++; } } } // Convert it to RGBAU8 ColorToColorU8(threadContext.pixels, threadContext.pixelsU8); // force to opaque if we should if (document.forceOpaqueOutput) { for (Data::ColorU8& pixel : threadContext.pixelsU8) pixel.A = 255; } return true; }
39.063291
176
0.601491
[ "render", "vector", "3d" ]
9616dcff2feae8db3625e92d7a4a4fbbf0c9a413
4,993
hpp
C++
contrib/autoboost/autoboost/mpl/vector/aux_/numbered.hpp
CaseyCarter/autowiring
48e95a71308318c8ffb7ed1348e034fd9110f70c
[ "Apache-2.0" ]
87
2015-01-18T00:43:06.000Z
2022-02-11T17:40:50.000Z
contrib/autoboost/autoboost/mpl/vector/aux_/numbered.hpp
CaseyCarter/autowiring
48e95a71308318c8ffb7ed1348e034fd9110f70c
[ "Apache-2.0" ]
274
2015-01-03T04:50:49.000Z
2021-03-08T09:01:09.000Z
contrib/autoboost/autoboost/mpl/vector/aux_/numbered.hpp
CaseyCarter/autowiring
48e95a71308318c8ffb7ed1348e034fd9110f70c
[ "Apache-2.0" ]
15
2015-09-30T20:58:43.000Z
2020-12-19T21:24:56.000Z
// NO INCLUDE GUARDS, THE HEADER IS INTENDED FOR MULTIPLE INCLUSION #if defined(AUTOBOOST_PP_IS_ITERATING) // Copyright Aleksey Gurtovoy 2000-2004 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // // See http://www.boost.org/libs/mpl for documentation. // $Id$ // $Date$ // $Revision$ #include <autoboost/preprocessor/enum_params.hpp> #include <autoboost/preprocessor/enum_shifted_params.hpp> #include <autoboost/preprocessor/comma_if.hpp> #include <autoboost/preprocessor/repeat.hpp> #include <autoboost/preprocessor/dec.hpp> #include <autoboost/preprocessor/cat.hpp> #define i_ AUTOBOOST_PP_FRAME_ITERATION(1) #if defined(AUTOBOOST_MPL_CFG_TYPEOF_BASED_SEQUENCES) # define AUX778076_VECTOR_TAIL(vector, i_, T) \ AUTOBOOST_PP_CAT(vector,i_)< \ AUTOBOOST_PP_ENUM_PARAMS(i_, T) \ > \ /**/ #if i_ > 0 template< AUTOBOOST_PP_ENUM_PARAMS(i_, typename T) > struct AUTOBOOST_PP_CAT(vector,i_) : v_item< AUTOBOOST_PP_CAT(T,AUTOBOOST_PP_DEC(i_)) , AUX778076_VECTOR_TAIL(vector,AUTOBOOST_PP_DEC(i_),T) > { typedef AUTOBOOST_PP_CAT(vector,i_) type; }; #endif # undef AUX778076_VECTOR_TAIL #else // "brute force" implementation # if i_ > 0 template< AUTOBOOST_PP_ENUM_PARAMS(i_, typename T) > struct AUTOBOOST_PP_CAT(vector,i_) { typedef aux::vector_tag<i_> tag; typedef AUTOBOOST_PP_CAT(vector,i_) type; # define AUX778076_VECTOR_ITEM(unused, i_, unused2) \ typedef AUTOBOOST_PP_CAT(T,i_) AUTOBOOST_PP_CAT(item,i_); \ /**/ AUTOBOOST_PP_REPEAT(i_, AUX778076_VECTOR_ITEM, unused) # undef AUX778076_VECTOR_ITEM typedef void_ AUTOBOOST_PP_CAT(item,i_); typedef AUTOBOOST_PP_CAT(T,AUTOBOOST_PP_DEC(i_)) back; // Borland forces us to use 'type' here (instead of the class name) typedef v_iter<type,0> begin; typedef v_iter<type,i_> end; }; template<> struct push_front_impl< aux::vector_tag<AUTOBOOST_PP_DEC(i_)> > { template< typename Vector, typename T > struct apply { typedef AUTOBOOST_PP_CAT(vector,i_)< T AUTOBOOST_PP_COMMA_IF(AUTOBOOST_PP_DEC(i_)) AUTOBOOST_PP_ENUM_PARAMS(AUTOBOOST_PP_DEC(i_), typename Vector::item) > type; }; }; template<> struct pop_front_impl< aux::vector_tag<i_> > { template< typename Vector > struct apply { typedef AUTOBOOST_PP_CAT(vector,AUTOBOOST_PP_DEC(i_))< AUTOBOOST_PP_ENUM_SHIFTED_PARAMS(i_, typename Vector::item) > type; }; }; template<> struct push_back_impl< aux::vector_tag<AUTOBOOST_PP_DEC(i_)> > { template< typename Vector, typename T > struct apply { typedef AUTOBOOST_PP_CAT(vector,i_)< AUTOBOOST_PP_ENUM_PARAMS(AUTOBOOST_PP_DEC(i_), typename Vector::item) AUTOBOOST_PP_COMMA_IF(AUTOBOOST_PP_DEC(i_)) T > type; }; }; template<> struct pop_back_impl< aux::vector_tag<i_> > { template< typename Vector > struct apply { typedef AUTOBOOST_PP_CAT(vector,AUTOBOOST_PP_DEC(i_))< AUTOBOOST_PP_ENUM_PARAMS(AUTOBOOST_PP_DEC(i_), typename Vector::item) > type; }; }; # endif // i_ > 0 # if !defined(AUTOBOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \ && !defined(AUTOBOOST_MPL_CFG_NO_NONTYPE_TEMPLATE_PARTIAL_SPEC) template< typename V > struct v_at<V,i_> { typedef typename V::AUTOBOOST_PP_CAT(item,i_) type; }; # else namespace aux { template<> struct v_at_impl<i_> { template< typename V_ > struct result_ { typedef typename V_::AUTOBOOST_PP_CAT(item,i_) type; }; }; } template<> struct at_impl< aux::vector_tag<i_> > { template< typename V_, typename N > struct apply { typedef typename aux::v_at_impl<AUTOBOOST_MPL_AUX_VALUE_WKND(N)::value> ::template result_<V_>::type type; }; }; #if i_ > 0 template<> struct front_impl< aux::vector_tag<i_> > { template< typename Vector > struct apply { typedef typename Vector::item0 type; }; }; template<> struct back_impl< aux::vector_tag<i_> > { template< typename Vector > struct apply { typedef typename Vector::back type; }; }; template<> struct empty_impl< aux::vector_tag<i_> > { template< typename Vector > struct apply : false_ { }; }; #endif template<> struct size_impl< aux::vector_tag<i_> > { template< typename Vector > struct apply : long_<i_> { }; }; template<> struct O1_size_impl< aux::vector_tag<i_> > : size_impl< aux::vector_tag<i_> > { }; template<> struct clear_impl< aux::vector_tag<i_> > { template< typename Vector > struct apply { typedef vector0<> type; }; }; # endif // AUTOBOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION #endif // AUTOBOOST_MPL_CFG_TYPEOF_BASED_SEQUENCES #undef i_ #endif // AUTOBOOST_PP_IS_ITERATING
22.799087
83
0.679752
[ "vector" ]
96183830a11c724cf0ac646a56782806ce94aa26
623
cpp
C++
test/src/PiecewiseLinear_test.cpp
andrsd/godzilla
da2dd8918450d7d28e8f1897466eb82f2a65a467
[ "MIT" ]
null
null
null
test/src/PiecewiseLinear_test.cpp
andrsd/godzilla
da2dd8918450d7d28e8f1897466eb82f2a65a467
[ "MIT" ]
24
2021-11-13T01:32:41.000Z
2021-12-11T14:16:24.000Z
test/src/PiecewiseLinear_test.cpp
andrsd/godzilla
da2dd8918450d7d28e8f1897466eb82f2a65a467
[ "MIT" ]
null
null
null
#include "gmock/gmock.h" #include "Godzilla.h" #include "GodzillaApp_test.h" #include "PiecewiseLinear.h" using namespace godzilla; TEST(PiecewiseLinearTest, eval) { TestApp app; InputParameters params = PiecewiseLinear::valid_params(); params.set<const App *>("_app") = &app; params.set<std::string>("_name") = "ipol"; params.set<std::vector<PetscReal>>("x") = { 1., 2., 3. }; params.set<std::vector<PetscReal>>("y") = { 3., 1., 2. }; PiecewiseLinear obj(params); mu::Parser parser; obj.register_callback(parser); parser.SetExpr("ipol(0)"); EXPECT_EQ(parser.Eval(), 3.); }
24.92
61
0.64687
[ "vector" ]
9618b750b3db0f7ab7f9bf1da7760cad1f23d9a8
9,827
cpp
C++
tests/Switch.TUnit.UnitTests/Switch/TUnit/AssertTest.cpp
victor-timoshin/Switch
8e8e687a8bdc4f79d482680da3968e9b3e464b8b
[ "MIT" ]
4
2020-02-11T13:22:58.000Z
2022-02-24T00:37:43.000Z
tests/Switch.TUnit.UnitTests/Switch/TUnit/AssertTest.cpp
sgf/Switch
8e8e687a8bdc4f79d482680da3968e9b3e464b8b
[ "MIT" ]
null
null
null
tests/Switch.TUnit.UnitTests/Switch/TUnit/AssertTest.cpp
sgf/Switch
8e8e687a8bdc4f79d482680da3968e9b3e464b8b
[ "MIT" ]
2
2020-02-01T02:19:01.000Z
2021-12-30T06:44:00.000Z
#include <Switch/System/Version.hpp> #include <Switch/TUnit/Assert.hpp> #include <Switch/TUnit/Expect.hpp> #include <Switch/TUnit/TestFixture.hpp> using namespace System; using namespace TUnit; namespace SwitchUnitTests { class AssertTest : public TestFixture { protected: AssertTest() {} void SetUp() override { value = 42; } void TearDown() override { value = 0; } void AreEqualInternalValue() { Assert::AreEqual(42, this->value, caller_); } void AreEqualInt32() { int32 fourtyTwo = 42; Assert::AreEqual(42, fourtyTwo); } void AreEqualInt32WithCurrentInformation() { int32 fourtyTwo = 42; Assert::AreEqual(42, fourtyTwo, caller_); } void AreEqualInt32WithMessage() { int32 fourtyTwo = 42; Assert::AreEqual(42, fourtyTwo, "My message"); } void AreEqualInt32WithMessageAndCurrentInformation() { int32 fourtyTwo = 42; Assert::AreEqual(42, fourtyTwo, "My message", caller_); } void AreEqualConstCharPointer() { const char* fourtyTwo = "Forty two"; Assert::AreEqual("Forty two", fourtyTwo); } void AreEqualConstCharPointerWithCurrentInformation() { const char* fourtyTwo = "Forty two"; Assert::AreEqual("Forty two", fourtyTwo, caller_); } void AreEqualConstCharPointerWithMessage() { const char* fourtyTwo = "Forty two"; Assert::AreEqual("Forty two", fourtyTwo, "My message"); } void AreEqualConstCharPointerWithMessageAndCurrentInformation() { const char* fourtyTwo = "Forty two"; Assert::AreEqual("Forty two", fourtyTwo, "My message", caller_); } void AreEqualString() { string fourtyTwo = "Forty two"; Assert::AreEqual("Forty two", fourtyTwo); } void AreEqualStringWithCurrentInformation() { string fourtyTwo = "Forty two"; Assert::AreEqual("Forty two", fourtyTwo, caller_); } void AreEqualStringWithMessage() { string fourtyTwo = "Forty two"; Assert::AreEqual("Forty two", fourtyTwo, "My message"); } void AreEqualStringWithMessageAndCurrentInformation() { string fourtyTwo = "Forty two"; Assert::AreEqual("Forty two", fourtyTwo, "My message", caller_); } void AreEqualTimeSpan() { TimeSpan duration = 42_min; Assert::AreEqual(42_min, duration); } void AreEqualTimeSpanWithCurrentInformation() { TimeSpan duration = 42_min; Assert::AreEqual(42_min, duration, caller_); } void AreEqualTimeSpanWithMessage() { TimeSpan duration = 42_min; Assert::AreEqual(42_min, duration, "My message"); } void AreEqualTimeSpanWithMessageAndCurrentInformation() { TimeSpan duration = 42_min; Assert::AreEqual(42_min, duration, "My message", caller_); } void AreEqualProperty() { property_<int32, readonly_> fourtyTwo { get_ {return 42;} }; Assert::AreEqual(42, fourtyTwo); } void AreEqualPropertyWithCurrentInformation() { property_<int32, readonly_> fourtyTwo { get_ {return 42;} }; Assert::AreEqual(42, fourtyTwo, caller_); } void AreEqualPropertyWithMessage() { property_<int32, readonly_> fourtyTwo { get_ {return 42;} }; Assert::AreEqual(42, fourtyTwo, "My message"); } void AreEqualPropertyWithMessageAndCurrentInformation() { property_<int32, readonly_> fourtyTwo { get_ {return 42;} }; Assert::AreEqual(42, fourtyTwo, "My message", caller_); } void AreEqualAny() { any fourtyTwo = 42; Assert::AreEqual(42, fourtyTwo); } void AreEqualAnyWithCurrentInformation() { any fourtyTwo = 42; Assert::AreEqual(42, fourtyTwo, caller_); } void AreEqualAnyWithMessage() { any fourtyTwo = 42; Assert::AreEqual(42, fourtyTwo, "My message"); } void AreEqualAnyWithMessageAndCurrentInformation() { any fourtyTwo = 42; Assert::AreEqual(42, fourtyTwo, "My message", caller_); } void AreEqualMyStruct() { struct MyStruct { MyStruct() = delete; MyStruct(const MyStruct&) = delete; MyStruct& operator=(const MyStruct&) = delete; MyStruct(int32 value) : value(value) {} int32 value = 0; bool operator==(const MyStruct& ms) const {return this->value == ms.value;} bool operator!=(const MyStruct& ms) const {return !this->operator==(ms);} }; MyStruct fourtyTwo(42); Assert::AreEqual(MyStruct(42), fourtyTwo); } void AreEqualMyStructWithCurrentInformation() { struct MyStruct { MyStruct(int32 value) : value(value) {} int32 value = 0; bool operator==(const MyStruct& ms) const {return this->value == ms.value;} bool operator!=(const MyStruct& ms) const {return !this->operator==(ms);} }; MyStruct fourtyTwo(42); Expect::AreEqual(MyStruct(42), fourtyTwo, caller_); } void AreEqualMyStructWithMessage() { struct MyStruct { MyStruct(int32 value) : value(value) {} int32 value = 0; bool operator==(const MyStruct& ms) const {return this->value == ms.value;} bool operator!=(const MyStruct& ms) const {return !this->operator==(ms);} }; MyStruct fourtyTwo(42); Assert::AreEqual(MyStruct(42), fourtyTwo, "My message"); } void AreEqualMyStructWithMessageAndCurrentInformation() { struct MyStruct { MyStruct(int32 value) : value(value) {} int32 value = 0; bool operator==(const MyStruct& ms) const {return this->value == ms.value;} bool operator!=(const MyStruct& ms) const {return !this->operator==(ms);} }; MyStruct fourtyTwo(42); Assert::AreEqual(MyStruct(42), fourtyTwo, "My message", caller_); } void AreNotEqual() { String string = "Test"; Assert::AreNotEqual("Tes", string, caller_); } void AreNotSame() { Version ver1(1, 2, 3); Version ver2(1, 2, 3); Assert::AreNotSame(ver2, ver1, caller_); } void AreSame() { System::DateTime date1 = System::DateTime::Now(); System::DateTime* date2 = &date1; Assert::AreSame(date1, *date2, caller_); } void DoesNotThrows() { const char* string1 = "Not null"; Assert::DoesNotThrows(delegate_ {System::String string2(string1);}, caller_); } void Greater() { int32 fourtyTwo = 42; Assert::Greater(fourtyTwo, 40, caller_); } void GreaterOrEqual() { int32 fourtyTwo = 42; Assert::GreaterOrEqual(fourtyTwo, 40, caller_); Assert::GreaterOrEqual(fourtyTwo, 42, caller_); } void IsFalse() { bool boolean = false; Assert::IsFalse(boolean, caller_); } void IsNull() { System::Object* pointer = null; Assert::IsNull(pointer, caller_); } void IsTrue() { bool boolean = true; Assert::IsTrue(boolean, caller_); } void Less() { int32 fourtyTwo = 42; Assert::Less(fourtyTwo, 44, caller_); } void LessOrEqual() { int32 fourtyTwo = 42; Assert::LessOrEqual(fourtyTwo, 44, caller_); Assert::LessOrEqual(fourtyTwo, 42, caller_); } void Throws() { const char* string1 = null; Assert::Throws<System::ArgumentNullException>(delegate_ {System::String string2(string1);}, caller_); } void ThrowsAny() { System::Array<System::String> array(10); Assert::ThrowsAny(delegate_ {array[10];}, caller_); } void AnyTest() { Assert::AreEqual(10, 10, caller_); } private: int32 value; }; AddTest_(AssertTest, AreEqualInternalValue); AddTest_(AssertTest, AreEqualInt32); AddTest_(AssertTest, AreEqualInt32WithCurrentInformation); AddTest_(AssertTest, AreEqualInt32WithMessage); AddTest_(AssertTest, AreEqualInt32WithMessageAndCurrentInformation); AddTest_(AssertTest, AreEqualConstCharPointer); AddTest_(AssertTest, AreEqualConstCharPointerWithCurrentInformation); AddTest_(AssertTest, AreEqualConstCharPointerWithMessage); AddTest_(AssertTest, AreEqualConstCharPointerWithMessageAndCurrentInformation); AddTest_(AssertTest, AreEqualString); AddTest_(AssertTest, AreEqualStringWithCurrentInformation); AddTest_(AssertTest, AreEqualStringWithMessage); AddTest_(AssertTest, AreEqualStringWithMessageAndCurrentInformation); AddTest_(AssertTest, AreEqualTimeSpan); AddTest_(AssertTest, AreEqualTimeSpanWithCurrentInformation); AddTest_(AssertTest, AreEqualTimeSpanWithMessage); AddTest_(AssertTest, AreEqualTimeSpanWithMessageAndCurrentInformation); AddTest_(AssertTest, AreEqualProperty); AddTest_(AssertTest, AreEqualPropertyWithCurrentInformation); AddTest_(AssertTest, AreEqualPropertyWithMessage); AddTest_(AssertTest, AreEqualPropertyWithMessageAndCurrentInformation); AddTest_(AssertTest, AreEqualAny); AddTest_(AssertTest, AreEqualAnyWithCurrentInformation); AddTest_(AssertTest, AreEqualAnyWithMessage); AddTest_(AssertTest, AreEqualAnyWithMessageAndCurrentInformation); AddTest_(AssertTest, AreEqualMyStruct); AddTest_(AssertTest, AreEqualMyStructWithCurrentInformation); AddTest_(AssertTest, AreEqualMyStructWithMessage); AddTest_(AssertTest, AreEqualMyStructWithMessageAndCurrentInformation); AddTest_(AssertTest, AreNotEqual); AddTest_(AssertTest, AreNotSame); AddTest_(AssertTest, AreSame); AddTest_(AssertTest, DoesNotThrows); AddTest_(AssertTest, Greater); AddTest_(AssertTest, GreaterOrEqual); AddTest_(AssertTest, IsFalse); AddTest_(AssertTest, IsNull); AddTest_(AssertTest, IsTrue); AddTest_(AssertTest, Less); AddTest_(AssertTest, LessOrEqual); AddTest_(AssertTest, Throws); AddTest_(AssertTest, ThrowsAny); AddTest_(AssertTest, AnyTest); }
30.424149
107
0.672026
[ "object" ]
961bab4dbe157f161ca7ce0ae14be874ebad587d
2,651
cpp
C++
.LHP/.Lop11/.T.Minh/MV/MV/MV.cpp
sxweetlollipop2912/MaCode
661d77a2096e4d772fda2b6a7f80c84113b2cde9
[ "MIT" ]
null
null
null
.LHP/.Lop11/.T.Minh/MV/MV/MV.cpp
sxweetlollipop2912/MaCode
661d77a2096e4d772fda2b6a7f80c84113b2cde9
[ "MIT" ]
null
null
null
.LHP/.Lop11/.T.Minh/MV/MV/MV.cpp
sxweetlollipop2912/MaCode
661d77a2096e4d772fda2b6a7f80c84113b2cde9
[ "MIT" ]
null
null
null
#include<iostream> #include<cstdio> #include<string> #include<sstream> #include<vector> #include <algorithm> #define maxN 65 typedef int maxn; typedef long long maxa; maxn N, K, M; maxa d[maxN][maxN], f[maxN][maxN][maxN]; std::vector<maxn> V; void Prepare() { std::cin >> N >> K >> M; } maxa DFS_STT(maxn I, maxa S, maxn T) { if (S == 0) return 1; maxa s = 0; if (I % 2 == 0) for (maxn i = 1; i < V[I]; i++) s += f[i][S][T]; else for (maxn i = M; i > V[I]; i--) s += f[i][S][T]; return s + DFS_STT(I + 1, S - V[I], T - 1); } void DFS_IDX(maxn I, maxa IDX, maxa S, maxn T) { if (T == 1) { for (maxa i = 0; i < S; i++) std::cout << I; return; } if (IDX == 0) return; maxa s = 0; if (I == 1) { for (maxn i = 1; i <= M; i++) if (s + f[i][S][T] < IDX) s += f[i][S][T]; else { for (maxn j = 1; j <= i; j++) std::cout << "1"; DFS_IDX(1 - I, IDX - s, S - i, T - 1); break; } } else { for (maxn i = M; i >= 1; i--) if (s + f[i][S][T] < IDX) s += f[i][S][T]; else{ for (maxn j = 1; j <= i; j++) std::cout << "0"; DFS_IDX(1 - I, IDX - s, S - i, T - 1); break; } } return; } void Process() { for (maxn i = 1; i <= M; i++) d[i][1] = 1; for (maxn i = 2; i <= N; i++) for (maxn j = 2; j <= std::min(i, K); j++) for (maxn l = i - 1; l >= std::max(1, i - M); l--) d[i][j] += d[l][j - 1]; for (maxn i = 1; i <= M; i++) for (maxn j = 1; j <= N; j++) for (maxn l = 1; l <= K; l++) if (j - i > 0 && l - 1 > 0) f[i][j][l] = d[j - i][l - 1]; std::cout << d[N][K] << '\n'; maxn cnts; std::cin >> cnts; std::string s; std::cin.ignore(); while (cnts--) { std::getline(std::cin, s); V.clear(); maxn cnt = 1; for (maxn i = 1; i < s.size(); i++) if (s[i] == s[i - 1]) cnt++; else { //std::cout << i << '\n'; V.push_back(cnt); cnt = 1; } V.push_back(cnt); std::cout << DFS_STT(0, N, K) << '\n'; } maxn t; std::cin >> t; while (t--) { maxa idx = 0; std::cin >> idx; DFS_IDX(1, idx, N, K); std::cout << '\n'; } } int main() { freopen("mv.inp", "r", stdin); freopen("mv.out", "w", stdout); std::ios_base::sync_with_stdio(0); std::cin.tie(0); Prepare(); Process(); }
22.277311
127
0.382497
[ "vector" ]
961fa0b183e4cad16b525f20450e07f2dfcc78c4
3,750
cpp
C++
DT3Core/Scripting/ScriptingOpenURL.cpp
9heart/DT3
4ba8fd2af3aebb5c0d77036ac3941e83cd4d1c7e
[ "MIT" ]
3
2016-01-27T13:17:18.000Z
2019-03-19T09:18:25.000Z
DT3Core/Scripting/ScriptingOpenURL.cpp
pakoito/DT3
4ba8fd2af3aebb5c0d77036ac3941e83cd4d1c7e
[ "MIT" ]
1
2016-01-28T14:39:49.000Z
2016-01-28T22:12:07.000Z
DT3Core/Scripting/ScriptingOpenURL.cpp
adderly/DT3
e2605be091ec903d3582e182313837cbaf790857
[ "MIT" ]
3
2016-01-25T16:44:51.000Z
2021-01-29T19:59:45.000Z
//============================================================================== /// /// File: ScriptingOpenURL.cpp /// /// Copyright (C) 2000-2014 by Smells Like Donkey Software Inc. All rights reserved. /// /// This file is subject to the terms and conditions defined in /// file 'LICENSE.txt', which is part of this source code package. /// //============================================================================== #include "DT3Core/Scripting/ScriptingOpenURL.hpp" #include "DT3Core/System/Factory.hpp" #include "DT3Core/System/Profiler.hpp" #include "DT3Core/Types/FileBuffer/ArchiveData.hpp" #include "DT3Core/Types/FileBuffer/Archive.hpp" #include "DT3Core/Types/Network/URL.hpp" #include DT3_HAL_INCLUDE_PATH //============================================================================== //============================================================================== namespace DT3 { //============================================================================== /// Register with object factory //============================================================================== IMPLEMENT_FACTORY_CREATION_SCRIPT(ScriptingOpenURL,"Internet",NULL) IMPLEMENT_PLUG_NODE(ScriptingOpenURL) IMPLEMENT_PLUG_INFO_INDEX(_url) IMPLEMENT_EVENT_INFO_INDEX(_go) //============================================================================== //============================================================================== BEGIN_IMPLEMENT_PLUGS(ScriptingOpenURL) PLUG_INIT(_url,"URL") .set_input(true); EVENT_INIT(_go,"Go") .set_input(true) .set_event(&ScriptingOpenURL::go); END_IMPLEMENT_PLUGS //============================================================================== /// Standard class constructors/destructors //============================================================================== ScriptingOpenURL::ScriptingOpenURL (void) : _url (PLUG_INFO_INDEX(_url), "http://www.smellslikedonkey.com"), _go (EVENT_INFO_INDEX(_go)) { } ScriptingOpenURL::ScriptingOpenURL (const ScriptingOpenURL &rhs) : ScriptingBase (rhs), _url (rhs._url), _go (rhs._go) { } ScriptingOpenURL & ScriptingOpenURL::operator = (const ScriptingOpenURL &rhs) { // Make sure we are not assigning the class to itself if (&rhs != this) { ScriptingBase::operator = (rhs); _url = rhs._url; } return (*this); } ScriptingOpenURL::~ScriptingOpenURL (void) { } //============================================================================== //============================================================================== void ScriptingOpenURL::initialize (void) { ScriptingBase::initialize(); } //============================================================================== //============================================================================== void ScriptingOpenURL::archive (const std::shared_ptr<Archive> &archive) { ScriptingBase::archive(archive); archive->push_domain (class_id ()); *archive << ARCHIVE_PLUG(_url, DATA_PERSISTENT | DATA_SETTABLE); archive->pop_domain (); } //============================================================================== //============================================================================== void ScriptingOpenURL::go (PlugNode *sender) { PROFILER(SCRIPTING); HAL::launch_browser(URL(_url)); } //============================================================================== //============================================================================== } // DT3
30.991736
85
0.4016
[ "object" ]
96215f5286db5f1bda706e2cb26bb1e91fa43af4
1,453
cpp
C++
Source/RuntimeMeshComponent/Private/RuntimeMeshRendering.cpp
matthewswallace/RuntimeMeshComponent
fd1696acdea95292a79f2bac628345011187f04a
[ "MIT" ]
5
2021-01-07T06:45:00.000Z
2022-02-01T15:53:23.000Z
Source/RuntimeMeshComponent/Private/RuntimeMeshRendering.cpp
matthewswallace/RuntimeMeshComponent
fd1696acdea95292a79f2bac628345011187f04a
[ "MIT" ]
null
null
null
Source/RuntimeMeshComponent/Private/RuntimeMeshRendering.cpp
matthewswallace/RuntimeMeshComponent
fd1696acdea95292a79f2bac628345011187f04a
[ "MIT" ]
null
null
null
// Copyright 2016-2020 Chris Conway (Koderz). All Rights Reserved. #include "RuntimeMeshRendering.h" #include "RuntimeMeshComponentPlugin.h" #include "RuntimeMeshSectionProxy.h" FRuntimeMeshVertexBuffer::FRuntimeMeshVertexBuffer(bool bInIsDynamicBuffer, int32 DefaultVertexSize) : bIsDynamicBuffer(bInIsDynamicBuffer) , VertexSize(DefaultVertexSize) , NumVertices(0) , ShaderResourceView(nullptr) { } void FRuntimeMeshVertexBuffer::InitRHI() { } void FRuntimeMeshVertexBuffer::ReleaseRHI() { ShaderResourceView.SafeRelease(); FVertexBuffer::ReleaseRHI(); } FRuntimeMeshIndexBuffer::FRuntimeMeshIndexBuffer(bool bInIsDynamicBuffer) : bIsDynamicBuffer(bInIsDynamicBuffer) , IndexSize(CalculateStride(false)) , NumIndices(0) { } void FRuntimeMeshIndexBuffer::InitRHI() { } FRuntimeMeshVertexFactory::FRuntimeMeshVertexFactory(ERHIFeatureLevel::Type InFeatureLevel) : FLocalVertexFactory(InFeatureLevel, "FRuntimeMeshVertexFactory") { } /** Init function that can be called on any thread, and will do the right thing (enqueue command if called on main thread) */ void FRuntimeMeshVertexFactory::Init(FLocalVertexFactory::FDataType VertexStructure) { if (IsInRenderingThread()) { SetData(VertexStructure); } else { // Send the command to the render thread ENQUEUE_RENDER_COMMAND(InitRuntimeMeshVertexFactory)( [this, VertexStructure](FRHICommandListImmediate & RHICmdList) { Init(VertexStructure); } ); } }
22.353846
125
0.789401
[ "render" ]
96233e436be4524fb6ec2e1d6f1289fb2f2514b8
6,448
hh
C++
src/sim/power_domain.hh
hyu-iot/gem5
aeccc8bd8e9a86f96fc7a6f40d978f8494337fc5
[ "BSD-3-Clause" ]
765
2015-01-14T16:17:04.000Z
2022-03-28T07:46:28.000Z
src/sim/power_domain.hh
hyu-iot/gem5
aeccc8bd8e9a86f96fc7a6f40d978f8494337fc5
[ "BSD-3-Clause" ]
148
2018-07-20T00:58:36.000Z
2021-11-16T01:52:33.000Z
src/sim/power_domain.hh
hyu-iot/gem5
aeccc8bd8e9a86f96fc7a6f40d978f8494337fc5
[ "BSD-3-Clause" ]
807
2015-01-06T09:55:38.000Z
2022-03-30T10:23:36.000Z
/* * Copyright (c) 2017, 2019-2020 ARM Limited * All rights reserved * * The license below extends only to copyright in the software and shall * not be construed as granting a license to any other intellectual * property including but not limited to intellectual property relating * to a hardware implementation of the functionality of the software * licensed hereunder. You may use the software subject to the license * terms below provided that you ensure that this notice is replicated * unmodified and in its entirety in all distributions of the software, * modified or unmodified, in source code or in binary form. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer; * redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution; * neither the name of the copyright holders nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ #ifndef __SIM_POWER_DOMAIN_HH__ #define __SIM_POWER_DOMAIN_HH__ #include <string> #include <vector> #include "base/statistics.hh" #include "params/PowerDomain.hh" #include "sim/clocked_object.hh" #include "sim/power_state.hh" namespace gem5 { /** * The PowerDomain groups PowerState objects together to regulate their * power states. As the PowerDomain itself is a PowerState object, you can * create hierarchies of PowerDomains. All objects in a power domain will be in * the power state of the domain OR a more performant one. */ class PowerDomain : public PowerState { public: PowerDomain(const PowerDomainParams &p); typedef PowerDomainParams Params; ~PowerDomain() override {}; /** * During startup, the list of possible power states the * PowerDomain can be in is populated, the power state of the * PowerDomain is set and some assertions about the PowerState objects * in the Domain are checked. */ void startup() override; /** * Register the change in power state in one of the leader. The power * domain will change its own power state if required and if there is a * power state, it will schedule an event to update its followers */ void pwrStateChangeCallback(enums::PwrState new_pwr_state, PowerState* leader); /** * Function called by a follower to register itself as * a dependant of this power domain */ void addFollower(PowerState* pwr_obj) override; private: /** * Calculate the power state of the power domain, based upon the power * states of the leaders. This will be called if one the leaders * changes its power states. * If no inputs are given, only the leaders will be polled on their * power state. You can also pass a vector containing the power states * which the followers returned when asked to match a certain power * state (called from setFollowerPowerStates) */ enums::PwrState calculatePowerDomainState( const std::vector<enums::PwrState> &f_states={}); /** * Check if a given p_state is available across all leaders and * followers in this domain. */ bool isPossiblePwrState(enums::PwrState p_state); /** * Calculate the possible power states of the domain based upon the * intersection of the power states of the individual objects within * the domain. Done at startup. */ void calculatePossiblePwrStates(); /** * Update the followers of the newly updated power state. They are * required to match the power state of the power domain i.e. go to the * same power state or a more performant one */ void setFollowerPowerStates(); private: /* Power domain attributes */ /** * List of all leaders in the PowerDomain. A leader can * independently change its power state and does not depend on the * PowerDomain to change its power state. A leader needs to be a * PowerState object and can also be another PowerDomain. Each * PowerDomain needs to have at least one leader. */ std::vector<PowerState*> leaders; /** * Power state requested by the leader. This is not necessarily the * power state of the domain as whole (as that one depends on the * matched power states of the followers */ enums::PwrState leaderTargetState; /** * List of all followers in the PowerDomain. The power state of the * domain will determine the power state of the followers. A follower * cannot change its power state independently. */ std::vector<PowerState*> followers; /** * Latency with which power state changes of the leaders will ripple * through to the followers. */ const Tick updateLatency = 1; /** * Event to update the power states of the followers */ EventWrapper<PowerDomain, &PowerDomain::setFollowerPowerStates> pwrStateUpdateEvent; protected: struct PowerDomainStats : public statistics::Group { PowerDomainStats(PowerDomain &pd); void regStats() override; statistics::Scalar numLeaderCalls; statistics::Scalar numLeaderCallsChangingState; } stats; }; } // namespace gem5 #endif // __SIM_POWER_DOMAIN_HH__
37.488372
79
0.717587
[ "object", "vector" ]
96235489b1827797de72e753561f24627f1e5d6c
3,881
cpp
C++
tests/numerics/ode/TestODE45.cpp
philsupertramp/game-math
56526b673bfc9c71515c8402b5ffa237f1819a39
[ "MIT" ]
null
null
null
tests/numerics/ode/TestODE45.cpp
philsupertramp/game-math
56526b673bfc9c71515c8402b5ffa237f1819a39
[ "MIT" ]
34
2020-11-27T13:33:04.000Z
2022-03-06T13:40:39.000Z
tests/numerics/ode/TestODE45.cpp
philsupertramp/game-math
56526b673bfc9c71515c8402b5ffa237f1819a39
[ "MIT" ]
null
null
null
#include "../../Test.h" #include <math/numerics/ode/ODESolver.h> class ODE45TestCase : public Test { bool TestOde45() { auto ode = []([[maybe_unused]] double t, const Matrix<double>& y) { return y; }; std::vector<double> tInterval = { 0.0, 2.0 }; Matrix<double> y0 = { { 1.0 } }; double h = 0.1; auto foo = ODESolver::ode45(ode, tInterval, y0, { h }); auto yResult = foo.Y; auto tResult = foo.T; // std::cout << yResult; double tExpected[21] = { 0.0, 0.100000000000000, 0.200000000000000, 0.300000000000000, 0.400000000000000, 0.500000000000000, 0.600000000000000, 0.700000000000000, 0.800000000000000, 0.900000000000000, 1.000000000000000, 1.100000000000000, 1.200000000000000, 1.300000000000000, 1.400000000000000, 1.500000000000000, 1.600000000000000, 1.700000000000000, 1.800000000000000, 1.900000000000000, 2.000000000000000 }; double yExpected[21] = { 1.000000000000000, 1.105170918333333, 1.221402758729743, 1.349858808520217, 1.491824699032628, 1.648721272622238, 1.822118802939620, 2.013752710757214, 2.225540932643790, 2.459603116318360, 2.718281834797091, 3.004166031651519, 3.320116932026115, 3.669296678741350, 4.055199980082028, 4.481689086012570, 4.953032442872989, 5.473947413424735, 6.049647489802989, 6.685894471898514, 7.389056133387838, }; for(int i = 0; i < 21; i++) { AssertEqual(tExpected[i], tResult(i, 0)); AssertEqual(yExpected[i], yResult(i, 0)); } return true; } bool TestOde45RB() { auto ode = []([[maybe_unused]] double t, const Matrix<double>& y) { Matrix<double> result(0, y.rows(), y.columns()); auto alpha = 0.25; auto beta = -0.01; auto gamma = -1.0; auto delta = 0.01; result(0, 0) = alpha * y(0, 0) + beta * y(0, 0) * y(0, 1); result(0, 1) = gamma * y(0, 1) + delta * y(0, 0) * y(0, 1); return result; }; std::vector<double> tInterval = { 0.0, 5.0 }; Matrix<double> y0 = { { 80, 30 } }; double h = 1.0; auto foo = ODE45(ode, tInterval, y0, h); auto yResult = foo.Y; auto tResult = foo.T; double yExpected[6][2] = { { 80.0000, 30.0000 }, { 78.360998725243107, 24.268754512660799 }, { 80.847619520187592, 19.730492689186242 }, { 86.622395662576622, 16.728217389452837 }, { 94.917043272614094, 15.226418795854334 }, { 104.81087505230401, 15.192897445498955 }, }; double tExpected[6] = { 0, 1, 2, 3, 4, 5 }; for(int i = 0; i < 6; i++) { AssertEqual(tExpected[i], tResult(i, 0)); AssertEqual(yExpected[i][0], yResult(i, 0)); AssertEqual(yExpected[i][1], yResult(i, 1)); } return true; } public: void run() override { TestOde45(); TestOde45RB(); } }; int main() { ODE45TestCase().run(); return 0; }
36.613208
109
0.454007
[ "vector" ]
9631f74bc13472a6ee16a7b3ef72d0013aea0429
5,336
cc
C++
src/analog_audio_provider.cc
henriwoodcock/pico-wake-word
ece0053f5a38d9a245bf553d1a1e1f4f3dc09384
[ "Apache-2.0" ]
16
2021-03-18T09:20:58.000Z
2022-03-23T04:31:10.000Z
src/analog_audio_provider.cc
henriwoodcock/pico-wake-word
ece0053f5a38d9a245bf553d1a1e1f4f3dc09384
[ "Apache-2.0" ]
2
2021-06-25T05:12:00.000Z
2022-01-22T15:49:01.000Z
src/analog_audio_provider.cc
henriwoodcock/pico-wake-word
ece0053f5a38d9a245bf553d1a1e1f4f3dc09384
[ "Apache-2.0" ]
2
2021-03-30T03:56:19.000Z
2021-08-11T13:02:53.000Z
/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. 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. ==============================================================================*/ #include "audio_provider.h" #include "micro_features/micro_model_settings.h" #include <stdio.h> extern "C" { #include "pico/analog_microphone.h" } #include "pico/stdlib.h" #define ADC_PIN 26 #define CAPTURE_CHANNEL 0 #define ADC_BIAS ((int16_t)((1.25 * 4095) / 3.3)) #define ADC_BUFFER_SIZE 256 namespace { bool g_is_audio_initialized = false; // An internal buffer able to fit 16x our sample size constexpr int kAudioCaptureBufferSize = ADC_BUFFER_SIZE * 16; int16_t g_audio_capture_buffer[kAudioCaptureBufferSize]; // A buffer that holds our output int16_t g_audio_output_buffer[kMaxAudioSampleSize]; // Mark as volatile so we can check in a while loop to see if // any samples have arrived yet. volatile int32_t g_latest_audio_timestamp = 0; const struct analog_microphone_config config = { // GPIO to use for input, must be ADC compatible (GPIO 26 - 28) .gpio = ADC_PIN + CAPTURE_CHANNEL, // bias voltage of microphone in volts .bias_voltage = 1.25, // sample rate in Hz .sample_rate = 16000, // number of samples to buffer .sample_buffer_size = ADC_BUFFER_SIZE, }; } // namespace void CaptureSamples() { // This is how many samples are read in const int number_of_samples = ADC_BUFFER_SIZE; // Calculate what timestamp the last audio sample represents const int32_t time_in_ms = g_latest_audio_timestamp + (number_of_samples / (kAudioSampleFrequency / 1000)); // Determine the index, in the history of all samples, of the last sample const int32_t start_sample_offset = g_latest_audio_timestamp * (kAudioSampleFrequency / 1000); // Determine the index of this sample in our ring buffer const int capture_index = start_sample_offset % kAudioCaptureBufferSize; // Read the data to the correct place in our buffer // PDM.read(g_audio_capture_buffer + capture_index, DEFAULT_PDM_BUFFER_SIZE); analog_microphone_read(g_audio_capture_buffer + capture_index, ADC_BUFFER_SIZE); // This is how we let the outside world know that new audio data has arrived. g_latest_audio_timestamp = time_in_ms; } TfLiteStatus InitAudioRecording(tflite::ErrorReporter* error_reporter) { // initialize the analog microphone if (analog_microphone_init(&config) < 0) { TF_LITE_REPORT_ERROR(error_reporter, "analog microphone initialization failed!"); while (1) { tight_loop_contents(); } } // set callback that is called when all the samples in the library // internal sample buffer are ready for reading analog_microphone_set_samples_ready_handler(CaptureSamples); // start capturing data from the analog microphone if (analog_microphone_start() < 0) { TF_LITE_REPORT_ERROR(error_reporter, "Analog microphone start failed"); while (1) { tight_loop_contents(); } } // Block until we have our first audio sample while (!g_latest_audio_timestamp) { } return kTfLiteOk; } TfLiteStatus GetAudioSamples(tflite::ErrorReporter* error_reporter, int start_ms, int duration_ms, int* audio_samples_size, int16_t** audio_samples) { // Set everything up to start receiving audio if (!g_is_audio_initialized) { TfLiteStatus init_status = InitAudioRecording(error_reporter); if (init_status != kTfLiteOk) { return init_status; } g_is_audio_initialized = true; } // This next part should only be called when the main thread notices that the // latest audio sample data timestamp has changed, so that there's new data // in the capture ring buffer. The ring buffer will eventually wrap around and // overwrite the data, but the assumption is that the main thread is checking // often enough and the buffer is large enough that this call will be made // before that happens. // Determine the index, in the history of all samples, of the first // sample we want const int start_offset = start_ms * (kAudioSampleFrequency / 1000); // Determine how many samples we want in total const int duration_sample_count = duration_ms * (kAudioSampleFrequency / 1000); for (int i = 0; i < duration_sample_count; ++i) { // For each sample, transform its index in the history of all samples into // its index in g_audio_capture_buffer const int capture_index = (start_offset + i) % kAudioCaptureBufferSize; // Write the sample to the output buffer g_audio_output_buffer[i] = g_audio_capture_buffer[capture_index]; } // Set pointers to provide access to the audio *audio_samples_size = kMaxAudioSampleSize; *audio_samples = g_audio_output_buffer; return kTfLiteOk; } int32_t LatestAudioTimestamp() { return g_latest_audio_timestamp; }
38.388489
82
0.73557
[ "transform" ]
96389a0eeeea93a17ed6399858d47e097ef6919f
9,295
cpp
C++
packages/geometry/dagmc/src/Geometry_DagMCRay.cpp
bam241/FRENSIE
e1760cd792928699c84f2bdce70ff54228e88094
[ "BSD-3-Clause" ]
10
2019-11-14T19:58:30.000Z
2021-04-04T17:44:09.000Z
packages/geometry/dagmc/src/Geometry_DagMCRay.cpp
bam241/FRENSIE
e1760cd792928699c84f2bdce70ff54228e88094
[ "BSD-3-Clause" ]
43
2020-03-03T19:59:20.000Z
2021-09-08T03:36:08.000Z
packages/geometry/dagmc/src/Geometry_DagMCRay.cpp
bam241/FRENSIE
e1760cd792928699c84f2bdce70ff54228e88094
[ "BSD-3-Clause" ]
6
2020-02-12T17:37:07.000Z
2020-09-08T18:59:51.000Z
//---------------------------------------------------------------------------// //! //! \file Geometry_DagMCRay.cpp //! \author Alex Robinson //! \brief The DagMC ray definition //! //---------------------------------------------------------------------------// // FRENSIE Includes #include "Geometry_DagMCRay.hpp" #include "Utility_3DCartesianVectorHelpers.hpp" #include "Utility_DesignByContract.hpp" namespace Geometry{ // Constructor DagMCRay::DagMCRay() : d_basic_ray(), d_cell_handle( 0 ), d_history(), d_intersection_distance( -1.0 ), d_intersection_surface_handle( 0 ) { /* ... */ } // Constructor DagMCRay::DagMCRay( const Ray& ray, moab::EntityHandle cell_handle ) : d_basic_ray( new Ray( ray.getPosition(), ray.getDirection() ) ), d_cell_handle( cell_handle ), d_history(), d_intersection_distance( -1.0 ), d_intersection_surface_handle( 0 ) { // Make sure the direction is valid testPrecondition( Utility::isUnitVector( d_basic_ray->getDirection() ) ); // Make sure the cell handle is valid testPrecondition( cell_handle != 0 ); } // Constructor DagMCRay::DagMCRay( const double position[3], const double direction[3], moab::EntityHandle cell_handle ) : d_basic_ray( new Ray( position, direction ) ), d_cell_handle( cell_handle ), d_history(), d_intersection_distance( -1.0 ), d_intersection_surface_handle( 0 ) { // Make sure the direction is valid testPrecondition( Utility::isUnitVector( direction ) ); // Make sure the cell handle is valid testPrecondition( cell_handle != 0 ); } // Constructor DagMCRay::DagMCRay( const double x_position, const double y_position, const double z_position, const double x_direction, const double y_direction, const double z_direction, const moab::EntityHandle cell_handle ) : d_basic_ray( new Ray( x_position, y_position, z_position, x_direction, y_direction, z_direction ) ), d_cell_handle( cell_handle ), d_history(), d_intersection_distance( -1.0 ), d_intersection_surface_handle( 0 ) { // Make sure the direction is valid testPrecondition( Utility::isUnitVector( x_direction, y_direction, z_direction ) ); // Make sure the cell handle is valid testPrecondition( cell_handle != 0 ); } // Copy constructor DagMCRay::DagMCRay( const DagMCRay& ray ) : d_basic_ray(), d_cell_handle( 0 ), d_history(), d_intersection_distance( -1.0 ), d_intersection_surface_handle( 0 ) { if( ray.isReady() ) { d_basic_ray.reset( new Ray( ray.getPosition(), ray.getDirection() ) ); d_cell_handle = ray.d_cell_handle; d_history = ray.d_history; if( ray.knowsIntersectionSurface() ) { d_intersection_distance = ray.d_intersection_distance; d_intersection_surface_handle = ray.d_intersection_surface_handle; } } } // Check if the ray is ready (basic ray, current cell handle set) bool DagMCRay::isReady() const { return (d_basic_ray.get() != NULL) && (d_cell_handle != 0); } // Set the ray (minimum data required) /*! \details The history will be cleared. */ void DagMCRay::set( const Ray& ray, const moab::EntityHandle cell_handle ) { // Make sure the cell is valid testPrecondition( cell_handle != 0 ); this->set( ray.getPosition(), ray.getDirection(), cell_handle ); } // Set the ray (minimum data required) /*! \details All other data will be cleared. */ void DagMCRay::set( const double position[3], const double direction[3], const moab::EntityHandle cell_handle ) { // Make sure the direction is valid testPrecondition( Utility::isUnitVector( direction ) ); // Make sure the cell is valid testPrecondition( cell_handle != 0 ); this->set( position[0], position[1], position[2], direction[0], direction[1], direction[2], cell_handle ); } // Set the ray (minimum data required) /*! \details All other data will be cleared. */ void DagMCRay::set( const double x_position, const double y_position, const double z_position, const double x_direction, const double y_direction, const double z_direction, const moab::EntityHandle cell_handle ) { // Make sure the direction is valid testPrecondition( Utility::isUnitVector( x_direction, y_direction, z_direction ) ); // Make sure the cell is valid testPrecondition( cell_handle != 0 ); // Set the basic ray d_basic_ray.reset( new Ray( x_position, y_position, z_position, x_direction, y_direction, z_direction ) ); // Set the cell handle d_cell_handle = cell_handle; // Reset the extra data this->resetIntersectionSurfaceData(); d_history.reset(); } // Change the direction /*! \details This method will reset the history. */ void DagMCRay::changeDirection( const double direction[3], const bool reflection ) { // Make sure the ray is ready testPrecondition( this->isReady() ); this->changeDirection( direction[0], direction[1], direction[2], reflection ); } // Change the direction /*! \details This method will reset the history. */ void DagMCRay::changeDirection( const double x_direction, const double y_direction, const double z_direction, const bool reflection ) { // Make sure the ray is ready testPrecondition( this->isReady() ); d_basic_ray->changeDirection( x_direction, y_direction, z_direction ); // Reset the extra data this->resetIntersectionSurfaceData(); if( reflection ) d_history.reset_to_last_intersection(); else d_history.reset(); } // Get the position const double* DagMCRay::getPosition() const { // Make sure the ray is ready testPrecondition( this->isReady() ); return d_basic_ray->getPosition(); } // Get the direction const double* DagMCRay::getDirection() const { // Make sure the ray is ready testPrecondition( this->isReady() ); return d_basic_ray->getDirection(); } // Get the current cell handle moab::EntityHandle DagMCRay::getCurrentCell() const { // Make sure the ray is ready testPrecondition( this->isReady() ); return d_cell_handle; } // Check if the ray knows the surface it will hit bool DagMCRay::knowsIntersectionSurface() const { return d_intersection_surface_handle != 0; } // Get the distance to the next surface double DagMCRay::getDistanceToIntersectionSurface() const { // Make sure the intersection surface has been set testPrecondition( this->knowsIntersectionSurface() ); return d_intersection_distance; } // Get the intersection surface handle moab::EntityHandle DagMCRay::getIntersectionSurface() const { // Make sure the intersection surface has been set testPrecondition( this->knowsIntersectionSurface() ); return d_intersection_surface_handle; } // Set the intersection surface handle void DagMCRay::setIntersectionSurfaceData( const moab::EntityHandle surface_handle, const double distance ) { // Make sure the surface handle is valid testPrecondition( surface_handle != 0 ); // Make sure the distance is valid testPrecondition( distance >= 0.0 ); d_intersection_surface_handle = surface_handle; d_intersection_distance = distance; } // Rest the intersection surface data void DagMCRay::resetIntersectionSurfaceData() { d_intersection_surface_handle = 0; d_intersection_distance = -1.0; } // Get the ray history const moab::DagMC::RayHistory& DagMCRay::getHistory() const { return d_history; } // Get the ray history moab::DagMC::RayHistory& DagMCRay::getHistory() { return d_history; } // Advance the ray to the intersection surface /*! \details This method will reset the intersection data. */ void DagMCRay::advanceToIntersectionSurface( const moab::EntityHandle next_cell_handle ) { // Make sure the next cell is valid testPrecondition( next_cell_handle != 0 ); // Advance the basic ray to the surface d_basic_ray->advanceHead( d_intersection_distance ); // Set the new cell d_cell_handle = next_cell_handle; // Reset the intersection data this->resetIntersectionSurfaceData(); } // Advance the ray a substep /*! \details This method should only be used to move the ray a distance * that is less than the intersection distance. */ void DagMCRay::advanceSubstep( const double substep_distance ) { // Make sure the substep is less than the intersection distance testPrecondition( substep_distance < d_intersection_distance ); // Advance the basic ray the substep distance d_basic_ray->advanceHead( substep_distance ); // Update the intersection distance d_intersection_distance -= substep_distance; } } // end Geometry namespace //---------------------------------------------------------------------------// // end Geometry_DagMCRay.hpp //---------------------------------------------------------------------------//
28.688272
85
0.654868
[ "geometry" ]
963b8cf91b785933f4d7123dc16f6126908a2c0f
5,672
hpp
C++
code/renderer/rendergraph/r_rendergraph.hpp
LiamTyler/Progression
35680b47dcd4481fe80e2310c722354ccfa53ed8
[ "MIT" ]
3
2020-01-30T19:20:05.000Z
2021-06-30T13:24:51.000Z
code/renderer/rendergraph/r_rendergraph.hpp
LiamTyler/Progression
35680b47dcd4481fe80e2310c722354ccfa53ed8
[ "MIT" ]
1
2021-03-31T16:12:45.000Z
2021-03-31T16:12:45.000Z
code/renderer/rendergraph/r_rendergraph.hpp
LiamTyler/Progression
35680b47dcd4481fe80e2310c722354ccfa53ed8
[ "MIT" ]
2
2020-03-30T05:18:46.000Z
2021-03-31T16:13:08.000Z
#pragma once #include "core/pixel_formats.hpp" #include "glm/vec4.hpp" #include "renderer/graphics_api/framebuffer.hpp" #include "renderer/graphics_api/render_pass.hpp" #include "renderer/graphics_api/texture.hpp" #include <functional> #include <vector> namespace PG { class Scene; namespace Gfx { enum class ResourceType : uint8_t { COLOR_ATTACH, DEPTH_ATTACH, TEXTURE, BUFFER, COUNT }; enum class ResourceState : uint8_t { READ_ONLY, WRITE, COUNT }; enum class RelativeSizes : uint32_t { Scene = 1u << 30, Display = 1u << 31, ALL = Scene | Display }; constexpr uint32_t AUTO_FULL_MIP_CHAIN() { return UINT32_MAX; } constexpr uint32_t SIZE_SCENE() { return static_cast<uint32_t>( RelativeSizes::Scene ); } constexpr uint32_t SIZE_DISPLAY() { return static_cast<uint32_t>( RelativeSizes::Display ); } constexpr uint32_t SIZE_SCENE_DIV( uint32_t x ) { return static_cast<uint32_t>( RelativeSizes::Scene ) | x; } constexpr uint32_t SIZE_DISPLAY_DIV( uint32_t x ) { return static_cast<uint32_t>( RelativeSizes::Display ) | x; } constexpr uint32_t ResolveRelativeSize( uint32_t scene, uint32_t display, uint32_t relSize ) { uint32_t size = relSize & ~(uint32_t)RelativeSizes::ALL; if ( relSize & (uint32_t)RelativeSizes::Scene ) { return size == 0 ? scene : scene / size; } else if ( relSize & (uint32_t)RelativeSizes::Display ) { return size == 0 ? display : display / size; } else { return relSize; } } struct RG_Element { std::string name; ResourceType type = ResourceType::COUNT; ResourceState state = ResourceState::COUNT; PixelFormat format = PixelFormat::INVALID; uint32_t width = 0; uint32_t height = 0; uint32_t depth = 1; uint32_t arrayLayers = 1; uint32_t mipLevels = 1; glm::vec4 clearColor = glm::vec4( 0 ); bool isCleared = false; }; struct RG_PhysicalResource { RG_PhysicalResource() { } ~RG_PhysicalResource() {} std::string name; union { Gfx::Texture texture; }; uint16_t firstTask; uint16_t lastTask; }; struct RG_TaskRenderTargets { uint16_t colorAttachments[MAX_COLOR_ATTACHMENTS]; uint16_t depthAttach; uint8_t numColorAttachments; }; class CommandBuffer; struct RenderTask; using RenderFunction = std::function<void( RenderTask*, Scene* scene, CommandBuffer* cmdBuf )>; struct RenderTask { std::string name; RenderPass renderPass; Framebuffer framebuffer; RenderFunction renderFunction; RG_TaskRenderTargets renderTargets; }; struct RenderGraphCompileInfo { uint32_t sceneWidth; uint32_t sceneHeight; uint32_t displayWidth; uint32_t displayHeight; }; class RenderTaskBuilder { public: RenderTaskBuilder( const std::string& inName ) : name( inName ) {} void AddColorOutput( const std::string& name, PixelFormat format, uint32_t width, uint32_t height, uint32_t depth, uint32_t arrayLayers, uint32_t mipLevels, const glm::vec4& clearColor ); void AddColorOutput( const std::string& name, PixelFormat format, uint32_t width, uint32_t height, uint32_t depth, uint32_t arrayLayers, uint32_t mipLevels ); void AddColorOutput( const std::string& name ); void AddDepthOutput( const std::string& name, PixelFormat format, uint32_t width, uint32_t height, float clearValue ); void AddDepthOutput( const std::string& name, PixelFormat format, uint32_t width, uint32_t height ); void AddDepthOutput( const std::string& name ); void AddTextureOutput( const std::string& name, PixelFormat format, uint32_t width, uint32_t height, uint32_t depth, uint32_t arrayLayers, uint32_t mipLevels, const glm::vec4& clearColor ); void AddTextureOutput( const std::string& name, PixelFormat format, uint32_t width, uint32_t height, uint32_t depth, uint32_t arrayLayers, uint32_t mipLevels ); void AddTextureOutput( const std::string& name ); void AddTextureInput( const std::string& name ); void SetRenderFunction( RenderFunction func ); std::string name; std::vector< RG_Element > elements; RenderFunction renderFunction; }; class RenderGraphBuilder { friend class RenderGraph; public: RenderGraphBuilder(); RenderTaskBuilder* AddTask( const std::string& name ); void SetBackbufferResource( const std::string& name ); bool Validate() const; private: std::vector< RenderTaskBuilder > tasks; std::string backbuffer; }; class RenderGraph { public: RenderGraph() {} bool Compile( RenderGraphBuilder& builder, RenderGraphCompileInfo& compileInfo ); void Free(); void Print() const; void Render( Scene* scene, CommandBuffer* cmdBuf ); RG_PhysicalResource* GetPhysicalResource( uint16_t idx ); RG_PhysicalResource* GetPhysicalResource( const std::string& logicalName ); RG_PhysicalResource* GetBackBufferResource(); RenderTask* GetRenderTask( const std::string& name ); struct Statistics { float memUsedMB; uint16_t numTextures; uint16_t numLogicalOutputs; }; Statistics GetStats() const; static constexpr uint16_t MAX_TASKS = 64; static constexpr uint16_t MAX_PHYSICAL_RESOURCES = 256; private: uint16_t numRenderTasks; RenderTask renderTasks[MAX_TASKS]; std::unordered_map<std::string, uint16_t> taskNameToIndexMap; uint16_t numPhysicalResources; RG_PhysicalResource physicalResources[MAX_PHYSICAL_RESOURCES]; std::unordered_map<std::string, uint16_t> resourceNameToIndexMap; std::string backBufferName; Statistics stats; }; } // namespace Gfx } // namespace PG
27.009524
193
0.713681
[ "render", "vector" ]
963c7112741ebafdffa2f9d2397db7efa187c92e
732
cpp
C++
Classes/SimpleClasses/main.cpp
csulb-cecs282-2015sp/lectures
f7a88c52b85472f4e871ed439bfe65ee784f4aa9
[ "MIT" ]
11
2015-01-20T05:57:50.000Z
2021-05-03T10:47:36.000Z
Classes/SimpleClasses/main.cpp
csulb-cecs282-2015sp/lectures
f7a88c52b85472f4e871ed439bfe65ee784f4aa9
[ "MIT" ]
null
null
null
Classes/SimpleClasses/main.cpp
csulb-cecs282-2015sp/lectures
f7a88c52b85472f4e871ed439bfe65ee784f4aa9
[ "MIT" ]
26
2015-01-20T04:38:39.000Z
2017-01-11T00:49:57.000Z
#include <iostream> using namespace std; // design a simple class for representing a point in 2D space class Point { public: // everything that follows is public double X; double Y; }; int mains(int argc, char* argv[]) { // variables of type Point can now be declared. Point p; // Note the lack of "new" here p.X = 5; p.Y = 2.5; // can we output the object like in Java? //cout << p << endl; // error: no operator "<<" matches these operands // operand types are: std::ostream << Point // so we can't do that yet. but we can output individual components. cout << "(" << p.X << ", " << p.Y << ")" << endl; // similarly, we can cin individual components cin >> p.Y; return 0; }
22.875
71
0.610656
[ "object" ]
9643d27ce279d1d470610c7886888883a192f046
18,254
cpp
C++
game/graphics/opengl_renderer/ocean/CommonOceanRenderer.cpp
LuminarLight/jak-project
f341be65e9848977158c9a9a2898f0f047a157df
[ "ISC" ]
54
2022-02-08T13:07:50.000Z
2022-03-31T14:18:42.000Z
game/graphics/opengl_renderer/ocean/CommonOceanRenderer.cpp
LuminarLight/jak-project
f341be65e9848977158c9a9a2898f0f047a157df
[ "ISC" ]
120
2022-02-08T05:19:11.000Z
2022-03-30T22:26:52.000Z
game/graphics/opengl_renderer/ocean/CommonOceanRenderer.cpp
LuminarLight/jak-project
f341be65e9848977158c9a9a2898f0f047a157df
[ "ISC" ]
8
2022-02-13T22:39:55.000Z
2022-03-30T02:17:57.000Z
#include "CommonOceanRenderer.h" CommonOceanRenderer::CommonOceanRenderer() { m_vertices.resize(4096 * 10); // todo decrease for (auto& buf : m_indices) { buf.resize(4096 * 10); } // create OpenGL objects glGenBuffers(1, &m_ogl.vertex_buffer); glGenBuffers(NUM_BUCKETS, m_ogl.index_buffer); glGenVertexArrays(1, &m_ogl.vao); // set up the vertex array glBindVertexArray(m_ogl.vao); for (int i = 0; i < NUM_BUCKETS; i++) { glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_ogl.index_buffer[i]); glBufferData(GL_ELEMENT_ARRAY_BUFFER, m_indices[i].size() * sizeof(u32), nullptr, GL_STREAM_DRAW); } glBindBuffer(GL_ARRAY_BUFFER, m_ogl.vertex_buffer); glBufferData(GL_ARRAY_BUFFER, m_vertices.size() * sizeof(Vertex), nullptr, GL_STREAM_DRAW); // xyz glEnableVertexAttribArray(0); glVertexAttribPointer(0, // location 0 in the shader 3, // 3 floats per vert GL_FLOAT, // floats GL_TRUE, // normalized, ignored, sizeof(Vertex), // (void*)offsetof(Vertex, xyz) // offset in array ); // rgba glEnableVertexAttribArray(1); glVertexAttribPointer(1, // location 1 in the shader 4, // 4 color components GL_UNSIGNED_BYTE, // u8 GL_TRUE, // normalized (255 becomes 1) sizeof(Vertex), // (void*)offsetof(Vertex, rgba) // ); // stq glEnableVertexAttribArray(2); glVertexAttribPointer(2, // location 2 in the shader 3, // 2 floats per vert GL_FLOAT, // floats GL_FALSE, // normalized, ignored sizeof(Vertex), // (void*)offsetof(Vertex, stq) // offset in array ); // byte data glEnableVertexAttribArray(3); glVertexAttribIPointer(3, // location 3 in the shader 1, // GL_UNSIGNED_BYTE, // u8's sizeof(Vertex), // (void*)offsetof(Vertex, fog) // offset in array ); glBindBuffer(GL_ARRAY_BUFFER, 0); glBindVertexArray(0); } CommonOceanRenderer::~CommonOceanRenderer() { glDeleteBuffers(1, &m_ogl.vertex_buffer); glDeleteBuffers(3, m_ogl.index_buffer); glDeleteVertexArrays(1, &m_ogl.vao); } void CommonOceanRenderer::init_for_near() { m_next_free_vertex = 0; for (auto& x : m_next_free_index) { x = 0; } } void CommonOceanRenderer::kick_from_near(const u8* data) { bool eop = false; u32 offset = 0; while (!eop) { GifTag tag(data + offset); offset += 16; if (tag.nreg() == 3) { ASSERT(tag.pre()); if (GsPrim(tag.prim()).kind() == GsPrim::Kind::TRI_STRIP) { handle_near_vertex_gif_data_strip(data, offset, tag.nloop()); } else { handle_near_vertex_gif_data_fan(data, offset, tag.nloop()); } offset += 16 * 3 * tag.nloop(); } else if (tag.nreg() == 1) { handle_near_adgif(data, offset, tag.nloop()); offset += 16 * 1 * tag.nloop(); } else { ASSERT(false); } eop = tag.eop(); } } void CommonOceanRenderer::handle_near_vertex_gif_data_strip(const u8* data, u32 offset, u32 loop) { m_indices[m_current_bucket][m_next_free_index[m_current_bucket]++] = UINT32_MAX; bool reset_last = false; for (u32 i = 0; i < loop; i++) { auto& dest_vert = m_vertices[m_next_free_vertex++]; // stq memcpy(dest_vert.stq.data(), data + offset, 12); offset += 16; // rgba dest_vert.rgba[0] = data[offset]; dest_vert.rgba[1] = data[offset + 4]; dest_vert.rgba[2] = data[offset + 8]; dest_vert.rgba[3] = data[offset + 12]; offset += 16; // xyz u32 x = 0, y = 0; memcpy(&x, data + offset, 4); memcpy(&y, data + offset + 4, 4); u64 upper; memcpy(&upper, data + offset + 8, 8); u32 z = (upper >> 4) & 0xffffff; offset += 16; dest_vert.xyz[0] = (float)(x << 16) / (float)UINT32_MAX; dest_vert.xyz[1] = (float)(y << 16) / (float)UINT32_MAX; dest_vert.xyz[2] = (float)(z << 8) / (float)UINT32_MAX; u8 f = (upper >> 36); dest_vert.fog = f; auto vidx = m_next_free_vertex - 1; bool adc = upper & (1ull << 47); if (!adc) { m_indices[m_current_bucket][m_next_free_index[m_current_bucket]++] = vidx; reset_last = false; } else { if (reset_last) { m_next_free_index[m_current_bucket] -= 3; } m_indices[m_current_bucket][m_next_free_index[m_current_bucket]++] = UINT32_MAX; m_indices[m_current_bucket][m_next_free_index[m_current_bucket]++] = vidx - 1; m_indices[m_current_bucket][m_next_free_index[m_current_bucket]++] = vidx; reset_last = true; } } } void CommonOceanRenderer::handle_near_vertex_gif_data_fan(const u8* data, u32 offset, u32 loop) { u32 ind_of_fan_start = UINT32_MAX; bool fan_running = false; // :regs0 (gif-reg-id st) :regs1 (gif-reg-id rgbaq) :regs2 (gif-reg-id xyzf2) for (u32 i = 0; i < loop; i++) { auto& dest_vert = m_vertices[m_next_free_vertex++]; // stq memcpy(dest_vert.stq.data(), data + offset, 12); offset += 16; // rgba dest_vert.rgba[0] = data[offset]; dest_vert.rgba[1] = data[offset + 4]; dest_vert.rgba[2] = data[offset + 8]; dest_vert.rgba[3] = data[offset + 12]; offset += 16; // xyz u32 x = 0, y = 0; memcpy(&x, data + offset, 4); memcpy(&y, data + offset + 4, 4); u64 upper; memcpy(&upper, data + offset + 8, 8); u32 z = (upper >> 4) & 0xffffff; offset += 16; dest_vert.xyz[0] = (float)(x << 16) / (float)UINT32_MAX; dest_vert.xyz[1] = (float)(y << 16) / (float)UINT32_MAX; dest_vert.xyz[2] = (float)(z << 8) / (float)UINT32_MAX; u8 f = (upper >> 36); dest_vert.fog = f; auto vidx = m_next_free_vertex - 1; if (ind_of_fan_start == UINT32_MAX) { ind_of_fan_start = vidx; } else { if (fan_running) { // hack to draw fans with strips. this isn't efficient, but fans happen extremely rarely // (you basically have to put the camera intersecting the ocean and looking fwd) m_indices[m_current_bucket][m_next_free_index[m_current_bucket]++] = UINT32_MAX; m_indices[m_current_bucket][m_next_free_index[m_current_bucket]++] = vidx; m_indices[m_current_bucket][m_next_free_index[m_current_bucket]++] = vidx - 1; m_indices[m_current_bucket][m_next_free_index[m_current_bucket]++] = ind_of_fan_start; } else { fan_running = true; } } } } void CommonOceanRenderer::handle_near_adgif(const u8* data, u32 offset, u32 count) { u32 most_recent_tbp = 0; for (u32 i = 0; i < count; i++) { u64 value; GsRegisterAddress addr; memcpy(&value, data + offset + 16 * i, sizeof(u64)); memcpy(&addr, data + offset + 16 * i + 8, sizeof(GsRegisterAddress)); switch (addr) { case GsRegisterAddress::MIPTBP1_1: // ignore this, it's just mipmapping settings break; case GsRegisterAddress::TEX1_1: { GsTex1 reg(value); ASSERT(reg.mmag()); } break; case GsRegisterAddress::CLAMP_1: { bool s = value & 0b001; bool t = value & 0b100; ASSERT(s == t); if (s) { m_current_bucket = VertexBucket::ENV_MAP; } } break; case GsRegisterAddress::TEX0_1: { GsTex0 reg(value); ASSERT(reg.tfx() == GsTex0::TextureFunction::MODULATE); if (!reg.tcc()) { m_current_bucket = VertexBucket::RGB_TEXTURE; } most_recent_tbp = reg.tbp0(); } break; case GsRegisterAddress::ALPHA_1: { // ignore, we've hardcoded alphas. } break; case GsRegisterAddress::FRAME_1: { u32 mask = value >> 32; if (mask) { m_current_bucket = VertexBucket::ALPHA; } } break; default: fmt::print("reg: {}\n", register_address_name(addr)); break; } } if (m_current_bucket == VertexBucket::ENV_MAP) { m_envmap_tex = most_recent_tbp; } if (m_vertices.size() - 128 < m_next_free_vertex) { ASSERT(false); // add more vertices. } } void CommonOceanRenderer::flush_near(SharedRenderState* render_state, ScopedProfilerNode& prof) { glBindVertexArray(m_ogl.vao); glBindBuffer(GL_ARRAY_BUFFER, m_ogl.vertex_buffer); glEnable(GL_PRIMITIVE_RESTART); glPrimitiveRestartIndex(UINT32_MAX); glBufferData(GL_ARRAY_BUFFER, m_next_free_vertex * sizeof(Vertex), m_vertices.data(), GL_STREAM_DRAW); render_state->shaders[ShaderId::OCEAN_COMMON].activate(); glUniform4f(glGetUniformLocation(render_state->shaders[ShaderId::OCEAN_COMMON].id(), "fog_color"), render_state->fog_color[0], render_state->fog_color[1], render_state->fog_color[2], render_state->fog_intensity); glDepthMask(GL_FALSE); glEnable(GL_DEPTH_TEST); glEnable(GL_BLEND); glDepthFunc(GL_GEQUAL); for (int bucket = 0; bucket < 3; bucket++) { switch (bucket) { case 0: { glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ZERO); glBlendEquation(GL_FUNC_ADD); auto tex = render_state->texture_pool->lookup(8160); if (!tex) { tex = render_state->texture_pool->get_placeholder_texture(); } glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, *tex); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); glUniform1i( glGetUniformLocation(render_state->shaders[ShaderId::OCEAN_COMMON].id(), "tex_T0"), 0); glUniform1i( glGetUniformLocation(render_state->shaders[ShaderId::OCEAN_COMMON].id(), "bucket"), 0); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); } break; case 1: glBlendFuncSeparate(GL_ZERO, GL_ONE, GL_ONE, GL_ZERO); glUniform1f( glGetUniformLocation(render_state->shaders[ShaderId::OCEAN_COMMON].id(), "alpha_mult"), 1.f); glUniform1i( glGetUniformLocation(render_state->shaders[ShaderId::OCEAN_COMMON].id(), "bucket"), 1); break; case 2: auto tex = render_state->texture_pool->lookup(m_envmap_tex); if (!tex) { tex = render_state->texture_pool->get_placeholder_texture(); } glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, *tex); glBlendFuncSeparate(GL_DST_ALPHA, GL_ONE, GL_ONE, GL_ZERO); glBlendEquation(GL_FUNC_ADD); glUniform1i( glGetUniformLocation(render_state->shaders[ShaderId::OCEAN_COMMON].id(), "bucket"), 2); break; } glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_ogl.index_buffer[bucket]); glBufferData(GL_ELEMENT_ARRAY_BUFFER, m_next_free_index[bucket] * sizeof(u32), m_indices[bucket].data(), GL_STREAM_DRAW); glDrawElements(GL_TRIANGLE_STRIP, m_next_free_index[bucket], GL_UNSIGNED_INT, nullptr); prof.add_draw_call(); prof.add_tri(m_next_free_index[bucket]); } } void CommonOceanRenderer::kick_from_mid(const u8* data) { bool eop = false; u32 offset = 0; while (!eop) { GifTag tag(data + offset); offset += 16; // unpack registers. // faster to do it once outside of the nloop loop. GifTag::RegisterDescriptor reg_desc[16]; u32 nreg = tag.nreg(); for (u32 i = 0; i < nreg; i++) { reg_desc[i] = tag.reg(i); } auto format = tag.flg(); if (format == GifTag::Format::PACKED) { if (tag.nreg() == 1) { ASSERT(!tag.pre()); ASSERT(tag.nloop() == 5); handle_mid_adgif(data, offset); offset += 5 * 16; } else { ASSERT(tag.nreg() == 3); ASSERT(tag.pre()); m_current_bucket = GsPrim(tag.prim()).abe() ? 1 : 0; int count = tag.nloop(); if (GsPrim(tag.prim()).kind() == GsPrim::Kind::TRI_STRIP) { handle_near_vertex_gif_data_strip(data, offset, tag.nloop()); } else { handle_near_vertex_gif_data_fan(data, offset, tag.nloop()); } offset += 3 * 16 * count; // todo handle. } } else { ASSERT(false); // format not packed or reglist. } eop = tag.eop(); } } void CommonOceanRenderer::handle_mid_adgif(const u8* data, u32 offset) { u32 most_recent_tbp = 0; for (u32 i = 0; i < 5; i++) { u64 value; GsRegisterAddress addr; memcpy(&value, data + offset + 16 * i, sizeof(u64)); memcpy(&addr, data + offset + 16 * i + 8, sizeof(GsRegisterAddress)); switch (addr) { case GsRegisterAddress::MIPTBP1_1: case GsRegisterAddress::MIPTBP2_1: // ignore this, it's just mipmapping settings break; case GsRegisterAddress::TEX1_1: { GsTex1 reg(value); ASSERT(reg.mmag()); } break; case GsRegisterAddress::CLAMP_1: { bool s = value & 0b001; bool t = value & 0b100; ASSERT(s == t); } break; case GsRegisterAddress::TEX0_1: { GsTex0 reg(value); ASSERT(reg.tfx() == GsTex0::TextureFunction::MODULATE); most_recent_tbp = reg.tbp0(); } break; case GsRegisterAddress::ALPHA_1: { } break; default: fmt::print("reg: {}\n", register_address_name(addr)); break; } } if (most_recent_tbp != 8160) { m_envmap_tex = most_recent_tbp; } if (m_vertices.size() - 128 < m_next_free_vertex) { ASSERT(false); // add more vertices. } } void CommonOceanRenderer::init_for_mid() { m_next_free_vertex = 0; for (auto& x : m_next_free_index) { x = 0; } } void reverse_indices(u32* indices, u32 count) { if (count) { for (u32 a = 0, b = count - 1; a < b; a++, b--) { std::swap(indices[a], indices[b]); } } } void CommonOceanRenderer::flush_mid(SharedRenderState* render_state, ScopedProfilerNode& prof) { glBindVertexArray(m_ogl.vao); glBindBuffer(GL_ARRAY_BUFFER, m_ogl.vertex_buffer); glEnable(GL_PRIMITIVE_RESTART); glPrimitiveRestartIndex(UINT32_MAX); glBufferData(GL_ARRAY_BUFFER, m_next_free_vertex * sizeof(Vertex), m_vertices.data(), GL_STREAM_DRAW); render_state->shaders[ShaderId::OCEAN_COMMON].activate(); glUniform4f(glGetUniformLocation(render_state->shaders[ShaderId::OCEAN_COMMON].id(), "fog_color"), render_state->fog_color[0], render_state->fog_color[1], render_state->fog_color[2], render_state->fog_intensity); glDepthMask(GL_TRUE); glEnable(GL_DEPTH_TEST); glDepthFunc(GL_ALWAYS); glDisable(GL_BLEND); // note: // there are some places where the game draws the same section of ocean twice, in this order: // - low poly mesh with ocean texture // - low poly mesh with envmap texture // - high poly mesh with ocean texture (overwrites previous draw) // - high poly mesh with envmap texture (overwrites previous draw) // we draw all ocean textures together and all envmap textures togther. luckily, there's a trick // we can use to get the same result. // first, we'll draw all ocean textures. The high poly mesh is drawn second, so it wins. // then, we'll draw all envmaps, but with two changes: // - first, we draw it in reverse, so the high poly versions are drawn first // - second, we'll modify the shader to set alpha = 0 of the destination. when the low poly // version is drawn on top, it won't draw at all because of the blending mode // (s_factor = DST_ALPHA, d_factor = 1) // draw it in reverse reverse_indices(m_indices[1].data(), m_next_free_index[1]); for (int bucket = 0; bucket < 2; bucket++) { switch (bucket) { case 0: { auto tex = render_state->texture_pool->lookup(8160); if (!tex) { tex = render_state->texture_pool->get_placeholder_texture(); } glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, *tex); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); glUniform1i( glGetUniformLocation(render_state->shaders[ShaderId::OCEAN_COMMON].id(), "tex_T0"), 0); glUniform1i( glGetUniformLocation(render_state->shaders[ShaderId::OCEAN_COMMON].id(), "bucket"), 3); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); } break; case 1: glEnable(GL_BLEND); auto tex = render_state->texture_pool->lookup(m_envmap_tex); if (!tex) { tex = render_state->texture_pool->get_placeholder_texture(); } glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, *tex); glBlendFuncSeparate(GL_DST_ALPHA, GL_ONE, GL_ONE, GL_ZERO); glBlendEquation(GL_FUNC_ADD); glUniform1i( glGetUniformLocation(render_state->shaders[ShaderId::OCEAN_COMMON].id(), "bucket"), 4); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); break; } glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_ogl.index_buffer[bucket]); glBufferData(GL_ELEMENT_ARRAY_BUFFER, m_next_free_index[bucket] * sizeof(u32), m_indices[bucket].data(), GL_STREAM_DRAW); glDrawElements(GL_TRIANGLE_STRIP, m_next_free_index[bucket], GL_UNSIGNED_INT, nullptr); prof.add_draw_call(); prof.add_tri(m_next_free_index[bucket]); } }
34.835878
100
0.614769
[ "mesh" ]
96440d72d9f4ca4cfefbea136b727b83ce822bb1
4,668
cpp
C++
demo/ImmediateRenderer2D.cpp
tobguent/image-triangulation
a5c6830528ce63e1ced28a4f29669fee6d9c9936
[ "MIT" ]
6
2020-01-14T08:27:41.000Z
2021-06-03T13:18:13.000Z
demo/ImmediateRenderer2D.cpp
tobguent/image-triangulation
a5c6830528ce63e1ced28a4f29669fee6d9c9936
[ "MIT" ]
null
null
null
demo/ImmediateRenderer2D.cpp
tobguent/image-triangulation
a5c6830528ce63e1ced28a4f29669fee6d9c9936
[ "MIT" ]
3
2019-05-17T23:16:10.000Z
2021-04-23T17:22:42.000Z
#include "stdafx.h" #include "ImmediateRenderer2D.h" #include "D3D.h" ImmediateRenderer2D::ImmediateRenderer2D(int bufferSize) : _BufferSize(bufferSize), _Offset(0), Color(1,163.0f/255.0f,0,1), _VbPosition(NULL), _InputLayoutPos(NULL), _Fx(NULL) { } ImmediateRenderer2D::~ImmediateRenderer2D() { D3DReleaseDevice(); } bool ImmediateRenderer2D::D3DCreateDevice(ID3D11Device* Device) { // -------------------------------------------- // Create vertex buffer // -------------------------------------------- { D3D11_BUFFER_DESC buffer; ZeroMemory(&buffer, sizeof(D3D11_BUFFER_DESC)); buffer.BindFlags = D3D11_BIND_VERTEX_BUFFER; buffer.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; buffer.Usage = D3D11_USAGE_DYNAMIC; buffer.ByteWidth = sizeof(Vec2f) * _BufferSize; if (FAILED(Device->CreateBuffer(&buffer, NULL, &_VbPosition))) return false; } // -------------------------------------------- // Load shader // -------------------------------------------- if (!D3D::LoadEffectFromFile("ImmediateRenderer2D.fxo", Device, &_Fx)) { printf("ImmediateRenderer2D: Couldn't load shader ImmediateRenderer2D.fx"); return false; } // -------------------------------------------- // Create input layout // -------------------------------------------- { D3DX11_PASS_SHADER_DESC VsPassDesc; D3DX11_EFFECT_SHADER_DESC VsDesc; _Fx->GetTechniqueByName("Technique_Point")->GetPassByIndex(0)->GetVertexShaderDesc(&VsPassDesc); VsPassDesc.pShaderVariable->GetShaderDesc(VsPassDesc.ShaderIndex, &VsDesc); const D3D11_INPUT_ELEMENT_DESC layout[] = { { "POSITION", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 }, }; if (FAILED(Device->CreateInputLayout( layout, 1, VsDesc.pBytecode, VsDesc.BytecodeLength, &_InputLayoutPos))) return false; } return true; } void ImmediateRenderer2D::D3DReleaseDevice() { SAFE_RELEASE(_VbPosition); SAFE_RELEASE(_InputLayoutPos); SAFE_RELEASE(_Fx); } void ImmediateRenderer2D::DrawLineStrip(const std::vector<Vec2f>& pnts, ID3D11DeviceContext* DeviceContext, Camera2D* camera) { if (pnts.empty()) return; Internal_Bind(DeviceContext, camera, "Technique_Point"); Internal_SubmitCall(DeviceContext, pnts, D3D11_PRIMITIVE_TOPOLOGY_LINESTRIP); Internal_Unbind(DeviceContext); } void ImmediateRenderer2D::Internal_Bind(ID3D11DeviceContext* DeviceContext, Camera2D* camera, const std::string& techniqueName) { DeviceContext->IASetInputLayout(_InputLayoutPos); _Fx->GetVariableByName("View")->AsMatrix()->SetMatrix( camera->GetView().ptr() ); _Fx->GetVariableByName("Projection")->AsMatrix()->SetMatrix( camera->GetProj().ptr() ); _Fx->GetVariableByName("Color")->AsVector()->SetFloatVector( Color.ptr() ); _Fx->GetTechniqueByName(techniqueName.c_str())->GetPassByIndex(0)->Apply(0, DeviceContext); } void ImmediateRenderer2D::Internal_SubmitCall(ID3D11DeviceContext* DeviceContext, const std::vector<Vec2f>& vertexBuffer, D3D11_PRIMITIVE_TOPOLOGY topology) { ID3D11Buffer* vbs[] = { _VbPosition }; UINT strides[] = { 8 }; UINT offsets[] = { 0 }; DeviceContext->IASetVertexBuffers(0, 1, vbs, strides, offsets); DeviceContext->IASetPrimitiveTopology(topology); int queued = (int)vertexBuffer.size(); int safeTotalSize = _BufferSize - 32; if (queued >= _BufferSize) { printf("ImmediateRenderer2D::Buffer to render too large! Splitting not yet implemented! Skipping this geometry!\n"); return; } // if it still fits into the buffer append with no overwrite if (_Offset + queued < safeTotalSize) { D3D11_MAPPED_SUBRESOURCE mapped; if (SUCCEEDED(DeviceContext->Map(_VbPosition, 0, D3D11_MAP_WRITE_NO_OVERWRITE, 0, &mapped))) { Vec2f* dst = (Vec2f*)mapped.pData; Vec2f* src = (Vec2f*)&vertexBuffer[0]; int rawQueued = queued*sizeof(Vec2f); memcpy_s(dst + _Offset, rawQueued, src, rawQueued); DeviceContext->Unmap(_VbPosition, 0); DeviceContext->Draw(queued, _Offset); } _Offset += queued; } else // if it doesn't fit, restart (discard) { D3D11_MAPPED_SUBRESOURCE mapped; if (SUCCEEDED(DeviceContext->Map(_VbPosition, 0, D3D11_MAP_WRITE_DISCARD, 0, &mapped))) { Vec2f* dst = (Vec2f*)mapped.pData; Vec2f* src = (Vec2f*)&vertexBuffer[0]; int rawQueued = queued*sizeof(Vec2f); memcpy_s(dst, rawQueued, src, rawQueued); DeviceContext->Unmap(_VbPosition, 0); DeviceContext->Draw(queued, 0); } _Offset = queued; } } void ImmediateRenderer2D::Internal_Unbind(ID3D11DeviceContext* DeviceContext) { ID3D11Buffer* vbs[] = { NULL, NULL }; UINT strides[] = { 8, 12 }; UINT offsets[] = { 0, 0 }; DeviceContext->IASetVertexBuffers(0, 2, vbs, strides, offsets); DeviceContext->IASetInputLayout(NULL); }
32.416667
156
0.699871
[ "geometry", "render", "vector" ]
964c5b7b79a4fc76a1e5b4535cb495400fbe3787
10,032
hpp
C++
beelzebub/arc/x86/inc/system/interrupt_controllers/lapic.hpp
vercas/Beelzebub
9d0e4790060b313c6681ca7e478d08d3910332b0
[ "NCSA" ]
32
2015-09-02T22:56:22.000Z
2021-02-24T17:15:50.000Z
beelzebub/arc/x86/inc/system/interrupt_controllers/lapic.hpp
vercas/Beelzebub
9d0e4790060b313c6681ca7e478d08d3910332b0
[ "NCSA" ]
30
2015-04-26T18:35:07.000Z
2021-06-06T09:57:02.000Z
beelzebub/arc/x86/inc/system/interrupt_controllers/lapic.hpp
vercas/Beelzebub
9d0e4790060b313c6681ca7e478d08d3910332b0
[ "NCSA" ]
11
2015-09-03T20:47:41.000Z
2021-06-25T17:00:01.000Z
/* Copyright (c) 2015 Alexandru-Mihai Maftei. All rights reserved. Developed by: Alexandru-Mihai Maftei aka Vercas http://vercas.com | https://github.com/vercas/Beelzebub Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal with the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimers. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimers in the documentation and/or other materials provided with the distribution. * Neither the names of Alexandru-Mihai Maftei, Vercas, nor the names of its contributors may be used to endorse or promote products derived from this Software without specific prior written permission. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE. --- You may also find the text of this license in "LICENSE.md", along with a more thorough explanation regarding other files. */ #pragma once #include "irqs.hpp" #include <utils/bitfields.hpp> #include <beel/handles.h> #define LAPICREGFUNC1(name, prettyName, type) \ static __forceinline type MCATS2(Get, prettyName)() \ { \ return type(ReadRegister(LapicRegister::name)); \ } \ static __forceinline void MCATS2(Set, prettyName)(const type val) \ { \ WriteRegister(LapicRegister::name, val.Value); \ } namespace Beelzebub { namespace System { namespace InterruptControllers { class Lapic; /** * <summary>Known LAPIC register offsets.</summary> */ enum class LapicRegister : uint16_t { LapicId = 0x0002, SpuriousInterruptVector = 0x000F, EndOfInterrupt = 0x000B, InterruptCommandRegisterLow = 0x0030, InterruptCommandRegisterHigh = 0x0031, TimerLvt = 0x0032, TimerInitialCount = 0x0038, TimerCurrentCount = 0x0039, TimerDivisor = 0x003E, }; /** * <summary> * Represents the contents of the Spurious-Interrupt Vector Register of the * LAPIC. * </summary> */ struct LapicSvr { friend class Lapic; /* Bit structure: * 0 - 7 : Spurious Vector * 8 : APIC Software Enable * 9 : Focus Processor Checking * 10 - 11 : Reserved (must be 0) * 12 : EOI Broadcast Suppression * 13 - 31 : Reserved (must be 0) */ /* Properties */ BITFIELD_DEFAULT_1WEx( 8, SoftwareEnabled , 32) BITFIELD_DEFAULT_1WEx( 9, DisableFocusProcessorChecking, 32) BITFIELD_DEFAULT_1WEx(12, EoiBroadcastSuppression , 32) BITFIELD_DEFAULT_2WEx( 0, 8, uint8_t, SpuriousVector , 32) /* Constructor */ /** * Creates a new LAPIC SVR structure from the given raw value. */ inline explicit LapicSvr(uint32_t const val) { this->Value = val; } /* Field(s) */ private: uint32_t Value; }; /** * <summary>APIC interrupt delivery modes.</summary> */ enum class InterruptDeliveryModes : unsigned { Fixed = 0, Reserved1 = 1, SMI = 2, Reserved2 = 3, NMI = 4, Init = 5, StartUp = 6, Reserved3 = 7, }; /** * <summary> * Known values for the destination shorthand field of the ICR. * </summary> */ enum class IcrDestinationShorthand : unsigned { None = 0, Self = 1, AllIncludingSelf = 2, AllExcludingSelf = 3, }; /** * <summary> * Represents the contents of the Interrupt Command Register of the * LAPIC. * </summary> */ struct LapicIcr { friend class Lapic; /* Bit structure: * 0 - 7 : Vector * 8 - 10 : Delivery Mode * 11 : Destination Mode (1 for logical) * 12 : Delivery Status * 13 : Reserved (must be 0) * 14 : Level (1 for assert) * 15 : Trigger Mode (1 for Level) * 16 - 17 : Reserved (must be 0) * 18 - 19 : Destination Shorthand * 20 - 31 : Reserved (must be 0) * 32 - 63 : Destination */ /* Properties */ BITFIELD_DEFAULT_1W(11, DestinationLogical) BITFIELD_DEFAULT_1O(12, DeliveryStatus) BITFIELD_DEFAULT_1W(14, Assert) BITFIELD_DEFAULT_1W(15, LevelTriggered) BITFIELD_DEFAULT_2W( 0, 8, uint8_t , Vector ) BITFIELD_DEFAULT_4W( 8, 3, InterruptDeliveryModes , DeliveryMode ) BITFIELD_DEFAULT_4W(18, 2, IcrDestinationShorthand, DestinationShorthand) BITFIELD_DEFAULT_4W(32, 32, uint32_t , Destination ) inline auto SetVector(KnownIsrs const val) -> decltype(*this) { return this->SetVector((uint8_t)val); } /* Constructor */ /** * Creates a new LAPIC ICR structure from the given raw value. */ inline explicit constexpr LapicIcr(uint64_t const val) : Value(val) { } /** * Creates a new LAPIC ICR structure from the given low and high values. */ inline constexpr LapicIcr(uint32_t const low, uint32_t const high) : Low(low), High(high) { } /* Field(s) */ private: __extension__ union { uint64_t Value; struct { uint32_t Low; uint32_t High; }; }; }; /** * <summary>Represents possible APIC timer modes.</summary> */ enum class ApicTimerMode : unsigned { OneShot = 0x00, Periodic = 0x01, TscDeadline = 0x02, }; /** * <summary> * Represents the contents of the APIC timer LVT register. * </summary> */ struct ApicTimerLvt { friend class Lapic; /* Bit structure: * 0 - 7 : Vector * 8 - 11 : Reserved (must be 0) * 12 : NO IDEA * 13 - 15 : Reserved (must be 0) * 16 : Mask * 17 - 18 : Timer Mode * 19 - 31 : Reserved (must be 0) */ /* Properties */ BITFIELD_DEFAULT_1WEx( 8, NoIdea , 32) BITFIELD_DEFAULT_1WEx(16, Mask , 32) BITFIELD_DEFAULT_2WEx( 0, 8, uint8_t , Vector, 32) BITFIELD_DEFAULT_4WEx(17, 2, ApicTimerMode, Mode , 32) inline auto SetVector(KnownIsrs const val) -> decltype(*this) { return this->SetVector((uint8_t)val); } /* Constructor */ /** * Creates a new APIC Timer LVT structure from the given raw value. */ inline explicit ApicTimerLvt(uint32_t const val) { this->Value = val; } /* Field(s) */ private: uint32_t Value; }; /** * <summary>Contains methods for interacting with the local APIC.</summary> */ class Lapic { public: /* Statics */ static __thread bool X2ApicMode; /* Addresses */ static paddr_t PhysicalAddress; static vaddr_t const VirtualAddress; // Very last page - why not? /* Ender */ static InterruptEnderNode Ender; /* Constructor(s) */ protected: Lapic() = default; public: Lapic(Lapic const &) = delete; Lapic & operator =(Lapic const &) = delete; /* Initialization */ static __cold Handle Initialize(); /* Registers */ static __hot uint32_t ReadRegister(LapicRegister const reg); static __hot void WriteRegister(LapicRegister const reg, uint32_t const value); static __hot void WriteTimerLvt(ApicTimerLvt const val) { return WriteRegister(LapicRegister::TimerLvt, val.Value); } /* Shortcuts */ static __forceinline uint32_t GetId() { return ReadRegister(LapicRegister::LapicId); } static __hot __forceinline void EndOfInterrupt() { WriteRegister(LapicRegister::EndOfInterrupt, 0); } static void SendIpi(LapicIcr icr); LAPICREGFUNC1(SpuriousInterruptVector, Svr, LapicSvr) }; }}}
29.162791
87
0.542265
[ "vector" ]
965086d5872ba4bb73958696f663e796d1b1c363
2,682
hpp
C++
include/pcg.hpp
arotem3/SchrodingerSEM
b1d5c5a959efe46cb8d473f284d150c3c7f0beb6
[ "Apache-2.0" ]
null
null
null
include/pcg.hpp
arotem3/SchrodingerSEM
b1d5c5a959efe46cb8d473f284d150c3c7f0beb6
[ "Apache-2.0" ]
null
null
null
include/pcg.hpp
arotem3/SchrodingerSEM
b1d5c5a959efe46cb8d473f284d150c3c7f0beb6
[ "Apache-2.0" ]
null
null
null
#ifndef PCG_HPP #define PCG_HPP #include <iostream> #include <cmath> #include <concepts> #include "solver_base.hpp" // preconditioned, first iteration template <std::floating_point real, typename vec, std::invocable<vec, vec> Dot, std::invocable<vec> Precond> real conj_grad(vec& p, const vec& r, Dot dot, Precond precond) { p = precond(r); return dot(r, p); } // no preconditioner, first iteration template <std::floating_point real, typename vec, std::invocable<vec, vec> Dot> real conj_grad(vec& p, const vec& r, Dot dot, IdentityPreconditioner precond) { p = r; return dot(r, r); } // preconditioned, i > 0 template <std::floating_point real, typename vec, std::invocable<vec, vec> Dot, std::invocable<vec> Precond> real conj_grad(vec& p, const vec& r, Dot dot, Precond precond, real rho_prev) { vec z = precond(r); real rho = dot(r, z); real beta = rho / rho_prev; p = z + beta * p; return rho; } // no preconditioner, i > 0 template <std::floating_point real, typename vec, std::invocable<vec, vec> Dot> real conj_grad(vec& p, const vec& r, Dot dot, IdentityPreconditioner precond, real rho_prev) { real rho = dot(r, r); real beta = rho / rho_prev; p = r + beta * p; return rho; } // preconditioned conjugate gradient method. We require that vec is like a // mathematical vector, i.e. addition, substraction, and scalar multiplication // are well defined via the operators {+, +=, -, -=, *} and the results are // convertible to vec. // see: // Saad, Y. (2003). Iterative methods for sparse linear systems. Philadelphia: // SIAM. template <std::floating_point real, typename vec, std::invocable<vec> LinOp, std::invocable<vec, vec> Dot, std::invocable<vec> Precond> solver_results<real> pcg(vec& x, LinOp A, const vec& b, Dot dot, Precond precond, int max_iter, real tol) { vec r = b - A(x); real bnorm = std::sqrt(dot(b,b)); bool success = false; vec p; real rho_prev, rho; int i; for (i=0; i < max_iter; ++i) { if (i == 0) rho = conj_grad<real, vec>(p, r, std::forward<Dot>(dot), std::forward<Precond>(precond)); else rho = conj_grad<real, vec>(p, r, std::forward<Dot>(dot), std::forward<Precond>(precond), rho_prev); vec Ap = A(p); real alpha = rho / dot(p, Ap); x += alpha * p; r -= alpha * Ap; rho_prev = rho; if (std::sqrt(rho) < tol*bnorm) { success = true; break; } } solver_results<real> rslts; rslts.success = success; rslts.residual = std::sqrt(rho); rslts.n_iter = i; return rslts; } #endif
26.554455
135
0.62528
[ "vector" ]