hexsha
stringlengths
40
40
size
int64
22
2.4M
ext
stringclasses
5 values
lang
stringclasses
1 value
max_stars_repo_path
stringlengths
3
260
max_stars_repo_name
stringlengths
5
109
max_stars_repo_head_hexsha
stringlengths
40
78
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
260
max_issues_repo_name
stringlengths
5
109
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
260
max_forks_repo_name
stringlengths
5
109
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
22
2.4M
avg_line_length
float64
5
169k
max_line_length
int64
5
786k
alphanum_fraction
float64
0.06
0.95
matches
listlengths
1
11
5f559727b9a2e319089e1fd0fcabe303223317bc
1,142
h
C
PGGAssignment1SDL/creditsState.h
JSlowgrove/PGG-Assignment-1-SDL-Planet-Planeta
710cca81b0bd4f632dc8397384b09b031998eb13
[ "MIT" ]
null
null
null
PGGAssignment1SDL/creditsState.h
JSlowgrove/PGG-Assignment-1-SDL-Planet-Planeta
710cca81b0bd4f632dc8397384b09b031998eb13
[ "MIT" ]
null
null
null
PGGAssignment1SDL/creditsState.h
JSlowgrove/PGG-Assignment-1-SDL-Planet-Planeta
710cca81b0bd4f632dc8397384b09b031998eb13
[ "MIT" ]
null
null
null
#pragma once #ifndef CREDITSSTATE_H #define CREDITSSTATE_H #include "state.h" #include "stateManager.h" #include "texture.h" /** @brief Creates a CreditsState object. Creates a CreditsState object that inherits State */ class CreditsState : public State { private: /*the credit image*/ Texture * credits; public: /** Constructs a CreditsState object Constructs a CreditsState object @param StateManager * a pointer to the StateManager @param SDL_Renderer * a pointer to the renderer in use. */ CreditsState(StateManager *, SDL_Renderer *); /** De-constructs a CreditsState object De-constructs the CreditsState object */ ~CreditsState(); /** A function to handle the SDL events A function to handle the SDL events for use with the CreditsState @returns bool if false then quit CreditsState */ bool HandleSDLEvents(); /** A function to update the CreditsState A function to update the CreditsState to allow the CreditsState to run @param float the delta time */ void Update(float deltaTime); /** A function to draw to the screen A function to draw to the screen using the renderer */ void Draw(); }; #endif
21.54717
71
0.747811
[ "object" ]
5f669ac445e18588e004432023fcae0af45f4469
1,895
h
C
samples/bbcnews/app/data/network/urlrequest.h
reubenscratton/oaknut
03b37965ad84745bd5c077a27d8b53d58a173662
[ "MIT" ]
5
2019-10-04T05:10:06.000Z
2021-02-03T23:29:10.000Z
samples/bbcnews/app/data/network/urlrequest.h
reubenscratton/oaknut
03b37965ad84745bd5c077a27d8b53d58a173662
[ "MIT" ]
null
null
null
samples/bbcnews/app/data/network/urlrequest.h
reubenscratton/oaknut
03b37965ad84745bd5c077a27d8b53d58a173662
[ "MIT" ]
2
2019-09-27T00:34:36.000Z
2020-10-27T09:44:26.000Z
// // Copyright (c) 2019 BBC News. All rights reserved. // #pragma once #include <oaknut.h> #include "../../model/_module.h" //#import "BNURLRequestManager.h" #define BNURLRequestFlagForceUpdate 1 // Forcibly re-download data, i.e. don't complete with cache data and ignore TTL #define BNURLRequestFlagNoUpdateRamCache 2 // For BNOfflineManager, used to avoids filling RAM cache with prefetch content /*- (void)start; - (id)processResponseDataInBackground:(NSData*)data error:(NSError*__autoreleasing*)error; - (void)onCompleteWithObject:(id<NSCoding>)object error:(NSError*)error isCacheData:(BOOL)isCacheData; - (void)cancel; */ class BNURLRequest : public Object { public: static BNURLRequest* requestContent(const string& modelId, int flags, int priority); BNURLRequest(const string& url, int flags, int priority); void cancel(); std::function<void(BNBaseModel*)> onHandleContent; enum Priority { High, // 0 // For anything on the screen Medium, // 1 // For stuff not on the screen but reasonably likely to be scrolled into view soon Low, // 2 // For speculative prefetching Offline // 3 // For BNOfflineManager only }; protected: static string urlForModelId(const string& modelId); enum Status { Created, Queued, Running, Inactive, Dead } status; enum Priority priority, priorityForRunQueues; int flags; class BNURLCachedInfo* cacheInfo; int retryCount; sp<URLTask> _req; //@property (nonatomic) NSURLSessionDataTask *dataTask; //@property (nonatomic) NSMutableArray* delegates; //@property (nonatomic) NSHTTPURLResponse* response; int ttl; // private to urlmanager bool hasDownloadedNewData; bool _cancelled; };
26.690141
125
0.658575
[ "object", "model" ]
5f6911c2e242076fc3eb706f16f0d20224bd8cbb
648
h
C
Code/src/engine/graphics/layers/Scene.h
Thraix/MasterThesis
4e4cb94b2a4ee261b2b9974aa4b20f6643eb6595
[ "MIT" ]
1
2021-04-16T10:54:38.000Z
2021-04-16T10:54:38.000Z
Code/src/engine/graphics/layers/Scene.h
Thraix/MasterThesis
4e4cb94b2a4ee261b2b9974aa4b20f6643eb6595
[ "MIT" ]
null
null
null
Code/src/engine/graphics/layers/Scene.h
Thraix/MasterThesis
4e4cb94b2a4ee261b2b9974aa4b20f6643eb6595
[ "MIT" ]
null
null
null
#pragma once #include <event/Event.h> #include <event/ViewportEvent.h> namespace Greet { class Scene { public: virtual void PreRender() {} virtual void Render() const = 0; virtual void PostRender() {} virtual void PreUpdate(float timeElapsed) {} virtual void Update(float timeElapsed) = 0; virtual void PostUpdate(float timeElapsed) {} virtual void OnEvent(Event& event) { if(EVENT_IS_TYPE(event, EventType::VIEWPORT_RESIZE)) { ViewportResize((ViewportResizeEvent&) event); } } virtual void ViewportResize(ViewportResizeEvent& event) {} }; }
24
64
0.638889
[ "render" ]
5f6f8dd0d9dc1c78a1bde84e3736b394a0df1890
514
h
C
Code/Projects/Eld/src/eldmesh.h
xordspar0/eldritch
895639bbb7ccf72e0e8e7a4c5cf72a7915467679
[ "Zlib" ]
4
2019-09-15T20:00:23.000Z
2021-08-27T23:32:53.000Z
Code/Projects/Eld/src/eldmesh.h
xordspar0/eldritch
895639bbb7ccf72e0e8e7a4c5cf72a7915467679
[ "Zlib" ]
11
2019-01-04T19:50:48.000Z
2021-04-26T08:31:45.000Z
Code/Projects/Eld/src/eldmesh.h
xordspar0/eldritch
895639bbb7ccf72e0e8e7a4c5cf72a7915467679
[ "Zlib" ]
4
2018-02-27T07:10:51.000Z
2021-04-22T09:38:13.000Z
#ifndef ELDMESH_H #define ELDMESH_H #include "mesh.h" #include "eldirradiance.h" #include "wbentity.h" class EldMesh : public Mesh { public: EldMesh(); virtual ~EldMesh(); void SetIrradianceCube( const SVoxelIrradiance& Irradiance ); const SVoxelIrradiance& GetIrradianceCube() const; void SetEntity( WBEntity* const pEntity ) { m_Entity = pEntity; } WBEntity* GetEntity() const { return m_Entity; } private: SVoxelIrradiance m_IrradianceCube; WBEntity* m_Entity; }; #endif // ELDMESH_H
19.769231
70
0.731518
[ "mesh" ]
5f7cae00aead860643a9edc8f3a15f07d4e269d5
2,818
h
C
StaticLib/Headers/ShadowMap.h
Esentiel/dx3d
caf8423b69032518c3abeab08781190c41947b63
[ "MIT" ]
null
null
null
StaticLib/Headers/ShadowMap.h
Esentiel/dx3d
caf8423b69032518c3abeab08781190c41947b63
[ "MIT" ]
18
2019-09-18T15:21:03.000Z
2020-01-28T21:43:08.000Z
StaticLib/Headers/ShadowMap.h
Esentiel/dx3d
caf8423b69032518c3abeab08781190c41947b63
[ "MIT" ]
null
null
null
#pragma once #include <wrl.h> #include <string> #include <array> #include <DirectXMath.h> #include <vector> #include "LightSource.h" struct ID3D11ShaderResourceView; struct ID3D11DepthStencilView; struct ID3D11InputLayout; struct ID3D11Buffer; struct D3D11_VIEWPORT; struct ID3D11RasterizerState; struct D3D11_VIEWPORT; struct ID3D11RenderTargetView; struct ID3D11Texture2D; struct ID3D11UnorderedAccessView; namespace Library { struct LightSource; class Blur; class ShadowMap { public: struct SMCB { DirectX::XMFLOAT4X4 shadowMapProj[MAX_LIGHT_SOURCES][NUM_CASCADES]; DirectX::XMFLOAT4X4 shadowMapView[MAX_LIGHT_SOURCES]; float limits[2][4]; }; const float* GetLimits(int lightIdx) const; public: ShadowMap(); ~ShadowMap(); void Initialize(int width, int height); void Generate(RenderScene * scene); void SetLightSource(const LightSource * light); void CalcProjections(); ID3D11Buffer* GetConstMeshLightBuffer(unsigned int id, unsigned int id2) const; ID3D11Buffer** GetConstMeshLightBufferRef(unsigned int id, unsigned int id2); const DirectX::XMMATRIX GetViewMatrix(unsigned int id); virtual const DirectX::XMMATRIX GetProjection(unsigned int lightIdx, unsigned int cascadeIdx) const; ID3D11ShaderResourceView** GetShadowMapRef(); ID3D11Buffer* GetConstMeshBuffer() const; ID3D11Buffer** GetConstMeshBufferRef(); private: struct Cascade { DirectX::XMFLOAT3 points[8]; // p1 = right-top, p2 = left-top, p3=bottom-left, p4=bottom-right }; void CreateInputLayout(); void CreateConstLightMeshBuffer(); void CreateConstMeshBuffer(); void CreateRasterState(); std::array<std::array<Library::ShadowMap::Cascade, NUM_CASCADES>, MAX_LIGHT_SOURCES> CalcCascades(); std::string m_vertexShaderName; std::string m_pixelShaderName; std::array<LightSource, MAX_LIGHT_SOURCES> m_lightSource; Microsoft::WRL::ComPtr<ID3D11Texture2D> m_fullScreenTextureRTV; Microsoft::WRL::ComPtr<ID3D11Texture2D> m_fullScreenTextureSRV; Microsoft::WRL::ComPtr<ID3D11ShaderResourceView> m_shaderResRTV[MAX_LIGHT_SOURCES]; Microsoft::WRL::ComPtr<ID3D11DepthStencilView> m_shadowMapDSB; Microsoft::WRL::ComPtr<ID3D11RenderTargetView> m_rtv; Microsoft::WRL::ComPtr<ID3D11InputLayout> m_inputlayout; std::array<std::array<Microsoft::WRL::ComPtr<ID3D11Buffer>, NUM_CASCADES>, MAX_LIGHT_SOURCES> m_constMeshLightBuffer; Microsoft::WRL::ComPtr <ID3D11RasterizerState> m_rasterState; Microsoft::WRL::ComPtr<ID3D11Buffer> m_constMeshBuffer; std::array<DirectX::XMFLOAT4X4, MAX_LIGHT_SOURCES> m_lightView; DirectX::XMFLOAT4X4 m_projection[MAX_LIGHT_SOURCES][NUM_CASCADES]; std::unique_ptr<D3D11_VIEWPORT> m_viewport; std::unique_ptr<Blur> m_blur; float m_cascadeLimits[MAX_LIGHT_SOURCES][NUM_CASCADES]; int m_width; int m_height; }; }
31.662921
119
0.784954
[ "vector" ]
5f859df98bd1388b9e014309a7ddade0129cd0c9
3,441
h
C
message/generation/swift-mt-generation/repository/SR2018/parsers/SwiftMtParser_MT195BaseListener.h
Yanick-Salzmann/message-converter-c
6dfdf56e12f19e0f0b63ee0354fda16968f36415
[ "MIT" ]
null
null
null
message/generation/swift-mt-generation/repository/SR2018/parsers/SwiftMtParser_MT195BaseListener.h
Yanick-Salzmann/message-converter-c
6dfdf56e12f19e0f0b63ee0354fda16968f36415
[ "MIT" ]
null
null
null
message/generation/swift-mt-generation/repository/SR2018/parsers/SwiftMtParser_MT195BaseListener.h
Yanick-Salzmann/message-converter-c
6dfdf56e12f19e0f0b63ee0354fda16968f36415
[ "MIT" ]
null
null
null
#include "repository/ISwiftMtParser.h" #include "SwiftMtMessage.pb.h" #include <vector> #include <string> #include "BaseErrorListener.h" #include "SwiftMtParser_MT195Lexer.h" // Generated from C:/programming/message-converter-c/message/generation/swift-mt-generation/repository/SR2018/grammars/SwiftMtParser_MT195.g4 by ANTLR 4.7.2 #pragma once #include "antlr4-runtime.h" #include "SwiftMtParser_MT195Listener.h" namespace message::definition::swift::mt::parsers::sr2018 { /** * This class provides an empty implementation of SwiftMtParser_MT195Listener, * which can be extended to create a listener which only needs to handle a subset * of the available methods. */ class SwiftMtParser_MT195BaseListener : public SwiftMtParser_MT195Listener { public: virtual void enterMessage(SwiftMtParser_MT195Parser::MessageContext * /*ctx*/) override { } virtual void exitMessage(SwiftMtParser_MT195Parser::MessageContext * /*ctx*/) override { } virtual void enterBh(SwiftMtParser_MT195Parser::BhContext * /*ctx*/) override { } virtual void exitBh(SwiftMtParser_MT195Parser::BhContext * /*ctx*/) override { } virtual void enterBh_content(SwiftMtParser_MT195Parser::Bh_contentContext * /*ctx*/) override { } virtual void exitBh_content(SwiftMtParser_MT195Parser::Bh_contentContext * /*ctx*/) override { } virtual void enterAh(SwiftMtParser_MT195Parser::AhContext * /*ctx*/) override { } virtual void exitAh(SwiftMtParser_MT195Parser::AhContext * /*ctx*/) override { } virtual void enterAh_content(SwiftMtParser_MT195Parser::Ah_contentContext * /*ctx*/) override { } virtual void exitAh_content(SwiftMtParser_MT195Parser::Ah_contentContext * /*ctx*/) override { } virtual void enterUh(SwiftMtParser_MT195Parser::UhContext * /*ctx*/) override { } virtual void exitUh(SwiftMtParser_MT195Parser::UhContext * /*ctx*/) override { } virtual void enterTr(SwiftMtParser_MT195Parser::TrContext * /*ctx*/) override { } virtual void exitTr(SwiftMtParser_MT195Parser::TrContext * /*ctx*/) override { } virtual void enterSys_block(SwiftMtParser_MT195Parser::Sys_blockContext * /*ctx*/) override { } virtual void exitSys_block(SwiftMtParser_MT195Parser::Sys_blockContext * /*ctx*/) override { } virtual void enterSys_element(SwiftMtParser_MT195Parser::Sys_elementContext * /*ctx*/) override { } virtual void exitSys_element(SwiftMtParser_MT195Parser::Sys_elementContext * /*ctx*/) override { } virtual void enterSys_element_key(SwiftMtParser_MT195Parser::Sys_element_keyContext * /*ctx*/) override { } virtual void exitSys_element_key(SwiftMtParser_MT195Parser::Sys_element_keyContext * /*ctx*/) override { } virtual void enterSys_element_content(SwiftMtParser_MT195Parser::Sys_element_contentContext * /*ctx*/) override { } virtual void exitSys_element_content(SwiftMtParser_MT195Parser::Sys_element_contentContext * /*ctx*/) override { } virtual void enterMt(SwiftMtParser_MT195Parser::MtContext * /*ctx*/) override { } virtual void exitMt(SwiftMtParser_MT195Parser::MtContext * /*ctx*/) override { } virtual void enterEveryRule(antlr4::ParserRuleContext * /*ctx*/) override { } virtual void exitEveryRule(antlr4::ParserRuleContext * /*ctx*/) override { } virtual void visitTerminal(antlr4::tree::TerminalNode * /*node*/) override { } virtual void visitErrorNode(antlr4::tree::ErrorNode * /*node*/) override { } }; } // namespace message::definition::swift::mt::parsers::sr2018
46.5
156
0.771287
[ "vector" ]
bec7e5e2a4b2f12793214c74a1b644a4309dfc7e
2,565
h
C
main/OpenCover.Profiler/ProfilerCommunication.h
rfsouza02/opencover
4b4e9fa41ee4596417ba95464f852f3222aba2c9
[ "MIT" ]
1
2020-03-11T09:26:55.000Z
2020-03-11T09:26:55.000Z
main/OpenCover.Profiler/ProfilerCommunication.h
rfsouza02/opencover
4b4e9fa41ee4596417ba95464f852f3222aba2c9
[ "MIT" ]
null
null
null
main/OpenCover.Profiler/ProfilerCommunication.h
rfsouza02/opencover
4b4e9fa41ee4596417ba95464f852f3222aba2c9
[ "MIT" ]
null
null
null
// // OpenCover - S Wilde // // This source code is released under the MIT License; see the accompanying license file. // #pragma once #include "Synchronization.h" #include "SharedMemory.h" #include "Messages.h" #include <ppl.h> #include <concurrent_queue.h> /// <summary>Handles communication back to the profiler host</summary> /// <remarks>Currently this is handled by using the WebServices API</remarks> class ProfilerCommunication { private: public: ProfilerCommunication(); ~ProfilerCommunication(void); bool Initialise(TCHAR* key, TCHAR *ns); void Stop(); public: bool TrackAssembly(WCHAR* pModulePath, WCHAR* pAssemblyName); bool GetPoints(mdToken functionToken, WCHAR* pModulePath, WCHAR* pAssemblyName, std::vector<SequencePoint> &seqPoints, std::vector<BranchPoint> &brPoints); bool TrackMethod(mdToken functionToken, WCHAR* pModulePath, WCHAR* pAssemblyName, ULONG &uniqueId); inline void AddVisitPoint(ULONG uniqueId) { if (uniqueId!=0) m_queue.push(uniqueId | IT_VisitPoint); } inline void AddTestEnterPoint(ULONG uniqueId) { if (uniqueId!=0) m_queue.push(uniqueId | IT_MethodEnter); } inline void AddTestLeavePoint(ULONG uniqueId) { if (uniqueId!=0) m_queue.push(uniqueId | IT_MethodLeave); } inline void AddTestTailcallPoint(ULONG uniqueId) { if (uniqueId!=0) m_queue.push(uniqueId | IT_MethodTailcall); } private: void SendVisitPoints(); bool GetSequencePoints(mdToken functionToken, WCHAR* pModulePath, WCHAR* pAssemblyName, std::vector<SequencePoint> &points); bool GetBranchPoints(mdToken functionToken, WCHAR* pModulePath, WCHAR* pAssemblyName, std::vector<BranchPoint> &points); private: tstring m_key; tstring m_namespace; template<class BR, class PR> void RequestInformation(BR buildRequest, PR processResults); private: CMutex m_mutexCommunication; CSharedMemory m_memoryCommunication; CEvent m_eventProfilerRequestsInformation; CEvent m_eventInformationReadyForProfiler; MSG_Union *m_pMSG; CEvent m_eventInformationReadByProfiler; private: CMutex m_mutexResults; CSharedMemory m_memoryResults; CEvent m_eventProfilerHasResults; CEvent m_eventResultsHaveBeenReceived; MSG_SendVisitPoints_Request *m_pVisitPoints; private: static DWORD WINAPI QueueProcessingThread(LPVOID lpParam); void ProcessResults(); ATL::CComAutoCriticalSection m_critResults; Concurrency::concurrent_queue<ULONG> m_queue; HANDLE m_hQueueThread; };
35.625
160
0.74269
[ "vector" ]
bed477854d330750f303b3e16ae07c3cf048a63a
17,142
h
C
source/screen_genres.h
mattiasgustavsson/i-love-music
03a3700a4098f779cd9799b86fe7f0aa834eddea
[ "Unlicense" ]
8
2021-10-17T20:56:04.000Z
2022-02-11T21:52:29.000Z
source/screen_genres.h
mattiasgustavsson/i-love-music
03a3700a4098f779cd9799b86fe7f0aa834eddea
[ "Unlicense" ]
null
null
null
source/screen_genres.h
mattiasgustavsson/i-love-music
03a3700a4098f779cd9799b86fe7f0aa834eddea
[ "Unlicense" ]
null
null
null
typedef struct screen_genres_item_t { uint32_t genre_id; char genre_string[ 256 ]; text_t* genre_text; char album_count_string[ 256 ]; text_t* album_count_text; uint32_t thumb_id; bitmap_t* bitmap; } screen_genres_item_t; typedef struct screen_genres_t { app_t* app; render_t* render; font_t* font_genre; font_t* font_albums; bitmap_t* allartists; bitmap_t* genredefault; bitmap_t* frame; int width; int height; int scroll; int highlighted; int layout_size; int layout_hmargin; int layout_hspacing; int layout_vspacing; int layout_hcount; int layout_vcount; int layout_offset; int layout_max_scroll; bool force_resize; int items_count; screen_genres_item_t* items; } screen_genres_t; bool screen_genres_init( screen_genres_t* screen, app_t* app, render_t* render, bitmap_t* genredefault, bitmap_t* allartists, bitmap_t* frame ) { memset( screen, 0, sizeof( *screen ) ); screen->app = app; screen->render = render; screen->allartists = allartists; screen->genredefault = genredefault; screen->frame = frame; if( !( screen->font_genre = font_create( screen->render, "gui/fonts/AlegreyaSans-ExtraBold.ttf", 38 ) ) ) return false; if( !( screen->font_albums = font_create( screen->render, "gui/fonts/AlegreyaSans-Medium.ttf", 24 ) ) ) return false; screen->width = (int)render->logical_width; screen->height = (int)render->logical_height; screen->scroll = 0; screen->highlighted = -1; screen->items_count = 0; screen->items = (screen_genres_item_t*) malloc( sizeof( *screen->items ) * 1 ); screen->layout_size = 250; screen->layout_hmargin = 25; screen->layout_hspacing = 25; screen->layout_vspacing = 90; screen->layout_hcount = (int)( ( screen->render->logical_width - screen->layout_hmargin * 2 ) / ( screen->layout_size + screen->layout_hspacing * 2 ) ); if( screen->layout_hcount < 1 ) screen->layout_hcount = 1; screen->layout_vcount = (int)( ( screen->render->logical_height - 100 ) / ( screen->layout_size + screen->layout_vspacing ) ); screen->layout_offset = (int)( ( screen->render->logical_width - screen->layout_hcount * ( screen->layout_size + screen->layout_hspacing * 2 ) ) / 2 ); screen->layout_max_scroll = 3 * ( screen->items_count / screen->layout_hcount - ( screen->layout_vcount - 1 ) ) - 1; if( screen->layout_max_scroll < 0 ) screen->layout_max_scroll = 0; screen_genres_item_t* all_artists = &screen->items[ screen->items_count++ ]; all_artists->genre_id = MUSICDB_INVALID_ID; strcpy( all_artists->genre_string, "All artists" ); all_artists->genre_text = text_create( screen->render, screen->font_genre, "All artists"); *all_artists->album_count_string = '\0'; all_artists->album_count_text = 0; all_artists->thumb_id = MUSICDB_INVALID_ID; all_artists->bitmap = screen->allartists; return true; } void screen_genres_term( screen_genres_t* screen ) { for( int i = 0; i < screen->items_count; ++i ) { screen_genres_item_t* item = &screen->items[ i ]; if( item->bitmap && item->bitmap != screen->allartists ) bitmap_destroy( screen->render, item->bitmap ); if( item->genre_text ) text_destroy( screen->render, item->genre_text ); if( item->album_count_text ) text_destroy( screen->render, item->album_count_text ); } font_destroy( screen->render, screen->font_albums ); font_destroy( screen->render, screen->font_genre ); free( screen->items ); } static int sort_genres( void const* ptr_a, void const* ptr_b ) { musicdb_genre_t const* a = (musicdb_genre_t const*) ptr_a; musicdb_genre_t const* b = (musicdb_genre_t const*) ptr_b; return stricmp( a->label, b->label ); } static int sort_genres_remapped( void const* ptr_a, void const* ptr_b ) { musicdb_genre_t const* a = (musicdb_genre_t const*) ptr_a; musicdb_genre_t const* b = (musicdb_genre_t const*) ptr_b; return stricmp( a->remapped_label, b->remapped_label ); } bool screen_genres_update_thumbs( screen_genres_t* screen, music_db_t* musicdb ) { bool result = false; int pic_count = 0; for( int i = 0; i < screen->items_count; ++i ) { screen_genres_item_t* item = &screen->items[ i ]; if( !item->bitmap && item->thumb_id != MUSICDB_INVALID_ID ) { int mip_width, mip_height, w, h; bitmap_t* thumb = musicdb_get_thumbnail( musicdb, item->thumb_id, &w, &h, &mip_width, &mip_height, screen->render ); if( thumb ) { item->bitmap = thumb; if( !item->bitmap ) item->thumb_id = MUSICDB_INVALID_ID; else result = true; } pic_count++; } } return result; } void screen_genres_refresh( screen_genres_t* screen, music_db_t* musicdb, bool remap_genre ) { int scroll_index = ( screen->scroll / 3 ) * screen->layout_hcount; int scroll_offset = screen->scroll % 3; char scroll_item[ 128 ] = ""; if( scroll_index > 0 && scroll_index < screen->items_count ) strcpy( scroll_item, screen->items[ scroll_index ].genre_string ); int genres_count = 0; int total_album_count = 0; musicdb_genre_t* genres = musicdb_genres_get( musicdb, &genres_count, &total_album_count ); if( remap_genre ) { for( int i = 1; i < genres_count; ++i ) { for( int j = 0; j < i; ++j ) { if( stricmp( genres[ i ].remapped_label, genres[ j ].remapped_label ) == 0 ) { genres[ j ].album_count += genres[ i ].album_count; genres[ i ] = genres[ --genres_count ]; --i; break; } } } } if( remap_genre ) qsort( (void*)genres, genres_count, sizeof( *genres), sort_genres_remapped ); else qsort( (void*)genres, genres_count, sizeof( *genres), sort_genres ); screen_genres_item_t* new_items = (screen_genres_item_t*) malloc( sizeof( *new_items ) * ( genres_count + 1 ) ); int new_items_count = 0; char str[ 256 ]; new_items[ new_items_count++ ] = screen->items[ 0 ]; memset( &screen->items[ 0 ], 0, sizeof( screen_genres_item_t ) ); screen->items[ 0 ].genre_id = MUSICDB_INVALID_ID; screen_genres_item_t* all_artists = &new_items[ 0 ]; sprintf( str, "%d albums", total_album_count ); if( strcmp( str, all_artists->album_count_string ) != 0 ) { if( all_artists->album_count_text ) text_destroy( screen->render, all_artists->album_count_text ); all_artists->album_count_text = text_create( screen->render, screen->font_albums, str ); strcpy( all_artists->album_count_string, str ); } for( int i = 0; i < genres_count; ++i ) { musicdb_genre_t* genre = &genres[ i ]; char const* label = remap_genre ? genre->remapped_label: genre->label; if( strlen( label ) > 200 ) continue; bool found = false; for( int j = 0; j < screen->items_count; ++j ) { if( strcmp( screen->items[ j ].genre_string, label ) == 0 ) { screen_genres_item_t* item = &new_items[ new_items_count++ ]; *item = screen->items[ j ]; memset( &screen->items[ j ], 0, sizeof( screen_genres_item_t ) ); screen->items[ j ].genre_id = MUSICDB_INVALID_ID; sprintf( str, "%d albums", genre->album_count ); if( strcmp( item->album_count_string, str ) != 0 ) { if( item->album_count_text ) text_destroy( screen->render, item->album_count_text ); item->album_count_text = 0; strcpy( item->album_count_string, str ); } found = true; break; } } if( !found ) { screen_genres_item_t* item = &new_items[ new_items_count++ ]; item->genre_id = genre->id; strcpy( item->genre_string, label ); item->genre_text = 0; sprintf( str, "%d albums", genre->album_count ); strcpy( item->album_count_string, str ); item->album_count_text = 0; item->thumb_id = remap_genre ? genre->remapped_thumb_id : genre->thumbnail_id; item->bitmap = 0; } } for( int i = 0; i < screen->items_count; ++i ) { screen_genres_item_t* item = &screen->items[ i ]; if( item->bitmap && item->bitmap != screen->allartists ) bitmap_destroy( screen->render, item->bitmap ); if( item->genre_text ) text_destroy( screen->render, item->genre_text ); if( item->album_count_text ) text_destroy( screen->render, item->album_count_text ); } free( screen->items ); screen->items = new_items; screen->items_count = new_items_count; screen->layout_max_scroll = 3 * ( screen->items_count / screen->layout_hcount - ( screen->layout_vcount - 1 ) ) - 1; if( screen->layout_max_scroll < 0 ) screen->layout_max_scroll = 0; scroll_index = 0; if( *scroll_item ) { for( int i = 0; i < screen->items_count; ++i ) { screen_genres_item_t* item = &screen->items[ i ]; if( stricmp( item->genre_string, scroll_item ) == 0 ) scroll_index = i; } } screen->scroll = scroll_offset + 3 * ( scroll_index / screen->layout_hcount ); musicdb_genres_release( musicdb, genres ); screen->force_resize = true; screen_genres_update_thumbs( screen, musicdb ); } typedef struct screen_genres_navigation_t { screen_t screen; uint32_t selected_genre_id; uint32_t genre_thumb_id; } screen_genres_navigation_t; bool screen_genres_update( screen_genres_t* screen, screen_genres_navigation_t* navigation, bool resize, input_t const* input ) { bool redraw = false; navigation->screen = SCREEN_GENRES; navigation->selected_genre_id = MUSICDB_INVALID_ID; navigation->genre_thumb_id = MUSICDB_INVALID_ID; if( resize || screen->force_resize || screen->width != (int)screen->render->logical_width || screen->height != (int)screen->render->logical_height ) { screen->force_resize = false; screen->width = (int)screen->render->logical_width; screen->height = (int)screen->render->logical_height; screen->highlighted = -1; int scroll_item = ( screen->scroll / 3 ) * screen->layout_hcount; int scroll_offset = screen->scroll % 3; screen->layout_hcount = (int)( ( screen->render->logical_width - screen->layout_hmargin * 2 ) / ( screen->layout_size + screen->layout_hspacing * 2 ) ); if( screen->layout_hcount < 1 ) screen->layout_hcount = 1; screen->layout_vcount = (int)( ( screen->render->logical_height - 100 ) / ( screen->layout_size + screen->layout_vspacing ) ); screen->layout_offset = (int)( ( screen->render->logical_width - screen->layout_hcount * ( screen->layout_size + screen->layout_hspacing * 2 ) ) / 2 ); int row_count = ( screen->items_count + ( screen->layout_hcount - 1 ) ) / screen->layout_hcount; int scroll_end = row_count * ( screen->layout_size + screen->layout_vspacing ); int screen_steps = ( (int)screen->render->logical_height - 100 ) / ( ( screen->layout_size + screen->layout_vspacing ) / 3 ); int scroll_steps = ( 3 * scroll_end ) / ( screen->layout_size + screen->layout_vspacing ); screen->layout_max_scroll = scroll_steps - screen_steps; if( screen->layout_max_scroll < 0 ) screen->layout_max_scroll = 0; screen->scroll = scroll_offset + 3 * ( scroll_item / screen->layout_hcount ); if( screen->scroll > screen->layout_max_scroll ) screen->scroll = screen->layout_max_scroll; for( int i = 0; i < screen->items_count; ++i ) { screen_genres_item_t* item = &screen->items[ i ]; if( item->genre_text ) text_destroy( screen->render, item->genre_text ); item->genre_text = 0; if( item->album_count_text ) text_destroy( screen->render, item->album_count_text ); item->album_count_text = 0; } redraw = true; } if( input->scroll || input->pgup || input->pgdown || input->up || input->down || input->home || input->end ) { screen->scroll += input->scroll; if( input->up ) screen->scroll--; if( input->down ) screen->scroll++; if( input->pgup ) screen->scroll -= ( screen->layout_vcount ) * 3 - 1; if( input->pgdown ) screen->scroll += ( screen->layout_vcount ) * 3 - 1; if( input->home ) screen->scroll = 0; if( input->end ) screen->scroll = screen->layout_max_scroll; if( screen->scroll < 0 ) screen->scroll = 0; if( screen->scroll >= screen->layout_max_scroll ) screen->scroll = screen->layout_max_scroll; redraw = true; } int highlighted = -1; int x = 0; int y = -screen->scroll * ( ( screen->layout_size + screen->layout_vspacing ) / 3 ); for( int i = 0; i < screen->items_count; ++i ) { screen_genres_item_t* item = &screen->items[ i ]; if( input->mouse_x >= screen->layout_hspacing + x + screen->layout_offset - 8 && input->mouse_x < screen->layout_hspacing + x + screen->layout_offset + screen->layout_size + 8 && input->mouse_y > 60 && input->mouse_y >= y + 100 - 8 && input->mouse_y < y + 100 + screen->layout_size + 60 + 8 ) { highlighted = i; if( input->click ) { if( input->click_start_x >= screen->layout_hspacing + x + screen->layout_offset - 8 && input->click_start_x < screen->layout_hspacing + x + screen->layout_offset + screen->layout_size + 8 && input->click_start_y > 60 && input->click_start_y >= y + 100 - 8 && input->click_start_y < y + 100 + screen->layout_size + 60 + 8 ) { navigation->screen = SCREEN_ARTISTS; navigation->selected_genre_id = item->genre_id; navigation->genre_thumb_id = item->thumb_id; } } break; } x += screen->layout_size + screen->layout_hspacing * 2; if( x >= screen->layout_hcount * ( screen->layout_size + screen->layout_hspacing * 2 ) ) { x = 0; y += screen->layout_size + screen->layout_vspacing; } } if( highlighted != screen->highlighted ) { screen->highlighted = highlighted; redraw = true; } return redraw; } bool screen_genres_draw( screen_genres_t* screen ) { render_scissor( screen->render, 0, 80, (int)screen->render->logical_width, (int)screen->render->logical_height ); int x = 0; int y = -screen->scroll * ( ( screen->layout_size + screen->layout_vspacing ) / 3 ); for( int i = 0; i < screen->items_count; ++i ) { screen_genres_item_t* item = &screen->items[ i ]; if( !item->genre_text ) item->genre_text = text_create( screen->render, screen->font_genre, item->genre_string ); if( !item->album_count_text ) item->album_count_text = text_create( screen->render, screen->font_albums, item->album_count_string ); bitmap_draw( screen->render, item->bitmap ? item->bitmap : screen->genredefault, 25 + x + screen->layout_offset, y + 100, screen->layout_size, screen->layout_size, 0xffffffff ); uint32_t col = 0xffffffff; if( screen->highlighted == i ) { col = 0xffd98b1a; bitmap_draw( screen->render, screen->frame, screen->layout_hspacing + x + screen->layout_offset - 8, y + 100 - 8, 266, 266, col ); } text_draw( screen->render, item->genre_text, screen->layout_hspacing + x + ( screen->layout_size - item->genre_text->width ) / 2 + screen->layout_offset, y + 100 + screen->layout_size + 36, col ); text_draw( screen->render, item->album_count_text, screen->layout_hspacing + x + ( screen->layout_size - item->album_count_text->width ) / 2 + screen->layout_offset, y + 100 + screen->layout_size + 60, 0xff736d64 ); x += screen->layout_size + screen->layout_hspacing * 2; if( x >= screen->layout_hcount * ( screen->layout_size + screen->layout_hspacing * 2 ) ) { x = 0; y += screen->layout_size + screen->layout_vspacing; } } render_scissor_off( screen->render ); return false; }
41.107914
223
0.59783
[ "render" ]
bedde3e2516d687389abd72787406163f7f17c0f
31,137
c
C
Benchmarks/FIRESTARTER/main.c
csrhau/Iconoclast
a77cf2604ea7687415e12ccae6ee79f57f7c4a57
[ "Apache-2.0" ]
1
2022-01-18T05:55:43.000Z
2022-01-18T05:55:43.000Z
Benchmarks/FIRESTARTER/main.c
csrhau/Iconoclast
a77cf2604ea7687415e12ccae6ee79f57f7c4a57
[ "Apache-2.0" ]
null
null
null
Benchmarks/FIRESTARTER/main.c
csrhau/Iconoclast
a77cf2604ea7687415e12ccae6ee79f57f7c4a57
[ "Apache-2.0" ]
null
null
null
/****************************************************************************** * FIRESTARTER - A Processor Stress Test Utility * Copyright (C) 2014 TU Dresden, Center for Information Services and High * Performance Computing * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * * Contact: daniel.hackenberg@tu-dresden.de *****************************************************************************/ /* current version */ #define VERSION_MAJOR 1 #define VERSION_MINOR 2 #define COPYRIGHT_YEAR 2014 #define _GNU_SOURCE #if (defined(linux) || defined(__linux__)) && defined (AFFINITY) #include <sched.h> #endif #include <signal.h> #include <getopt.h> #include <unistd.h> #include <pthread.h> #include <errno.h> #include <limits.h> #include <sys/time.h> /* Mac OS compatibility */ #ifdef __MACH__ #include <mach/mach_time.h> #define CLOCK_REALTIME 0 #endif /* * Header for local functions */ #include "work.h" #include "cpu.h" mydata_t *mdp; /* global data structure */ cpu_info_t *cpuinfo = NULL; /* data structure for hardware detection */ unsigned long long HIGH=1; /* shared variable that specifies load level */ int ALIGNMENT = 64; /* alignment of buffers and data structures */ unsigned int verbose = 1; /* enable/disable output to stdout */ /* * FIRESTARTER configuration, determined by evaluate_environment function */ unsigned long long BUFFERSIZEMEM,RAMBUFFERSIZE; unsigned int BUFFERSIZE[3]; unsigned int NUM_THREADS = 0; int FUNCTION = FUNC_NOT_DEFINED; /* * timeout and load characteristics as defind by -t, -p, and -l */ long TIMEOUT = 0, PERIOD = 100, LOAD = 100; /* * pointer for CPU bind argument (-b | --bind) */ char* bind=NULL; /* Mac OS compatibility */ #ifdef __MACH__ mach_timebase_info_data_t info; double ns_per_tick; #endif /* * worker threads */ pthread_t *threads; /* * CPU bindings of threads */ #if (defined(linux) || defined(__linux__)) && defined (AFFINITY) cpu_set_t cpuset; #endif unsigned long long *cpu_bind; /* * watchdog timer */ typedef struct watchdog_args { unsigned long long *high; pid_t pid; useconds_t period; useconds_t load; unsigned int timeout; } watchdog_arg_t; watchdog_arg_t watchdog_arg; /* exit with zero returncode on sigterm */ static void sigterm_handler() { exit(EXIT_SUCCESS); } /* Mac OS compatibility - clock_gettime is not implemented on OSX */ #ifdef __MACH__ static int clock_gettime(int id, struct timespec* t) { uint64_t ts,sec,nsec; ts = (uint64_t) ((double)mach_absolute_time() * ns_per_tick); sec = ts/1000000000; nsec = ts - sec*1000000000; t->tv_sec = (time_t) sec; t->tv_nsec = (long) nsec; return id; } #endif /* * coordinates high load and low load phases * stops FIRESTARTER when timeout is reached */ static void *watchdog_timer(void *arg) { sigset_t signal_mask; register long long timeout, time, period, load, idle, advance,load_reduction,idle_reduction; register unsigned long long *high; struct timespec start_ts,current; /* Mac OS compatibility */ #ifdef __MACH__ mach_timebase_info(&info); ns_per_tick = (double)info.numer / (double)info.denom; #endif sigemptyset(&signal_mask); sigaddset(&signal_mask, SIGINT); sigaddset(&signal_mask, SIGTERM); pthread_sigmask(SIG_BLOCK, &signal_mask, NULL); period=((watchdog_arg_t *) arg)->period; load=((watchdog_arg_t *) arg)->load; idle=period-load; timeout=((watchdog_arg_t *) arg)->timeout; high=((watchdog_arg_t *) arg)->high; clock_gettime(CLOCK_REALTIME,&start_ts); time=0; while (period > 0) { clock_gettime(CLOCK_REALTIME,&current); advance=((current.tv_sec-start_ts.tv_sec)*1000000 + (current.tv_nsec-start_ts.tv_nsec)/1000) % period; load_reduction=(load * advance) / period; idle_reduction=advance-load_reduction; usleep(load - load_reduction); *high = 0; // interupt high load routine usleep(idle - idle_reduction); *high = 1; // interupt low load routine time+=period; if ((timeout > 0) && (time/1000000 >= timeout)){ kill(((watchdog_arg_t *) arg)->pid, SIGTERM); pthread_exit(0); } } if (timeout > 0) { sleep(timeout); kill(((watchdog_arg_t *) arg)->pid, SIGTERM); } // do not terminate the main thread // only in case the watchdog is not running sleep(UINT_MAX); return(0); } /* * initialize data structures */ static void *init() { unsigned int i,t; #if (defined(linux) || defined(__linux__)) && defined (AFFINITY) cpu_set(cpu_bind[0]); #endif mdp->cpuinfo = cpuinfo; BUFFERSIZEMEM = sizeof(char) * (2 * BUFFERSIZE[0] + BUFFERSIZE[1] + BUFFERSIZE[2] + RAMBUFFERSIZE + ALIGNMENT + 2 * sizeof(unsigned long long)); if (BUFFERSIZEMEM <= 0) { fprintf(stderr, "Error: Determine BUFFERSIZEMEM failed\n"); fflush(stderr); exit(127); } if ((NUM_THREADS > mdp->cpuinfo->num_cpus) || (NUM_THREADS == 0)) NUM_THREADS = mdp->cpuinfo->num_cpus; threads = _mm_malloc(NUM_THREADS * sizeof(pthread_t), ALIGNMENT); mdp->thread_comm = _mm_malloc(NUM_THREADS * sizeof(int), ALIGNMENT); mdp->threaddata = _mm_malloc(NUM_THREADS * sizeof(threaddata_t), ALIGNMENT); mdp->num_threads = NUM_THREADS; if ((threads == NULL) || (mdp->thread_comm == NULL) || (mdp->threaddata == NULL)) { fprintf(stderr,"Error: Allocation of structure mydata_t failed\n"); fflush(stderr); exit(127); } // create worker threads for (t = 0; t < NUM_THREADS; t++) { mdp->ack = 0; mdp->threaddata[t].thread_id = t; mdp->threaddata[t].cpu_id = cpu_bind[t]; mdp->threaddata[t].data = mdp; mdp->threaddata[t].buffersizeMem = BUFFERSIZEMEM; mdp->threaddata[t].alignment = ALIGNMENT; mdp->threaddata[t].FUNCTION = FUNCTION; mdp->threaddata[t].period = PERIOD; mdp->thread_comm[t] = THREAD_INIT; i=pthread_create(&(threads[t]), NULL, thread,(void *) (&(mdp->threaddata[t]))); while (!mdp->ack); if (mdp->ack == THREAD_INIT_FAILURE) { fprintf(stderr,"Error: Initialization of threads failed\n"); fflush(stderr); exit(127); } } mdp->ack = 0; #if (defined(linux) || defined(__linux__)) && defined (AFFINITY) cpu_set(cpu_bind[0]); #endif /* wait for threads to complete their initialization */ for (t = 0; t < NUM_THREADS; t++) { mdp->ack = 0; mdp->thread_comm[t] = THREAD_WAIT; while (!mdp->ack); } mdp->ack = 0; if (verbose){ if ((num_packages() != -1) && (num_cores_per_package() != -1) && (num_threads_per_core() != -1)) printf (" num_packages: %i, %i cores per package, %i threads per core\n", num_packages(), num_cores_per_package(),num_threads_per_core()); printf(" using %i threads\n", NUM_THREADS); #if (defined(linux) || defined(__linux__)) && defined (AFFINITY) for (i = 0; i < NUM_THREADS; i++) if ((get_pkg(cpu_bind[i]) != -1) && (get_core_id(cpu_bind[i]) != -1)) printf(" - Thread %i runs on CPU %llu, core %i in package: %i\n", i, cpu_bind[i], get_core_id(cpu_bind[i]),get_pkg(cpu_bind[i])); #endif printf("\n");fflush(stdout); } return (void *) mdp; } /* * detect hardware configuration and setup FIRESTARTER accordingly */ static void evaluate_environment() { unsigned int i; #if (defined(linux) || defined(__linux__)) && defined (AFFINITY) unsigned int j = 0; #endif char arch[16]; cpuinfo = (cpu_info_t *) _mm_malloc(sizeof(cpu_info_t), 64); init_cpuinfo(cpuinfo, verbose); if (bind==NULL){ //use all CPUs if not defined otherwise #if (defined(linux) || defined(__linux__)) && defined (AFFINITY) CPU_ZERO(&cpuset); for (i = 0; i < cpuinfo->num_cpus; i++) { if (cpu_allowed(i)) { CPU_SET(i, &cpuset); NUM_THREADS++; } } #else NUM_THREADS = cpuinfo->num_cpus; #endif } #if (defined(linux) || defined(__linux__)) && defined (AFFINITY) else { // parse CPULIST for binding char *p,*q,*r,*s,*t; int p_val,r_val,s_val,error=0; errno=0; p=strdup(bind); while(p!=NULL){ q=strstr(p,",");if (q) {*q='\0';q++;} s=strstr(p,"/");if (s) {*s='\0';s++;s_val=(int)strtol(s,&t,10);if ((errno) || ((strcmp(t,"\0") && (t[0] !=','))) ) error++;} r=strstr(p,"-");if (r) {*r='\0';r++;r_val=(int)strtol(r,&t,10);if ((errno) || ((strcmp(t,"\0") && (t[0] !=',') && (t[0] !='/'))) ) error++;} p_val=(int)strtol(p,&t,10); if ((errno) || (p_val < 0) || (strcmp(t,"\0"))) error++; if(error){ fprintf(stderr, "Error: invalid symbols in CPU list: %s\n",bind); fflush(stderr); exit(127); } if ((s) && (s_val<=0)) { fprintf(stderr, "Error: s has to be >= 0 in x-y/s expressions of CPU list: %s\n",bind); fflush(stderr); exit(127); } if ((r) && (r_val < p_val)) { fprintf(stderr, "Error: y has to be >= x in x-y expressions of CPU list: %s\n",bind); fflush(stderr); exit(127); } if ((s)&&(r)) for (i=p_val;(int)i<=r_val;i+=s_val) {if (cpu_allowed(i)) {CPU_SET(i,&cpuset);NUM_THREADS++;}} else if (r) for (i=p_val;(int)i<=r_val;i++) {if (cpu_allowed(i)) {CPU_SET(i,&cpuset);NUM_THREADS++;}} else if (cpu_allowed(p_val)) {CPU_SET(p_val,&cpuset);NUM_THREADS++;} p=q; } free(p); } #endif cpu_bind = (unsigned long long *) calloc((NUM_THREADS + 1), sizeof(unsigned long long)); if (NUM_THREADS == 0) { fprintf(stderr, "Error: found no useable CPUs!\n"); fflush(stderr); exit(127); } #if (defined(linux) || defined(__linux__)) && defined (AFFINITY) else { for (i = 0; i < cpuinfo->num_cpus; i++) { if (CPU_ISSET(i, &cpuset)) { cpu_bind[j] = i; j++; } } } #endif mdp = (mydata_t *) _mm_malloc(sizeof(mydata_t), ALIGNMENT); if (mdp == 0) { fprintf(stderr,"Error: Allocation of structure mydata_t failed (1)\n"); fflush(stderr); exit(127); } memset(mdp, 0, sizeof(mydata_t)); get_architecture(arch, sizeof(arch)); if (strcmp(arch, "x86_64")) { fprintf(stderr,"Error: wrong architecture: %s, x86_64 required \n", arch); exit(1); } if (!feature_available("SSE2")) { fprintf(stderr, "Error: SSE2 not supported!\n"); exit(1); } if ((strcmp("GenuineIntel", cpuinfo->vendor) == 0) || (strcmp("AuthenticAMD", cpuinfo->vendor) == 0)) { switch (cpuinfo->family) { case 6: switch (cpuinfo->model) { case 60: if (feature_available("FMA")) { if (num_threads_per_core() == 1) FUNCTION = FUNC_HSW_COREI_FMA_1T; if (num_threads_per_core() == 2) FUNCTION = FUNC_HSW_COREI_FMA_2T; if (FUNCTION == FUNC_NOT_DEFINED) { fprintf(stderr, "Error: no code path for %i threads per core!\n",num_threads_per_core()); exit(1); } } if (FUNCTION == FUNC_NOT_DEFINED) { fprintf(stderr, "Error: required instruction set not supported! Supported instruction set(s) for this processor: FMA \n"); exit(1); } break; case 63: if (feature_available("FMA")) { if (num_threads_per_core() == 1) FUNCTION = FUNC_HSW_XEONEP_FMA_1T; if (num_threads_per_core() == 2) FUNCTION = FUNC_HSW_XEONEP_FMA_2T; if (FUNCTION == FUNC_NOT_DEFINED) { fprintf(stderr, "Error: no code path for %i threads per core!\n",num_threads_per_core()); exit(1); } } if (FUNCTION == FUNC_NOT_DEFINED) { fprintf(stderr, "Error: required instruction set not supported! Supported instruction set(s) for this processor: FMA \n"); exit(1); } break; case 42: case 58: if (feature_available("AVX")) { if (num_threads_per_core() == 1) FUNCTION = FUNC_SNB_COREI_AVX_1T; if (num_threads_per_core() == 2) FUNCTION = FUNC_SNB_COREI_AVX_2T; if (FUNCTION == FUNC_NOT_DEFINED) { fprintf(stderr, "Error: no code path for %i threads per core!\n",num_threads_per_core()); exit(1); } } if (FUNCTION == FUNC_NOT_DEFINED) { fprintf(stderr, "Error: required instruction set not supported! Supported instruction set(s) for this processor: AVX \n"); exit(1); } break; case 45: case 62: if (feature_available("AVX")) { if (num_threads_per_core() == 1) FUNCTION = FUNC_SNB_XEONEP_AVX_1T; if (num_threads_per_core() == 2) FUNCTION = FUNC_SNB_XEONEP_AVX_2T; if (FUNCTION == FUNC_NOT_DEFINED) { fprintf(stderr, "Error: no code path for %i threads per core!\n",num_threads_per_core()); exit(1); } } if (FUNCTION == FUNC_NOT_DEFINED) { fprintf(stderr, "Error: required instruction set not supported! Supported instruction set(s) for this processor: AVX \n"); exit(1); } break; case 30: case 37: if (feature_available("SSE2")) { if (num_threads_per_core() == 1) FUNCTION = FUNC_NHM_COREI_SSE2_1T; if (num_threads_per_core() == 2) FUNCTION = FUNC_NHM_COREI_SSE2_2T; if (FUNCTION == FUNC_NOT_DEFINED) { fprintf(stderr, "Error: no code path for %i threads per core!\n",num_threads_per_core()); exit(1); } } if (FUNCTION == FUNC_NOT_DEFINED) { fprintf(stderr, "Error: required instruction set not supported! Supported instruction set(s) for this processor: SSE2 \n"); exit(1); } break; case 26: case 44: if (feature_available("SSE2")) { if (num_threads_per_core() == 1) FUNCTION = FUNC_NHM_XEONEP_SSE2_1T; if (num_threads_per_core() == 2) FUNCTION = FUNC_NHM_XEONEP_SSE2_2T; if (FUNCTION == FUNC_NOT_DEFINED) { fprintf(stderr, "Error: no code path for %i threads per core!\n",num_threads_per_core()); exit(1); } } if (FUNCTION == FUNC_NOT_DEFINED) { fprintf(stderr, "Error: required instruction set not supported! Supported instruction set(s) for this processor: SSE2 \n"); exit(1); } break; default: fprintf(stderr, "Error: processor model (family %i, model %i) is not supported by this version of FIRESTARTER! Check project website for updates.\n",cpuinfo->family,cpuinfo->model); exit(1); break; } break; case 21: switch (cpuinfo->model) { case 1: case 2: case 3: if (feature_available("FMA4")) { if (num_threads_per_core() == 1) FUNCTION = FUNC_BLD_OPTERON_FMA4_1T; if (FUNCTION == FUNC_NOT_DEFINED) { fprintf(stderr, "Error: no code path for %i threads per core!\n",num_threads_per_core()); exit(1); } } if (FUNCTION == FUNC_NOT_DEFINED) { fprintf(stderr, "Error: required instruction set not supported! Supported instruction set(s) for this processor: FMA4 \n"); exit(1); } break; default: fprintf(stderr, "Error: processor model (family %i, model %i) is not supported by this version of FIRESTARTER! Check project website for updates.\n",cpuinfo->family,cpuinfo->model); exit(1); break; } break; default: fprintf(stderr, "Error: family %i processors are not supported by this version of FIRESTARTER! Check project website for updates.\n",cpuinfo->family); exit(1); break; } } else { fprintf(stderr, "Error: %s processors not supported by this version of FIRESTARTER!\n",cpuinfo->vendor); exit(1); } switch (FUNCTION) { case FUNC_HSW_COREI_FMA_1T: if (verbose) printf("\n Taking FMA Path optimized for Haswell - 1 thread(s) per core"); BUFFERSIZE[0] = 32768; BUFFERSIZE[1] = 262144; BUFFERSIZE[2] = 1572864; RAMBUFFERSIZE = 104857600; if (verbose){ printf("\n Used buffersizes per thread:\n"); for (i = 0; i < cpuinfo->Cachelevels; i++) printf(" - L%d-Cache: %d Bytes\n", i + 1, BUFFERSIZE[i]); printf(" - Memory: %llu Bytes\n\n", RAMBUFFERSIZE); } break; case FUNC_HSW_COREI_FMA_2T: if (verbose) printf("\n Taking FMA Path optimized for Haswell - 2 thread(s) per core"); BUFFERSIZE[0] = 16384; BUFFERSIZE[1] = 131072; BUFFERSIZE[2] = 786432; RAMBUFFERSIZE = 52428800; if (verbose){ printf("\n Used buffersizes per thread:\n"); for (i = 0; i < cpuinfo->Cachelevels; i++) printf(" - L%d-Cache: %d Bytes\n", i + 1, BUFFERSIZE[i]); printf(" - Memory: %llu Bytes\n\n", RAMBUFFERSIZE); } break; case FUNC_HSW_XEONEP_FMA_1T: if (verbose) printf("\n Taking FMA Path optimized for Haswell-EP - 1 thread(s) per core"); BUFFERSIZE[0] = 32768; BUFFERSIZE[1] = 262144; BUFFERSIZE[2] = 2621440; RAMBUFFERSIZE = 104857600; if (verbose){ printf("\n Used buffersizes per thread:\n"); for (i = 0; i < cpuinfo->Cachelevels; i++) printf(" - L%d-Cache: %d Bytes\n", i + 1, BUFFERSIZE[i]); printf(" - Memory: %llu Bytes\n\n", RAMBUFFERSIZE); } break; case FUNC_HSW_XEONEP_FMA_2T: if (verbose) printf("\n Taking FMA Path optimized for Haswell-EP - 2 thread(s) per core"); BUFFERSIZE[0] = 16384; BUFFERSIZE[1] = 131072; BUFFERSIZE[2] = 1310720; RAMBUFFERSIZE = 52428800; if (verbose){ printf("\n Used buffersizes per thread:\n"); for (i = 0; i < cpuinfo->Cachelevels; i++) printf(" - L%d-Cache: %d Bytes\n", i + 1, BUFFERSIZE[i]); printf(" - Memory: %llu Bytes\n\n", RAMBUFFERSIZE); } break; case FUNC_SNB_COREI_AVX_1T: if (verbose) printf("\n Taking AVX Path optimized for Sandy Bridge - 1 thread(s) per core"); BUFFERSIZE[0] = 32768; BUFFERSIZE[1] = 262144; BUFFERSIZE[2] = 1572864; RAMBUFFERSIZE = 104857600; if (verbose){ printf("\n Used buffersizes per thread:\n"); for (i = 0; i < cpuinfo->Cachelevels; i++) printf(" - L%d-Cache: %d Bytes\n", i + 1, BUFFERSIZE[i]); printf(" - Memory: %llu Bytes\n\n", RAMBUFFERSIZE); } break; case FUNC_SNB_COREI_AVX_2T: if (verbose) printf("\n Taking AVX Path optimized for Sandy Bridge - 2 thread(s) per core"); BUFFERSIZE[0] = 16384; BUFFERSIZE[1] = 131072; BUFFERSIZE[2] = 786432; RAMBUFFERSIZE = 52428800; if (verbose){ printf("\n Used buffersizes per thread:\n"); for (i = 0; i < cpuinfo->Cachelevels; i++) printf(" - L%d-Cache: %d Bytes\n", i + 1, BUFFERSIZE[i]); printf(" - Memory: %llu Bytes\n\n", RAMBUFFERSIZE); } break; case FUNC_SNB_XEONEP_AVX_1T: if (verbose) printf("\n Taking AVX Path optimized for Sandy Bridge-EP - 1 thread(s) per core"); BUFFERSIZE[0] = 32768; BUFFERSIZE[1] = 262144; BUFFERSIZE[2] = 2621440; RAMBUFFERSIZE = 104857600; if (verbose){ printf("\n Used buffersizes per thread:\n"); for (i = 0; i < cpuinfo->Cachelevels; i++) printf(" - L%d-Cache: %d Bytes\n", i + 1, BUFFERSIZE[i]); printf(" - Memory: %llu Bytes\n\n", RAMBUFFERSIZE); } break; case FUNC_SNB_XEONEP_AVX_2T: if (verbose) printf("\n Taking AVX Path optimized for Sandy Bridge-EP - 2 thread(s) per core"); BUFFERSIZE[0] = 16384; BUFFERSIZE[1] = 131072; BUFFERSIZE[2] = 1310720; RAMBUFFERSIZE = 52428800; if (verbose){ printf("\n Used buffersizes per thread:\n"); for (i = 0; i < cpuinfo->Cachelevels; i++) printf(" - L%d-Cache: %d Bytes\n", i + 1, BUFFERSIZE[i]); printf(" - Memory: %llu Bytes\n\n", RAMBUFFERSIZE); } break; case FUNC_NHM_COREI_SSE2_1T: if (verbose) printf("\n Taking SSE2 Path optimized for Nehalem - 1 thread(s) per core"); BUFFERSIZE[0] = 32768; BUFFERSIZE[1] = 262144; BUFFERSIZE[2] = 1572864; RAMBUFFERSIZE = 104857600; if (verbose){ printf("\n Used buffersizes per thread:\n"); for (i = 0; i < cpuinfo->Cachelevels; i++) printf(" - L%d-Cache: %d Bytes\n", i + 1, BUFFERSIZE[i]); printf(" - Memory: %llu Bytes\n\n", RAMBUFFERSIZE); } break; case FUNC_NHM_COREI_SSE2_2T: if (verbose) printf("\n Taking SSE2 Path optimized for Nehalem - 2 thread(s) per core"); BUFFERSIZE[0] = 16384; BUFFERSIZE[1] = 131072; BUFFERSIZE[2] = 786432; RAMBUFFERSIZE = 52428800; if (verbose){ printf("\n Used buffersizes per thread:\n"); for (i = 0; i < cpuinfo->Cachelevels; i++) printf(" - L%d-Cache: %d Bytes\n", i + 1, BUFFERSIZE[i]); printf(" - Memory: %llu Bytes\n\n", RAMBUFFERSIZE); } break; case FUNC_NHM_XEONEP_SSE2_1T: if (verbose) printf("\n Taking SSE2 Path optimized for Nehalem-EP - 1 thread(s) per core"); BUFFERSIZE[0] = 32768; BUFFERSIZE[1] = 262144; BUFFERSIZE[2] = 2097152; RAMBUFFERSIZE = 104857600; if (verbose){ printf("\n Used buffersizes per thread:\n"); for (i = 0; i < cpuinfo->Cachelevels; i++) printf(" - L%d-Cache: %d Bytes\n", i + 1, BUFFERSIZE[i]); printf(" - Memory: %llu Bytes\n\n", RAMBUFFERSIZE); } break; case FUNC_NHM_XEONEP_SSE2_2T: if (verbose) printf("\n Taking SSE2 Path optimized for Nehalem-EP - 2 thread(s) per core"); BUFFERSIZE[0] = 16384; BUFFERSIZE[1] = 131072; BUFFERSIZE[2] = 1048576; RAMBUFFERSIZE = 52428800; if (verbose){ printf("\n Used buffersizes per thread:\n"); for (i = 0; i < cpuinfo->Cachelevels; i++) printf(" - L%d-Cache: %d Bytes\n", i + 1, BUFFERSIZE[i]); printf(" - Memory: %llu Bytes\n\n", RAMBUFFERSIZE); } break; case FUNC_BLD_OPTERON_FMA4_1T: if (verbose) printf("\n Taking FMA4 Path optimized for Bulldozer - 1 thread(s) per core"); BUFFERSIZE[0] = 16384; BUFFERSIZE[1] = 1048576; BUFFERSIZE[2] = 786432; RAMBUFFERSIZE = 104857600; if (verbose){ printf("\n Used buffersizes per thread:\n"); for (i = 0; i < cpuinfo->Cachelevels; i++) printf(" - L%d-Cache: %d Bytes\n", i + 1, BUFFERSIZE[i]); printf(" - Memory: %llu Bytes\n\n", RAMBUFFERSIZE); } break; case FUNC_NOT_DEFINED: fprintf(stderr, "Error: required instruction set not supported!\n"); exit(1); default: fprintf(stderr, "Error: CPU not supported!\n"); exit(1); } } static void show_help(void) { printf("FIRESTARTER - A Processor Stress Test Utility, Version %i.%i\n",VERSION_MAJOR, VERSION_MINOR); printf("Copyright (C) %i TU Dresden, Center for Information Services and High Performance Computing\n",COPYRIGHT_YEAR); printf("This program comes with ABSOLUTELY NO WARRANTY; for details run `FIRESTARTER -w'.\n"); printf("This is free software, and you are welcome to redistribute it\nunder certain conditions; run `FIRESTARTER -c' for details.\n"); printf("\nUsage: FIRESTARTER [Options]\n" "\nOptions:\n\n" " -h | --help display usage information\n" " -v | --version display version information\n" " -c | --copyright display copyright information\n" " -w | --warranty display warranty information\n" " -q | --quiet disable output to stdout\n" " -t TIMEOUT | --timeout=TIMEOUT set timeout (seconds) after which FIRESTARTER\n" " terminates itself, default: no timeout\n" " -l LOAD | --load=LOAD set the percentage of high load to LOAD (%%),\n" " default 100, valid values: 0 <= LOAD <= 100,\n" " threads will be idle in the remaining time,\n" " frequency of load changes is determined by -p\n" " -p PERIOD | --period=PERIOD set the interval length to PERIOD (ms),\n" " default: 100, each interval contains a high\n" " load and an idle phase, the percentage of \n" " high load is defined by -l\n" #if (defined(linux) || defined(__linux__)) && defined (AFFINITY) " -b CPULIST | --bind=CPULIST select certain CPUs\n" " CPULIST format: \"x,y,z\", \"x-y\", \"x-y/step\",\n" " and any combination of the above\n" #endif "\nExamples:\n\n" "./FIRESTARTER - starts FIRESTARTER without timeout\n" "./FIRESTARTER -t 300 - starts a 5 minute run of FIRESTARTER\n" "./FIRESTARTER -l 50 -t 600 - starts a 10 minute run of FIRESTARTER with\n" " 50%% high load and 50%% idle time\n" "./FIRESTARTER -l 75 -p 2000 - starts FIRESTARTER with an interval length\n" " of 2 seconds, 1.5s high load and 0.5s idle\n" "\n"); } static void show_warranty(void) { printf("FIRESTARTER - A Processor Stress Test Utility, Version %i.%i\n",VERSION_MAJOR, VERSION_MINOR); printf("Copyright (C) %i TU Dresden, Center for Information Services and High Performance Computing\n",COPYRIGHT_YEAR); printf("\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU General Public License for more details.\n\n"); printf("You should have received a copy of the GNU General Public License\nalong with this program. If not, see <http://www.gnu.org/licenses/>.\n\n"); } static void show_copyright(void) { printf("FIRESTARTER - A Processor Stress Test Utility, Version %i.%i\n",VERSION_MAJOR, VERSION_MINOR); printf("Copyright (C) %i TU Dresden, Center for Information Services and High Performance Computing\n",COPYRIGHT_YEAR); printf("\nThis program is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\n"); printf("You should have received a copy of the GNU General Public License\nalong with this program. If not, see <http://www.gnu.org/licenses/>.\n\n"); } static void show_version(void) { printf("FIRESTARTER - A Processor Stress Test Utility, Version %i.%i\n",VERSION_MAJOR, VERSION_MINOR); printf("Copyright (C) %i TU Dresden, Center for Information Services and High Performance Computing\n",COPYRIGHT_YEAR); } int main(int argc, char *argv[]) { int c; static struct option long_options[] = { {"copyright", no_argument, 0, 'c'}, {"help", no_argument, 0, 'h'}, {"version", no_argument, 0, 'v'}, {"warranty", no_argument, 0, 'w'}, {"quiet", no_argument, 0, 'q'}, {"bind", required_argument, 0, 'b'}, {"timeout", required_argument, 0, 't'}, {"load", required_argument, 0, 'l'}, {"period", required_argument, 0, 'p'}, {0, 0, 0, 0 } }; while(1) { #if (defined(linux) || defined(__linux__)) && defined (AFFINITY) c = getopt_long(argc, argv, "chvwqb:t:l:p:", long_options, NULL); #else c = getopt_long(argc, argv, "chvwqt:l:p:", long_options, NULL); #endif if(c == -1) break; errno = 0; switch(c) { case 'c': show_copyright(); return EXIT_SUCCESS; case 'h': show_help(); return EXIT_SUCCESS; case 'v': show_version(); return EXIT_SUCCESS; case 'w': show_warranty(); return EXIT_SUCCESS; case 'q': verbose = 0; break; case 'b': bind=strdup(optarg); break; case 't': TIMEOUT = strtol(optarg,NULL,10); if ((errno != 0) || (TIMEOUT <= 0)){ printf("Error: timeout out of range or not a number: %s\n",optarg); return EXIT_FAILURE; } break; case 'l': LOAD = strtol(optarg,NULL,10); if ((errno != 0) || (LOAD < 0) || (LOAD > 100)){ printf("Error: load out of range or not a number: %s\n",optarg); return EXIT_FAILURE; } break; case 'p': PERIOD = strtol(optarg,NULL,10); if ((errno != 0) || (PERIOD <= 0)){ printf("Error: period out of range or not a number: %s\n",optarg); return EXIT_FAILURE; } break; case ':': // Missing argument return EXIT_FAILURE; case '?': // Unknown option return EXIT_FAILURE; } } if(optind < argc) { printf("Error: too many parameters!\n"); return EXIT_FAILURE; } PERIOD*=1000; LOAD = (PERIOD*LOAD)/100; if ((LOAD==PERIOD)||(LOAD==0)) PERIOD = 0; // disable interupts for 100% and 0% load case if (LOAD==0) HIGH=0; // disable high load routine if (verbose){ printf("FIRESTARTER - A Processor Stress Test Utility, Version %i.%i\n",VERSION_MAJOR, VERSION_MINOR); printf("Copyright (C) %i TU Dresden, Center for Information Services and High Performance Computing\n",COPYRIGHT_YEAR); printf("This program comes with ABSOLUTELY NO WARRANTY; for details run `FIRESTARTER -w'.\n"); printf("This is free software, and you are welcome to redistribute it\nunder certain conditions; run `FIRESTARTER -c' for details.\n"); } signal(SIGTERM, sigterm_handler); evaluate_environment(); init(); //start worker threads _work(mdp, &HIGH); //start watchdog watchdog_arg.pid = getpid(); watchdog_arg.timeout = (unsigned int) TIMEOUT; watchdog_arg.period = (useconds_t) PERIOD; watchdog_arg.load = (useconds_t) LOAD; watchdog_arg.high = &HIGH; watchdog_timer(&watchdog_arg); return EXIT_SUCCESS; }
35.954965
263
0.598067
[ "model" ]
bef7dee95971a146af4e6f211b5a2a7ceb0f07d7
3,158
h
C
frost/http_request.h
igorcoding/frost
10867aa6cff2abbb1c30cf5b27ef9b501836da32
[ "MIT" ]
2
2015-06-14T17:50:44.000Z
2015-06-15T16:07:36.000Z
frost/http_request.h
igorcoding/frost
10867aa6cff2abbb1c30cf5b27ef9b501836da32
[ "MIT" ]
null
null
null
frost/http_request.h
igorcoding/frost
10867aa6cff2abbb1c30cf5b27ef9b501836da32
[ "MIT" ]
null
null
null
#ifndef FROST_HTTP_REQUEST_H #define FROST_HTTP_REQUEST_H #include "router.h" #include "util/util.h" #include "http/header.h" #include "http/http_version.h" #include <ev++.h> #include <vector> #include "http/method.h" namespace frost { enum class parse_result { NEED_MORE, GOOD, BAD }; enum class parse_state { BEGIN, METHOD, PATH, PROTOCOL, PROTOCOL_H, PROTOCOL_T1, PROTOCOL_T2, PROTOCOL_P, PROTOCOL_MAJOR, PROTOCOL_MINOR, STATUS_LINE_BREAK_R, STATUS_LINE_BREAK_N, HEADER_NAME, HEADER_VALUE, HEADER_BREAK_R, HEADER_BREAK_N, PRE_BODY, BODY, BODY_WAIT }; class http_response; class http_request { friend class http_server; public: http_request(int client_fd); ~http_request(); const http_method& method() const; const http_version& version() const; const char* path() const; size_t path_len() const; const std::vector<header>& headers() const; const char* body() const; uint32_t body_size() const; bool is_keep_alive() const; static void set_max_buffer_size(uint32_t max_buffer); private: void start(); void start_keep_alive(); void stop(); parse_result parse(); void clear(); void set_http_response(http_response* resp); http_response* get_http_response(); private: ev::io _rw; ev::timer _tw; ev::timer _keep_alive_w; int _client_fd; char* _rbuf; uint32_t _ruse; char* _rbuf_ptr; static uint32_t _rlen; parse_result _parse_result; parse_state _parse_state; http_method _method; http_version _version; const char* _path; size_t _path_len; std::vector<header> _headers; char* _body_ptr; uint32_t _body_size; bool _keep_alive; http_response* __resp; static size_t _KEEP_ALIVE_COUNT; static constexpr size_t _KEEP_ALIVE_MAX = 100; // TODO: this is invalid because of fork static size_t path_max_size; size_t _work_buf_use; const char* _current_header_name; size_t _current_header_len; bool _content_length_coming; }; inline const http_method& http_request::method() const { return _method; } inline const http_version& http_request::version() const { return _version; } inline const char* http_request::path() const { return _path; } inline size_t http_request::path_len() const { return _path_len; } inline const std::vector<header>& http_request::headers() const { return _headers; } inline const char* http_request::body() const { return _body_ptr; } inline uint32_t http_request::body_size() const { return _body_size; } inline bool http_request::is_keep_alive() const { return _keep_alive; } } #endif //FROST_HTTP_REQUEST_H
22.239437
96
0.60703
[ "vector" ]
bef9aa0b83d7c490994419b87d6fbc6743645c12
1,213
c
C
d/antioch/greaterantioch/obj/teepee.c
Dbevan/SunderingShadows
6c15ec56cef43c36361899bae6dc08d0ee907304
[ "MIT" ]
13
2019-07-19T05:24:44.000Z
2021-11-18T04:08:19.000Z
d/antioch/greaterantioch/obj/teepee.c
Dbevan/SunderingShadows
6c15ec56cef43c36361899bae6dc08d0ee907304
[ "MIT" ]
4
2021-03-15T18:56:39.000Z
2021-08-17T17:08:22.000Z
d/antioch/greaterantioch/obj/teepee.c
Dbevan/SunderingShadows
6c15ec56cef43c36361899bae6dc08d0ee907304
[ "MIT" ]
13
2019-09-12T06:22:38.000Z
2022-01-31T01:15:12.000Z
#include <std.h> #include "../gantioch.h" inherit OBJECT; create(){ ::create(); set_id(({"tee-pee"})); set_name("tee-pee"); set_obvious_short("%^RESET%^%^ORANGE%^A n%^RESET%^%^RED%^a%^RESET%^%^ORANGE%^tive tee-pee"); set_short("%^RESET%^%^ORANGE%^A n%^RESET%^%^RED%^a%^RESET%^%^ORANGE%^tive tee-pee"); set_long( "%^RESET%^%^ORANGE%^This well-crafted tee-pee has been decorated heavily. All along its sides"+ "are %^BOLD%^%^YELLOW%^paw prints %^RESET%^%^ORANGE%^and streaks of %^RESET%^%^RED%^blood%^RESET%^%^ORANGE%^."+ " The entrance has a leather pelt made from %^BOLD%^%^WHITE%^wolf skin %^RESET%^%^ORANGE%^over it to give"+ "some amount of privacy. Outside of the tee-pee are a pile of bones, obviously recent victims.%^RESET%^" ); set_weight(1000000); set_value(1300); } void init(){ ::init(); add_action("enter","enter"); } int enter (string str){ if(!str) {return 0;} /* if (ETO->query_bound() || EETO->query_unconscious() || EETO->query_paralyzed()) { ETO->send_paralyzed_message("info",ETO); } */ if(str == "tee-pee"){ this_player()->move_player("/realms/klieth/greaterantioch/rooms/grassland/teepee1.c"); return 1;} }
32.783784
117
0.624897
[ "object" ]
befd7c7814102f6c502ab492fa0e0c3f6ba82d61
558
h
C
editor/widgets/controls/painters/SliderPainter.h
remaininlight/axiom
abd3d9232ffe89dff84b0ef56ab4a1ba9e58d7ce
[ "MIT" ]
642
2017-12-10T14:22:04.000Z
2022-03-03T15:23:23.000Z
editor/widgets/controls/painters/SliderPainter.h
remaininlight/axiom
abd3d9232ffe89dff84b0ef56ab4a1ba9e58d7ce
[ "MIT" ]
151
2017-12-21T02:08:45.000Z
2020-07-03T14:18:51.000Z
editor/widgets/controls/painters/SliderPainter.h
remaininlight/axiom
abd3d9232ffe89dff84b0ef56ab4a1ba9e58d7ce
[ "MIT" ]
30
2018-09-11T14:06:31.000Z
2021-11-09T04:19:00.000Z
#pragma once #include <QtGui/QPainter> #include <QtWidgets/QStyleOptionGraphicsItem> #include "editor/model/Value.h" namespace AxiomGui { class SliderPainter { public: void paint(QPainter *painter, const QRectF &boundingRect, float hoverState, AxiomModel::NumValue cv, bool vertical, const QColor &baseColor, const QColor &activeColor); void shape(QPainterPath &path, const QRectF &boundingRect, bool vertical) const; QRectF getBounds(const QRectF &boundingRect, bool vertical) const; }; }
22.32
118
0.700717
[ "shape", "model" ]
befd930a189dd91ff7f2049e3c62b391a5a5522c
9,142
h
C
src/SeExpr/parser/ASTNode.h
zsnake1209/SeExpr
5e09e1e84b5acb13c6402f2307d5375631f5f4c1
[ "Apache-2.0" ]
294
2015-01-24T00:33:55.000Z
2022-03-12T14:29:28.000Z
src/SeExpr2/parser/ASTNode.h
cooljeanius/SeExpr
42b695546689c61ae87c7747fc27ae50653f09f5
[ "Apache-2.0" ]
53
2015-07-07T06:07:35.000Z
2021-05-27T19:06:31.000Z
src/SeExpr2/parser/ASTNode.h
cooljeanius/SeExpr
42b695546689c61ae87c7747fc27ae50653f09f5
[ "Apache-2.0" ]
82
2015-02-27T10:26:17.000Z
2022-03-27T19:28:25.000Z
/* Copyright Disney Enterprises, Inc. 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 and the following modification to it: Section 6 Trademarks. deleted and replaced with: 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor and its affiliates, except as required for reproducing the content of the NOTICE file. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 */ #pragma once #include <vector> #include <memory> /// A Simple AST class for representing SeExpr, useful for editors enum class ASTType { Invalid, Module, Prototype, LocalFunction, Block, Node, IfThenElse, Vec, Cond, Compare, UnaryOp, BinaryOp, CompareEq, TernaryOp, Subscript, Var, Num, Call, Assign, String, Def }; inline const char* ASTTypeToString(ASTType type) { switch (type) { case ASTType::Invalid: return "Invalid"; case ASTType::Module: return "Module"; case ASTType::Prototype: return "Prototype"; case ASTType::LocalFunction: return "LocalFunction"; case ASTType::Block: return "Block"; case ASTType::Node: return "Node"; case ASTType::IfThenElse: return "IfThenElse"; case ASTType::Vec: return "Vec"; case ASTType::Cond: return "Cond"; case ASTType::Compare: return "Compare"; case ASTType::UnaryOp: return "UnaryOp"; case ASTType::BinaryOp: return "BinaryOp"; case ASTType::CompareEq: return "CompareEq"; case ASTType::TernaryOp: return "TernaryOp"; case ASTType::Subscript: return "Subscript"; case ASTType::Var: return "Var"; case ASTType::Num: return "Num"; case ASTType::Call: return "Call"; case ASTType::Assign: return "Assign"; case ASTType::String: return "String"; case ASTType::Def: return "Def"; } return "<invalid>"; } class ASTNode { public: /// Allows adding arbitary number of items to a container holding unique_ptrs struct Adder { void sequence() {} template <typename T, typename... Targs> void sequence(T&& guy, Targs&&... args) { container.emplace_back(std::move(guy)); sequence(args...); } Adder(std::vector<std::unique_ptr<ASTNode>>& container) : container(container) {} private: std::vector<std::unique_ptr<ASTNode>>& container; }; template <typename... Args> ASTNode(const Range& range, const ASTType& type, Args&&... args) : _type(type) { for (int k = 0; k < 2; k++) _range[k] = range[k]; Adder a(_children); a.sequence(std::forward<Args&&>(args)...); } ASTNode* addChild(std::unique_ptr<ASTNode> node) { _children.push_back(std::move(node)); return _children.back().get(); } std::unique_ptr<ASTNode> removeChild() { std::unique_ptr<ASTNode> ret(std::move(_children.back())); _children.pop_back(); return ret; } void print(std::ostream& out, int indent = 1, const std::string* originalStr = 0, unsigned int mask = 0) { if (originalStr) { Range r = range(); auto replaceNew = [](const std::string& a) { std::string ret; for (char c : a) if (c == '\n') ret += "\\n"; else ret += c; return ret; }; out << replaceNew(originalStr->substr(0, r[0])); out << "\033[7;10m"; out << replaceNew(originalStr->substr(r[0], r[1] - r[0])); out << "\033[7;m"; out << replaceNew(originalStr->substr(r[1], std::string::npos)); } if (indent != 1) { out << " "; for (int i = 1; i < indent - 1; i++) { if ((mask & (1 << i)) != 0) out << " "; else out << " " << "\xe2\x94\x82"; ; } out << " "; if ((mask & (1 << (indent - 1))) != 0) { out << "\xe2\x94\x94"; } else { out << "\xe2\x94\x9c"; } out << "\xe2\x94\x80 "; } else { out << " "; } // out<<std::string(indent*4,' ')<<"|- "<<_name<<"\n"; out << display(); //<<std::endl; out << std::endl; for (auto it = _children.begin(); it != _children.end(); ++it) { int isEnd = it + 1 == _children.end() ? 1 : 0; unsigned int newMask = mask | (int(isEnd) << (indent)); (*it)->print(out, indent + 1, originalStr, newMask); } } virtual std::string display() const { return ASTTypeToString(_type); } void setRange(const Range& range) { _range = range; } const Range& range() const { return _range; } ASTType type() const { return _type; } // TODO: fix // const std::string& typeString() const{return typeToName[_type];} // TODO: fix const std::vector<std::unique_ptr<ASTNode>>& children() const { return _children; } private: ASTType _type; Range _range; // std::string _name; // int _startOffset, _endOffset; std::vector<std::unique_ptr<ASTNode>> _children; }; struct ASTPolicy { typedef ASTNode Base; typedef std::unique_ptr<ASTNode> Ptr; #define SEEXPR_AST_SUBCLASS(name) \ struct name : public Base { \ template <typename... Args> \ name(const Range& range, Args&&... args) \ : Base(range, ASTType::name, args...) {} \ }; #define SEEXPR_AST_SUBCLASS_OP(name) \ struct name : public Base { \ template <typename... Args> \ name(const Range& range, char op, Args&&... args) \ : Base(range, ASTType::name, args...), _op(op) {} \ std::string display() const { return std::string(#name) + _op; } \ char op() const { return _op; } \ char value() const { return _op; } \ \ private: \ char _op; \ }; SEEXPR_AST_SUBCLASS(Module); SEEXPR_AST_SUBCLASS(Prototype); SEEXPR_AST_SUBCLASS(LocalFunction); SEEXPR_AST_SUBCLASS(Block); SEEXPR_AST_SUBCLASS(Node); SEEXPR_AST_SUBCLASS(IfThenElse); SEEXPR_AST_SUBCLASS(Vec); SEEXPR_AST_SUBCLASS(Cond); SEEXPR_AST_SUBCLASS(Compare); SEEXPR_AST_SUBCLASS_OP(UnaryOp); SEEXPR_AST_SUBCLASS_OP(BinaryOp); SEEXPR_AST_SUBCLASS_OP(CompareEq); SEEXPR_AST_SUBCLASS_OP(TernaryOp); SEEXPR_AST_SUBCLASS(Subscript); SEEXPR_AST_SUBCLASS(Def); struct String : public Base { String(const Range& range, const std::string& s) : Base(range, ASTType::String), s(s) {} const std::string& value() const { return s; } std::string s; std::string display() const { return std::string("string") + " " + s; } }; struct Num : public Base { Num(const Range& range, double num) : Base(range, ASTType::Num), num(num) {} double num; double value() const { return num; } std::string display() const { return std::string("num") + " " + std::to_string(num); } }; struct Var : public Base { Var(const Range& range, const std::string& var) : Base(range, ASTType::Var), var(var) {} const std::string& value() const { return var; } std::string display() const { return std::string("var") + " '" + var + "'"; } private: std::string var; }; struct Assign : public Base { Assign(const Range& range, const std::string& var, Ptr node) : Base(range, ASTType::Assign, std::move(node)), var(var) {} std::string display() const { return std::string("assign ") + " '" + var + "'"; } const std::string& value() const { return var; } private: std::string var; }; struct Call : public Base { Call(const Range& range, const std::string& symbolIn) : Base(range, ASTType::Call), func(symbolIn) {} std::string display() const { return std::string("call ") + " '" + func + "'"; } const std::string& value() const { return func; } private: std::string func; }; };
33.487179
110
0.518705
[ "vector" ]
8314731c4f8648b1e3451bd8c45d09dbf08a8d4a
405
h
C
src/day_6_shoal.h
r-ash/aoc2021
ef9b2de8d2a9c5bb8a886adf206ed8a3e0386d04
[ "MIT" ]
null
null
null
src/day_6_shoal.h
r-ash/aoc2021
ef9b2de8d2a9c5bb8a886adf206ed8a3e0386d04
[ "MIT" ]
null
null
null
src/day_6_shoal.h
r-ash/aoc2021
ef9b2de8d2a9c5bb8a886adf206ed8a3e0386d04
[ "MIT" ]
null
null
null
#ifndef AOC_DAY_6_SHOAL_H #define AOC_DAY_6_SHOAL_H class Shoal { public: // Reserve space for 9 items, each one represents fish internal counter // 0 to 9. Values are number of fish with that counter std::vector<long> fish_counts = std::vector<long>(9, 0); Shoal(std::vector<int> fish); long count_fish(); void run_days(int days); private: void run_day(); }; #endif //AOC_DAY_6_SHOAL_H
21.315789
73
0.720988
[ "vector" ]
831a8ef33def337eb815be4ce52eb9abb4ecbcf2
1,026
h
C
RcEngine/src/Platform/OpenGL/OpenGLVertexArray.h
triscuitcircuit/rcengine_clion
300209e9602328242faac9460ed52eb309ce5a32
[ "MIT" ]
5
2021-07-01T06:08:29.000Z
2022-02-28T21:19:33.000Z
RcEngine/src/Platform/OpenGL/OpenGLVertexArray.h
triscuitcircuit/rcengine_clion
300209e9602328242faac9460ed52eb309ce5a32
[ "MIT" ]
null
null
null
RcEngine/src/Platform/OpenGL/OpenGLVertexArray.h
triscuitcircuit/rcengine_clion
300209e9602328242faac9460ed52eb309ce5a32
[ "MIT" ]
null
null
null
// // Created by Tristan Zippert on 5/29/21. // #pragma once #include "RcEngine/Renderer/VertexArray.h" #ifndef RCENGINE_CLION_OPENGLVERTEXARRAY_H #define RCENGINE_CLION_OPENGLVERTEXARRAY_H namespace RcEngine{ class OpenGLVertexArray: public VertexArray{ public: OpenGLVertexArray(); virtual ~OpenGLVertexArray(); virtual void Bind() const override; virtual void Unbind() const override; virtual void AddVertexBuffer(const Ref<VertexBuffer>& vertexBuffer)override ; virtual void SetIndexBuffer(const Ref<IndexBuffer>& indexBuffer)override ; virtual const std::vector<Ref<VertexBuffer>> & GetVertexBuffers() const override{return m_VertexBuffers;}; virtual const Ref<IndexBuffer> & GetIndexBuffer() const override{return m_IndexBuffer;}; private: RendererID m_RendererID; std::vector<Ref<VertexBuffer>> m_VertexBuffers; std::shared_ptr<IndexBuffer> m_IndexBuffer; }; } #endif //RCENGINE_CLION_OPENGLVERTEXARRAY_H
28.5
114
0.72807
[ "vector" ]
831c8ac1e19ede4dec5bf23de7058119f2457a23
3,792
h
C
mshadow/mshadow/extension/roi_unwarp_data.h
kli-nlpr/FaceDetection-ConvNet-3D
f9251c48eb40c5aec8fba7455115c355466555be
[ "Apache-2.0" ]
159
2016-08-23T22:13:26.000Z
2021-10-24T01:31:35.000Z
mshadow/mshadow/extension/roi_unwarp_data.h
mrgloom/FaceDetection-ConvNet-3D
f9251c48eb40c5aec8fba7455115c355466555be
[ "Apache-2.0" ]
10
2016-08-23T05:59:07.000Z
2018-05-24T02:31:41.000Z
mshadow/mshadow/extension/roi_unwarp_data.h
mrgloom/FaceDetection-ConvNet-3D
f9251c48eb40c5aec8fba7455115c355466555be
[ "Apache-2.0" ]
77
2016-08-21T00:35:00.000Z
2021-06-01T05:03:34.000Z
#ifndef MSHADOW_EXTENSION_ROI_UNWARP_DATA_H_ #define MSHADOW_EXTENSION_ROI_UNWARP_DATA_H_ #include <algorithm> #include <cmath> #include "../extension.h" namespace mshadow { namespace expr { template<typename DataExp, typename RoisExp, typename DType, int srcdim> struct ROIUnWarpDataExp: public MakeTensorExp<ROIUnWarpDataExp<DataExp, RoisExp, DType, srcdim>, DataExp, srcdim, DType> { const DataExp &data_src_; const RoisExp &rois_src_; const DataExp &grad_src_; Shape<2> warped_shape_; float spatial_scale_; index_t num_rois_; index_t src_channel_; index_t src_height_; index_t src_width_; ROIUnWarpDataExp(const DataExp &data_src, const RoisExp &rois_src, const DataExp &grad_src, Shape<2> warped_shape, float spatial_scale) : data_src_(data_src), rois_src_(rois_src), grad_src_(grad_src), warped_shape_(warped_shape), spatial_scale_(spatial_scale) { Shape<srcdim> sshape = ShapeCheck<srcdim, DataExp>::Check(data_src_); Shape<2> rshape = ShapeCheck<2, RoisExp>::Check(rois_src_); this->src_channel_ = sshape[srcdim - 3]; this->src_height_ = sshape[srcdim - 2]; this->src_width_ = sshape[srcdim - 1]; this->num_rois_ = rshape[0]; this->shape_ = sshape; } }; template<typename DataExp, typename RoisExp, typename DType, int etype> inline ROIUnWarpDataExp<DataExp, RoisExp, DType, ExpInfo<DataExp>::kDim> roi_unwarp_data(const Exp<DataExp, DType, etype> &data_src, const Exp<RoisExp, DType, etype> &rois_src, const Exp<DataExp, DType, etype> &grad_src, Shape<2> warped_shape, float spatial_scale) { TypeCheckPass<ExpInfo<DataExp>::kDim >= 4> ::Error_Expression_Does_Not_Meet_Dimension_Req(); TypeCheckPass<ExpInfo<RoisExp>::kDim >= 2> ::Error_Expression_Does_Not_Meet_Dimension_Req(); return ROIUnWarpDataExp<DataExp, RoisExp, DType, ExpInfo<DataExp>::kDim> (data_src.self(), rois_src.self(), grad_src.self(), warped_shape, spatial_scale); } template<typename DataExp, typename RoisExp, typename DType, int srcdim> struct Plan<ROIUnWarpDataExp<DataExp, RoisExp, DType, srcdim>, DType> { public: explicit Plan(const ROIUnWarpDataExp<DataExp, RoisExp, DType, srcdim> &e) : data_src_(MakePlan(e.data_src_)), rois_src_(MakePlan(e.rois_src_)), grad_src_(MakePlan(e.grad_src_)), num_rois_(e.num_rois_), warped_shape_(e.warped_shape_), spatial_scale_(e.spatial_scale_), src_channel_(e.src_channel_), src_height_(e.src_height_), src_width_(e.src_width_) {} MSHADOW_XINLINE DType Eval(index_t i, index_t j) const { using namespace std; const index_t v = j; const index_t u = i % src_height_; const index_t c = (i / src_height_) % src_channel_; DType res = DType(0); for(index_t ind = 0; ind < num_rois_; ind++) { const index_t x = round(rois_src_.Eval(ind, 0) * spatial_scale_); const index_t y = round(rois_src_.Eval(ind, 1) * spatial_scale_); const index_t h = round(rois_src_.Eval(ind, 2) * spatial_scale_); const index_t w = round(rois_src_.Eval(ind, 3) * spatial_scale_); for(index_t u_ = 0; u_ < warped_shape_[0]; u_++) for(index_t v_ = 0; v_ < warped_shape_[1]; v_++) { DType tmpx = max(DType(0), 1 - std::fabs(x + u_ * h / (DType)warped_shape_[0] - u)); DType tmpy = max(DType(0), 1 - std::fabs(y + v_ * w / (DType)warped_shape_[1] - v)); res += grad_src_.Eval(ind * src_channel_ * warped_shape_[0] + \ c * warped_shape_[0] + u_, v_) * tmpx * tmpy; } } return res; } private: Plan<DataExp, DType> data_src_; Plan<RoisExp, DType> rois_src_; Plan<DataExp, DType> grad_src_; const index_t num_rois_; Shape<2> warped_shape_; const float spatial_scale_; const index_t src_channel_, src_height_, src_width_; }; } // namespace expr } // namespace mshadow #endif
36.461538
92
0.715454
[ "shape" ]
831ec5ec42ca8281fe74c15477aa4cf4d5824442
7,948
c
C
nitan/kungfu/skill/shexing-diaoshou.c
cantona/NT6
073f4d491b3cfe6bfbe02fbad12db8983c1b9201
[ "MIT" ]
1
2019-03-27T07:25:16.000Z
2019-03-27T07:25:16.000Z
nitan/kungfu/skill/shexing-diaoshou.c
cantona/NT6
073f4d491b3cfe6bfbe02fbad12db8983c1b9201
[ "MIT" ]
null
null
null
nitan/kungfu/skill/shexing-diaoshou.c
cantona/NT6
073f4d491b3cfe6bfbe02fbad12db8983c1b9201
[ "MIT" ]
null
null
null
// shexing-diaoshou.c 蛇形刁手 #include <ansi.h> inherit SKILL; string *order = ({""HIY"", ""HIG"", ""RED"", ""MAG"", ""YEL"", ""HIC"", ""HIW"", ""HIR"",""HIB"", ""CYN"",""WHT"",""HIM"",""BLU""}); mapping *action = ({ ([ "action" : "$N一式"+(order[random(13)])+"「靈蛇出洞」"NOR",右手虛晃,左手揚起,突然拍向$n的背後二穴", "force" : 390, "dodge" : 50, "damage": 340, "lvl" : 0, "skill_name" : "靈蛇出洞", "damage_type" : "瘀傷" ]), ([ "action" : "$N側身一晃,一式"+(order[random(13)])+"「虎頭蛇尾」"NOR",左手拿向$n的肩頭,右拳打向$n的胸口", "force" : 320, "dodge" : 50, "damage": 340, "lvl" : 10, "skill_name" : "虎頭蛇尾", "damage_type" : "瘀傷" ]), ([ "action" : "$N一式"+(order[random(13)])+"「畫蛇添足」"NOR",右手環攏成爪,一出手就向扣$n的咽喉要害", "force" : 230, "dodge" : 20, "damage": 385, "lvl" : 20, "skill_name" : "畫蛇添足", "damage_type" : "瘀傷" ]), ([ "action" : "$N左手虛招,右掌直立,一式"+(order[random(13)])+"「杯弓蛇影」"NOR",錯步飄出,疾拍$n的面門", "force" : 260, "dodge" : 20, "damage": 280, "lvl" : 30, "skill_name" : "杯弓蛇影", "damage_type" : "瘀傷" ]), ([ "action" : "$N使一式"+(order[random(13)])+"「蛇行鼠竄」"NOR",左拳上格,右手探底突出,抓向$n的襠部", "force" : 300, "dodge" : 30, "damage": 295, "lvl" : 38, "skill_name" : "蛇行鼠竄", "damage_type" : "瘀傷" ]), ([ "action" : "$N一式"+(order[random(13)])+"「蛇磐青竹」"NOR",十指伸縮,虛虛實實地襲向$n的全身要穴", "force" : 310, "dodge" : 40, "damage": 225, "lvl" : 51, "skill_name" : "蛇磐青竹", "damage_type" : "內傷" ]), ([ "action" : "$N雙手抱拳,一式"+(order[random(13)])+"「萬蛇洶湧」"NOR",掌影翻飛,同時向$n施出九九八十一招", "force" : 380, "dodge" : 40, "damage": 230, "lvl" : 56, "skill_name" : "萬蛇洶湧", "damage_type" : "內傷" ]), ([ "action" : "$N一式"+(order[random(13)])+"「白蛇吐信」"NOR",拳招若隱若現,若有若無,急急地拍向$n的丹田", "force" : 460, "dodge" : 40, "damage": 340, "lvl" : 60, "skill_name" : "白蛇吐信", "damage_type" : "內傷" ]), ([ "action" : "$N左指揮出,一式"+(order[random(13)])+"「青蛇挺身」"NOR",削向$n的掌緣", "force" : 80, "damage" : 280, "dodge" : 25, "lvl" : 0, "skill_name" : "青蛇挺身", "damage_type" : "瘀傷" ]), ([ "action" : "$N全身之力聚於一指,一式"+(order[random(13)])+"「銀蛇吐信」"NOR",指向$n的胸前", "force" : 100, "damage" : 280, "dodge" : 25, "lvl" : 15, "damage" : 25, "skill_name" : "銀蛇吐信", "damage_type" : "瘀傷" ]), ([ "action" : "$N左掌貼於神道穴,右手一式"+(order[random(13)])+"「金蛇擺尾」"NOR",向$n的$l劃過", "force" : 120, "damage" : 280, "dodge" : 28, "lvl" : 25, "damage" : 55, "skill_name" : "金蛇擺尾", "damage_type" : "瘀傷" ]), ([ "action" : "$N雙目怒視,一式"+(order[random(13)])+"「蝮蛇捕食」"NOR",雙指拂向$n的額、頸、肩、臂、胸、背", "force" : 150, "dodge" : 5, "damage" : 280, "damage": 265, "lvl" : 45, "skill_name" : "蝮蛇捕食", "damage_type" : "瘀傷" ]), ([ "action" : "$N一式"+(order[random(13)])+"「待機而行」"NOR",左掌掌心向外,右指蓄勢點向$n的$l", "force" : 180, "dodge" : 15, "damage" : 280, "damage": 280, "lvl" : 60, "skill_name" : "待機而行", "damage_type" : "瘀傷" ]), ([ "action" : "$N右手伸出,十指叉開,一式"+(order[random(13)])+"「猛蛇出洞」"NOR",小指拂向$n的太淵穴", "force" : 200, "dodge" : 20, "damage": 2100, "lvl" : 70, "skill_name" : "猛蛇出洞", "damage_type" : "瘀傷" ]), ([ "action" : "$N雙迸出無數道勁氣,一式"+(order[random(13)])+"「千蛇纏身」"NOR"射向$n的全身", "force" : 220, "dodge" : 25, "damage": 220, "lvl" : 80, "skill_name" : "千蛇纏身", "damage_type" : "瘀傷" ]), }); int valid_enable(string usage) { return usage=="hand" || usage=="parry"|| usage=="unarmed"; } int valid_learn(object me) { if (me->query_temp("weapon") || me->query_temp("secondary_weapon")) return notify_fail("練蛇形刁手必須空手。\n"); if ((int)me->query_skill("hamagong", 1) < 20) return notify_fail("你的蛤蟆功不夠 \n"); if ((int)me->query("max_neili") < 100) return notify_fail("你的內力太弱,無法練蛇形刁手。\n"); return 1; } int valid_combine(string combo) { return combo=="lingshe-quan" || combo == "shentuo-zhang"; } string query_skill_name(int level) { int i; for(i = sizeof(action)-1; i >= 0; i--) if(level >= action[i]["lvl"]) return action[i]["skill_name"]; } mapping query_action(object me, object weapon) { int i, level,ob_lvl,attack; object ob; ob = me->select_opponent(); level = (int)me->query_skill("shexing-diaoshou", 1)+1; attack=level/100; if (!ob) { for(i = sizeof(action); i > 0; i--) if(level > action[i-1]["lvl"]) return action[NewRandom(i, 20, level/5)]; } if (!me) { for(i = sizeof(action); i > 0; i--) if(level > action[i-1]["lvl"]) return action[NewRandom(i, 20, level/5)]; } if(level>200 &&random(level)>level/3 &&(random(me->query_dex())>20) &&living(ob) // &&me!= ob &&me->query("neili")>800 && !me->is_busy() && !me->query_temp("noauto") && !me->query_temp("dsauto")) { if(attack>4) attack=4; attack=random(attack); if(attack<=1) attack=1; if(attack>4) attack=4; message_vision(HIY "緊接着,$N口中發出“嘶嘶”的聲音,雙手半曲,三指上豎成蛇狀,陪合着瀟遙步法,有如急風暴雨般攻出了"+ chinese_number(attack+1)+"招。\n" NOR, me); for(i=0;i<attack;i++) { me->add("neili", -(50+random(50))); if(!ob) { break; } // if(me=ob) // { // break; // } if(!me) { break; } if(!living(ob)) { break; } if(ob && me) { me->set_temp("dsauto",1); COMBAT_D->do_attack(me, ob, me->query_temp("weapon"), 1); me->delete_temp("dsauto"); } } } else if(level>200 &&random(level)>level*2/5 &&(random(me->query_dex())>25) &&living(ob) &&me->query("neili")>500 &&random(5)>2 && !me->query_temp("noauto") ) { message_vision(YEL "$N揉身而上,自左向右輕輕迴旋一週,$n被$N的身行所迷惑,頓時放棄攻擊,改為自守。\n" NOR, me,ob); if (ob && me && ob!=me) { if( !ob->is_busy() ) { ob->start_busy(3); } me->add("neili", -20); } } for(i = sizeof(action); i > 0; i--) if(level > action[i-1]["lvl"]) return action[NewRandom(i, 20, level/5)]; } int practice_skill(object me) { if ((int)me->query("qi") < 30) return notify_fail("你的體力太低了。\n"); if ((int)me->query("neili") < 20) return notify_fail("你的內力不夠練蛇形刁手。\n"); me->receive_damage("qi", 25); me->add("neili", -5); return 1; } string perform_action_file(string action) { return __DIR__"shexing-diaoshou/" + action; } mixed hit_ob(object me, object victim, int damage_bonus) { int lvl; int flvl; int level, jiali, time,level2,damage,damage2; object weapon; object target; target=victim; level = (int) me->query_skill("hamagong",1); level2= (int) me->query_skill("hamagong",1); damage2= (int) victim->query("neili",1)/8; if (damage2>= 3800) damage2 = 3800; if (random(8)==0 && level>=300 && me->query_skill_mapped("force") == "hamagong") { target->apply_condition("snake_poison",5); target->apply_condition("chanchu_poison",5); target->apply_condition("qx_snake_poison",3); if (!target->is_busy()) target->start_busy(2); return HIR "$N倒轉經脈,身形一變,一口毒氣對着$n吐出!$n頭一昏,不知所措 !\n"; } if( damage_bonus < 100 ) return 0; if (me->query_temp("hmg_dzjm") && random(4)>2 ) { victim->receive_damage("qi", damage_bonus/2); victim->receive_wound("qi", damage_bonus/2); return HIR "$N倒轉經脈對着$n張口一咬!$n傷口一涼,鮮血噴出!\n"; } if( damage_bonus/2 > victim->query_str() || random(8)==0 ) { if(me->query_skill("hamagong", 1)>100) { if (me->query_skill_mapped("force") == "hamagong" && !me->query_temp("weapon")) { victim->receive_wound("qi", (damage_bonus ) / 2 ); return HIM " "+ victim->name()+"喘息未定,又覺一股勁風撲面而來,吐出了一大口鮮血!\n" NOR; } } } }
24.68323
132
0.518747
[ "object" ]
83209ffec0406884c3722735f5b5122e50e8b0f3
9,264
h
C
src/mongo/executor/remote_command_request.h
benety/mongo
203430ac9559f82ca01e3cbb3b0e09149fec0835
[ "Apache-2.0" ]
null
null
null
src/mongo/executor/remote_command_request.h
benety/mongo
203430ac9559f82ca01e3cbb3b0e09149fec0835
[ "Apache-2.0" ]
null
null
null
src/mongo/executor/remote_command_request.h
benety/mongo
203430ac9559f82ca01e3cbb3b0e09149fec0835
[ "Apache-2.0" ]
null
null
null
/** * Copyright (C) 2018-present MongoDB, Inc. * * This program is free software: you can redistribute it and/or modify * it under the terms of the Server Side Public License, version 1, * as published by MongoDB, Inc. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * Server Side Public License for more details. * * You should have received a copy of the Server Side Public License * along with this program. If not, see * <http://www.mongodb.com/licensing/server-side-public-license>. * * As a special exception, the copyright holders give permission to link the * code of portions of this program with the OpenSSL library under certain * conditions as described in each individual source file and distribute * linked combinations including the program with the OpenSSL library. You * must comply with the Server Side Public License in all respects for * all of the code used other than as permitted herein. If you modify file(s) * with this exception, you may extend this exception to your version of the * file(s), but you are not obligated to do so. If you do not wish to do so, * delete this exception statement from your version. If you delete this * exception statement from all source files in the program, then also delete * it in the license file. */ #pragma once #include <iosfwd> #include <string> #include "mongo/base/error_codes.h" #include "mongo/db/jsobj.h" #include "mongo/rpc/metadata.h" #include "mongo/transport/transport_layer.h" #include "mongo/util/concepts.h" #include "mongo/util/net/hostandport.h" #include "mongo/util/time_support.h" namespace mongo { namespace executor { struct RemoteCommandRequestBase { struct HedgeOptions { size_t count = 0; int maxTimeMSForHedgedReads = 0; }; enum FireAndForgetMode { kOn, kOff }; // Indicates that there is no timeout for the request to complete static constexpr Milliseconds kNoTimeout{-1}; // Type to represent the internal id of this request typedef uint64_t RequestId; RemoteCommandRequestBase(); RemoteCommandRequestBase(RequestId requestId, const std::string& theDbName, const BSONObj& theCmdObj, const BSONObj& metadataObj, OperationContext* opCtx, Milliseconds timeoutMillis, boost::optional<HedgeOptions> hedgeOptions, FireAndForgetMode fireAndForgetMode); // Internal id of this request. Not interpreted and used for tracing purposes only. RequestId id; std::string dbname; BSONObj metadata{rpc::makeEmptyMetadata()}; BSONObj cmdObj; BSONObj securityToken; // OperationContext is added to each request to allow OP_Command metadata attachment access to // the Client object. The OperationContext is only accessed on the thread that calls // NetworkInterface::startCommand. It is not safe to access from a thread that does not own the // OperationContext in the general case. OperationContext should be non-null on // NetworkInterfaces that do user work (i.e. reads, and writes) so that audit and client // metadata is propagated. It is allowed to be null if used on NetworkInterfaces without // metadata attachment (i.e., replication). OperationContext* opCtx{nullptr}; boost::optional<HedgeOptions> hedgeOptions; boost::optional<UUID> operationKey; FireAndForgetMode fireAndForgetMode = FireAndForgetMode::kOff; // When false, the network interface will refrain from enforcing the 'timeout' for this request, // but will still pass the timeout on as maxTimeMSOpOnly. bool enforceLocalTimeout = true; Milliseconds timeout = kNoTimeout; ErrorCodes::Error timeoutCode = ErrorCodes::NetworkInterfaceExceededTimeLimit; // Time when the request was scheduled. boost::optional<Date_t> dateScheduled; transport::ConnectSSLMode sslMode = transport::kGlobalSSLMode; protected: ~RemoteCommandRequestBase() = default; private: /** * Sets 'timeout' to the min of the current 'timeout' value and the remaining time on the OpCtx. * If the remaining time is less than the provided 'timeout', remembers the timeout error code * from the opCtx to use later if the timeout is indeed triggered. This is important so that * timeouts that are a direct result of a user-provided maxTimeMS return MaxTimeMSExpired rather * than NetworkInterfaceExceededTimeLimit. */ void _updateTimeoutFromOpCtxDeadline(const OperationContext* opCtx); }; /** * Type of object describing a command to execute against a remote MongoDB node. */ template <typename Target> struct RemoteCommandRequestImpl : RemoteCommandRequestBase { RemoteCommandRequestImpl(); // Allow implicit conversion from RemoteCommandRequest to RemoteCommandRequestOnAny REQUIRES_FOR_NON_TEMPLATE(std::is_same_v<Target, std::vector<HostAndPort>>) RemoteCommandRequestImpl(const RemoteCommandRequestImpl<HostAndPort>& other) : RemoteCommandRequestBase(other), target({other.target}) {} // Allow conversion from RemoteCommandRequestOnAny to RemoteCommandRequest with the index of a // particular host REQUIRES_FOR_NON_TEMPLATE(std::is_same_v<Target, HostAndPort>) RemoteCommandRequestImpl(const RemoteCommandRequestImpl<std::vector<HostAndPort>>& other, size_t idx) : RemoteCommandRequestBase(other), target(other.target[idx]) {} RemoteCommandRequestImpl(RequestId requestId, const Target& theTarget, const std::string& theDbName, const BSONObj& theCmdObj, const BSONObj& metadataObj, OperationContext* opCtx, Milliseconds timeoutMillis = kNoTimeout, boost::optional<HedgeOptions> hedgeOptions = boost::none, FireAndForgetMode fireAndForgetMode = FireAndForgetMode::kOff); RemoteCommandRequestImpl(const Target& theTarget, const std::string& theDbName, const BSONObj& theCmdObj, const BSONObj& metadataObj, OperationContext* opCtx, Milliseconds timeoutMillis = kNoTimeout, boost::optional<HedgeOptions> hedgeOptions = boost::none, FireAndForgetMode fireAndForgetMode = FireAndForgetMode::kOff); RemoteCommandRequestImpl(const Target& theTarget, const std::string& theDbName, const BSONObj& theCmdObj, const BSONObj& metadataObj, OperationContext* opCtx, boost::optional<HedgeOptions> hedgeOptions, FireAndForgetMode fireAndForgetMode = FireAndForgetMode::kOff) : RemoteCommandRequestImpl(theTarget, theDbName, theCmdObj, metadataObj, opCtx, kNoTimeout, hedgeOptions, fireAndForgetMode) {} RemoteCommandRequestImpl(const Target& theTarget, const std::string& theDbName, const BSONObj& theCmdObj, OperationContext* opCtx, Milliseconds timeoutMillis = kNoTimeout, boost::optional<HedgeOptions> hedgeOptions = boost::none, FireAndForgetMode fireAndForgetMode = FireAndForgetMode::kOff) : RemoteCommandRequestImpl(theTarget, theDbName, theCmdObj, rpc::makeEmptyMetadata(), opCtx, timeoutMillis, hedgeOptions, fireAndForgetMode) {} std::string toString() const; bool operator==(const RemoteCommandRequestImpl& rhs) const; bool operator!=(const RemoteCommandRequestImpl& rhs) const; friend std::ostream& operator<<(std::ostream& os, const RemoteCommandRequestImpl& response) { return (os << response.toString()); } Target target; }; extern template struct RemoteCommandRequestImpl<HostAndPort>; extern template struct RemoteCommandRequestImpl<std::vector<HostAndPort>>; using RemoteCommandRequest = RemoteCommandRequestImpl<HostAndPort>; using RemoteCommandRequestOnAny = RemoteCommandRequestImpl<std::vector<HostAndPort>>; } // namespace executor } // namespace mongo
44.114286
100
0.636874
[ "object", "vector" ]
83236046089a9e4c06a24dd05f5a11ca3c1248d8
2,372
h
C
MiDAesLib/include/AesApiFuncs.h
ElMostafaIdrassi/MiD_idxcrypt
45cfb97e60002e8c3f3a7b8cb1bb432fefa43202
[ "Apache-2.0" ]
2
2017-07-01T21:39:41.000Z
2018-12-16T14:10:30.000Z
MiDAesLib/include/AesApiFuncs.h
ElMostafaIdrassi/MiD_idxcrypt
45cfb97e60002e8c3f3a7b8cb1bb432fefa43202
[ "Apache-2.0" ]
null
null
null
MiDAesLib/include/AesApiFuncs.h
ElMostafaIdrassi/MiD_idxcrypt
45cfb97e60002e8c3f3a7b8cb1bb432fefa43202
[ "Apache-2.0" ]
null
null
null
/* * ===================================== * Copyright (c) El Mostafa IDRASSI 2017 * mostafa.idrassi@tutanota.com * Apache License * ===================================== */ #ifndef AESAPIFUNCS_H #define AESAPIFUNCS_H #include "AES_CTX.h" /* ==================================================================== AES context object initialization - Encryption/Decryption parameters * Sets the mode_number and the key_size (provided in bits) * Expands the userKey into AES round keys * Sets the IV and the encryption parameter */ int CreateCipher(AES_CTX & ctx, const Mode_Number & mode_number, const unsigned char * userKey, const int & key_size, const unsigned char * iv, const int & toBeEncrypted); /* ==================================================================== Applies the appropriate AES cipher mode * Stores the input in a permanent buffer * Applies PKCS padding when required/needed during encryption * Checks padding and removes it during decryption * out_initial_len contains the length of the output when first initialized; alimented by the user; input of the function * out_final_len will contain the proper length of the output after enc/dec and obviously removing the padding; output of the function */ int OpCipher(AES_CTX & ctx, const unsigned char * in, const size_t & in_len, unsigned char * out, const size_t & out_initial_len, size_t & out_final_len, const int & paddingParam); /* ==================================================================== Deletes securely all CTX variables/fields * memset instructions can be optimized by the compiler, and thus be ignored => my_memclr */ void CleanCipher(AES_CTX & ctx); /* ==================================================================== Makes sure all the functions provided by the library are working as expected Return 0 if successful and 1 if there was a failure. * Based on NIST Advanced Encryption Standard Algorithm Validation Suite and partially on RFC 3686 (CTR) * (1 GFSbox and 1 KeySbox test / key length / mode (ECB, CBC, CFB, OFB)) * (1 RFC 3686 test / key length for CTR) * (1 Multi-Block-Message test / key length / mode (all modes) : 36 bytes for CTR and 32 bytes for the other modes) * (Arbitrary length plaintext testing on ECB/CBC will only validate padding functionning => already validated (PKCS#7) => not included in the tests) */ int AesLib_Init(); #endif
48.408163
181
0.650506
[ "object" ]
7e94825a8865900fcfaeee34791a244a6f1ea052
2,789
h
C
chrome/browser/views/tabs/tab_strip_wrapper.h
zachlatta/chromium
c4625eefca763df86471d798ee5a4a054b4716ae
[ "BSD-3-Clause" ]
1
2021-09-24T22:49:10.000Z
2021-09-24T22:49:10.000Z
chrome/browser/views/tabs/tab_strip_wrapper.h
changbai1980/chromium
c4625eefca763df86471d798ee5a4a054b4716ae
[ "BSD-3-Clause" ]
null
null
null
chrome/browser/views/tabs/tab_strip_wrapper.h
changbai1980/chromium
c4625eefca763df86471d798ee5a4a054b4716ae
[ "BSD-3-Clause" ]
null
null
null
// Copyright (c) 2009 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. #ifndef CHROME_BROWSER_VIEWS_TABS_TAB_STRIP_WRAPPER_H_ #define CHROME_BROWSER_VIEWS_TABS_TAB_STRIP_WRAPPER_H_ class BrowserTabStrip; namespace gfx { class Point; class Rect; } class TabStrip; class TabStripModel; namespace views { class View; } // A temporary interface to abstract the TabStrip implementation (which can be // either TabStrip or TabStrip2) from the rest of the Browser frontend code // while the new TabStrip is brought up. class TabStripWrapper { public: // Returns the preferred height of this TabStrip. This is based on the // typical height of its constituent tabs. virtual int GetPreferredHeight() = 0; // Returns true if Tabs in this TabStrip are currently changing size or // position. virtual bool IsAnimating() const = 0; // Set the background offset used by inactive tabs to match the frame image. virtual void SetBackgroundOffset(gfx::Point offset) = 0; // Returns true if the specified point(TabStrip coordinates) should be // considered to be within the window caption area of the browser window. virtual bool PointIsWithinWindowCaption(const gfx::Point& point) = 0; // Returns true if a drag session is currently active. virtual bool IsDragSessionActive() const = 0; // Return true if this tab strip is compatible with the provided tab strip. // Compatible tab strips can transfer tabs during drag and drop. virtual bool IsCompatibleWith(TabStripWrapper* other) const = 0; // Sets the bounds of the tab at the specified |tab_index|. |tab_bounds| are // in TabStrip coordinates. virtual void SetDraggedTabBounds(int tab_index, const gfx::Rect& tab_bounds) = 0; // Updates the loading animations displayed by tabs in the tabstrip to the // next frame. virtual void UpdateLoadingAnimations() = 0; // Returns the views::View of the wrapped tabstrip, for layout and sizing. virtual views::View* GetView() = 0; // Shim to provide access to the BrowserTabStrip implementation for code only // called from within TabStrip2::Enabled() == true blocks. Returns NULL when // old TabStrip is in effect. virtual BrowserTabStrip* AsBrowserTabStrip() = 0; // Shim to provide access to the TabStrip implementation for code only called // from within TabStrip2::Enabled() == false blocks. Returns NULL when the new // TabStrip is in effect. virtual TabStrip* AsTabStrip() = 0; // Creates a TabStrip - either the old or new one depending on command line // flags. static TabStripWrapper* CreateTabStrip(TabStripModel* model); }; #endif // CHROME_BROWSER_VIEWS_TABS_TAB_STRIP_WRAPPER_H_
37.689189
80
0.747221
[ "model" ]
7e96a270eafa1ff4319d837359b8b0c10ca32119
7,787
h
C
bng/graph.h
mcellteam/libbng
1d9fe00a2cc9a8d223078aec2700e7b86b10426a
[ "MIT" ]
null
null
null
bng/graph.h
mcellteam/libbng
1d9fe00a2cc9a8d223078aec2700e7b86b10426a
[ "MIT" ]
null
null
null
bng/graph.h
mcellteam/libbng
1d9fe00a2cc9a8d223078aec2700e7b86b10426a
[ "MIT" ]
1
2021-05-11T21:13:20.000Z
2021-05-11T21:13:20.000Z
/****************************************************************************** * Copyright (C) 2020-2021 by * The Salk Institute for Biological Studies * * Use of this source code is governed by an MIT-style * license that can be found in the LICENSE file or at * https://opensource.org/licenses/MIT. ******************************************************************************/ #ifndef LIBS_BNG_GRAPH_H_ #define LIBS_BNG_GRAPH_H_ #include <iostream> #include "bng/elem_mol_type.h" #include "bng/elem_mol.h" #include <boost/graph/adjacency_list.hpp> #include <boost/graph/iteration_macros.hpp> #define BOOST_POOL_NO_MT #include <boost/pool/pool_alloc.hpp> #undef BOOST_POOL_NO_MT namespace boost { // NOTE: not sure if we need to put this really into the boost namespace struct pool_listS { }; // examples of allocators usage are here: https://theboostcpplibraries.com/boost.pool // TODO: figure out whether we need to use purge_memory // // note from https://www.boost.org/doc/libs/1_65_0/libs/pool/doc/html/boost/fast_pool_allocator.html: // The underlying singleton_pool used by the this allocator constructs a pool instance // that is never freed. This means that memory allocated by the allocator can be still // used after main() has completed, but may mean that some memory checking programs will // complain about leaks. template <class ValueType> struct container_gen<pool_listS, ValueType> { typedef std::list<ValueType, boost::fast_pool_allocator<ValueType>> type; }; template <> struct parallel_edge_traits<pool_listS> { typedef allow_parallel_edge_tag type; }; } namespace BNG { class BNGData; struct Node { Node() : is_mol(true), mol(nullptr), component(nullptr), used_in_rxn_product(true), product_index(INDEX_INVALID), reactant_pattern_index(INDEX_INVALID), ordering_index(INDEX_INVALID), modified_ordering_index(ordering_index) { } Node(ElemMol* mol_) : is_mol(true), mol(mol_), component(nullptr), used_in_rxn_product(true), product_index(INDEX_INVALID), reactant_pattern_index(INDEX_INVALID), ordering_index(INDEX_INVALID), modified_ordering_index(INDEX_INVALID) { } Node(Component* component_) : is_mol(false), mol(nullptr), component(component_), used_in_rxn_product(true), product_index(INDEX_INVALID), reactant_pattern_index(INDEX_INVALID), ordering_index(INDEX_INVALID), modified_ordering_index(INDEX_INVALID) { } // returns true if n2 matches pattern represented by 'this' bool compare(const Node& n2) const { const Node& n1 = *this; if (n1.reactant_pattern_index != INDEX_INVALID && n2.reactant_pattern_index != INDEX_INVALID && n1.reactant_pattern_index != n2.reactant_pattern_index) { // in bimol rxns, we must check that the pattern matched the correct reactant // checked only when both are set return false; } else if (n1.modified_ordering_index != n2.modified_ordering_index) { // extra ordering needed to get unique products, // modified_ordering_index is set to INDEX_INVALID by default and // set to a different value only when needed return false; } else if (n1.is_mol != n2.is_mol) { return false; } else if (n1.is_mol) { // molecule assert(n2.is_mol); assert(n1.mol != nullptr); assert(n2.mol != nullptr); // molecule type if (n1.mol->elem_mol_type_id != n2.mol->elem_mol_type_id) { return false; } // does compartment match? if (n1.mol->compartment_id != COMPARTMENT_ID_NONE && !is_in_out_compartment_id(n1.mol->compartment_id) && n1.mol->compartment_id != n2.mol->compartment_id) { return false; } return true; } else { // component assert(!n1.is_mol && !n2.is_mol); assert(n1.component != nullptr); assert(n2.component != nullptr); // component type if (n1.component->component_type_id != n2.component->component_type_id) { // must be the same return false; } // state if (n1.component->state_id != STATE_ID_DONT_CARE && n2.component->state_id != STATE_ID_DONT_CARE) { // must be the same or don't care for one of the compared nodes if (n1.component->state_id != n2.component->state_id) { return false; } } // bond // comparing !? if (n1.component->bond_value == BOND_VALUE_ANY || n2.component->bond_value == BOND_VALUE_ANY) { return true; } // comparing !+ if (n1.component->bond_value == BOND_VALUE_BOUND) { // it is ok when the second node has !+ as well return n2.component->bond_value != BOND_VALUE_UNBOUND; } else if (n1.component->bond_value == BOND_VALUE_UNBOUND) { // no bond means that there must be no bond on the other side either return n2.component->bond_value == BOND_VALUE_UNBOUND; } if (n2.component->bond_value == BOND_VALUE_BOUND) { return n1.component->bond_value != BOND_VALUE_UNBOUND; } else if (n2.component->bond_value == BOND_VALUE_UNBOUND) { return n1.component->bond_value == BOND_VALUE_UNBOUND; } // we do not care about actual bond values because to what is the component connected is // represented by the graph return true; } } std::string to_str(const BNGData* bng_data = nullptr) const; bool is_mol; ElemMol* mol; Component* component; // for reaction handling, default is true bool used_in_rxn_product; // also for reactions - specifies index of the reaction product // needed to match patterns onto resulting products uint product_index; // used when creating product sets - in bimol rxns one reactant pattern must match // exactly one reactant, not both uint reactant_pattern_index; // auxiliary ordering markers, used when determining whether two product sets are identical // ordering_index is set to all components and when a reactant changes by // a rule application, its value is copied to the modified_ordering_index uint ordering_index; uint modified_ordering_index; }; std::ostream & operator<<(std::ostream &out, const Node& n); // molecule instance/pattern is a node in the complex graph, edge is a bond typedef boost::property<boost::vertex_name_t, Node, boost::property< boost::vertex_index_t, int > > MtVertexProperty; // one can choose different underlying types (vecS/listS/setS...) but // vecS seems to be the most efficient // last 7th unlisted argument EdgeList must be listS (default) otherwise it is not possible to remove edges typedef boost::adjacency_list< boost::vecS, boost::vecS, boost::undirectedS, MtVertexProperty, boost::no_property, boost::no_property, boost::pool_listS > Graph; typedef boost::property_map<Graph, boost::vertex_name_t >::type VertexNameMap; // FIXME: this has to be a map, not a vector of pairs.. typedef std::map<Graph::vertex_descriptor, Graph::vertex_descriptor> VertexMapping; typedef std::vector<VertexMapping> VertexMappingVector; typedef Graph::vertex_descriptor vertex_descriptor_t; typedef Graph::edge_descriptor edge_descriptor_t; typedef boost::graph_traits<Graph>::vertex_iterator vertex_iter_t; // TODO: use this typedef wherever needed // finds all subgraph isomorphism mappings of pattern graph on cplx graph void get_subgraph_isomorphism_mappings( Graph& pattern, Graph& cplx, const bool only_first_match, VertexMappingVector& res ); void dump_graph(const Graph& g_const, const BNGData* bng_data = nullptr, const std::string ind = ""); void dump_graph_mapping(const VertexMapping& mapping); } // namespace BNG #endif /* LIBS_BNG_GRAPH_H_ */
34.763393
117
0.691666
[ "vector" ]
7e9b2697c081dd8ce54521afb803726255acfe56
3,019
h
C
GUI/Subscriber.h
jwillemsen/sidecar
941d9f3b84d05ca405df1444d4d9fd0bde03887f
[ "MIT" ]
null
null
null
GUI/Subscriber.h
jwillemsen/sidecar
941d9f3b84d05ca405df1444d4d9fd0bde03887f
[ "MIT" ]
null
null
null
GUI/Subscriber.h
jwillemsen/sidecar
941d9f3b84d05ca405df1444d4d9fd0bde03887f
[ "MIT" ]
null
null
null
#ifndef SIDECAR_GUI_SUBSCRIBER_H // -*- C++ -*- #define SIDECAR_GUI_SUBSCRIBER_H #include "QtCore/QObject" namespace Logger { class Log; } namespace SideCar { namespace GUI { class MessageList; class ReaderThread; class ServiceEntry; /** The input side of a publisher/subscriber pair. Manages a separate thread that hosts a TCP/UDP reader which obtains data from the publisher. Uses the incoming() signal to announce the arrival of new messages. The useServiceEntry() method gives the subscriber connection information of a publichser to connect to. */ class Subscriber : public QObject { Q_OBJECT using Super = QObject; public: static Logger::Log& Log(); /** Constructor. \param parent owner for the purposes of destruction via Qt hierarchy */ Subscriber(QObject* parent = 0); /** Destructor. Terminates any active reader thread. */ ~Subscriber(); /** Set publisher connection info to use. May be NULL which will close any active connection. \param serviceEntry data publisher connection info */ void useServiceEntry(ServiceEntry* serviceEntry); /** Obtain the connection state of the subscriber. \return true if connected */ bool isConnected() const { return connected_; } /** Obtain the set of messages available from the publisher. May be NULL if there is no connection to a publisher. \return list of Messages::Header::Ref references */ const MessageList& getMessages() const; signals: /** Notification that a connection has been established to a publisher. */ void connected(); /** Notification that one or more messages are available to fetch via the getMessages(). */ void dataAvailable(); /** Notification that a connection has been dropped. */ void disconnected(); public slots: /** Shut down any active connection to a publisher. */ void shutdown(); private slots: /** Notification from a ServiceEntry that it has resolved its host/port information. \param serviceEntry object that resolved */ void resolvedServiceEntry(ServiceEntry* serviceEntry); /** Notification from a ServiceEntry that it is about to be deleted. */ void lostServiceEntry(); /** Notification from the internal ReaderThread object that it has established a connection to the publisher. For UDP connections, this signal comes when the first message arrives over the UDP socket. */ void readerConnected(); /** Notification from the internal ReaderThread object that it has lost its connection to the publisher. Only valid for TCP connections. */ void readerDisconnected(); private: ServiceEntry* serviceEntry_; ///< Current connection information ReaderThread* reader_; ///< Separate thread that performs the reads bool connected_; ///< Connection state }; } // end namespace GUI } // end namespace SideCar /** \file */ #endif
26.482456
110
0.692945
[ "object" ]
7ea3036d93a236ef8258ba72745ab0400d885b30
6,942
c
C
src/simd.c
Honeybunch/sdltest
6ccf90ea75ae4cf1a7f5318b898279d3098ce0f2
[ "MIT" ]
1
2021-03-29T22:09:07.000Z
2021-03-29T22:09:07.000Z
src/simd.c
Honeybunch/sdltest
6ccf90ea75ae4cf1a7f5318b898279d3098ce0f2
[ "MIT" ]
null
null
null
src/simd.c
Honeybunch/sdltest
6ccf90ea75ae4cf1a7f5318b898279d3098ce0f2
[ "MIT" ]
1
2021-03-30T00:12:17.000Z
2021-03-30T00:12:17.000Z
#include "simd.h" #define _USE_MATH_DEFINES #include <assert.h> #include <math.h> #include <stdbool.h> #include "profiling.h" #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wmissing-braces" #endif #ifdef __clang__ #define unroll_loop_3 _Pragma("clang loop unroll_count(3)") #define unroll_loop_4 _Pragma("clang loop unroll_count(4)") #endif #ifdef __GNUC__ #define unroll_loop_3 _Pragma("GCC unroll 3") #define unroll_loop_4 _Pragma("GCC unroll 4") #endif float3 f4tof3(float4 f) { return (float3){f[0], f[1], f[2]}; } float4 f3tof4(float3 f, float w) { return (float4){f[0], f[1], f[2], w}; } float3x4 m44tom34(float4x4 m) { return (float3x4){ .row0 = m.row0, .row1 = m.row1, .row2 = m.row2, }; } float dotf3(float3 x, float3 y) { return (x[0] * y[0]) + (x[1] * y[1]) + (x[2] * y[2]); } float dotf4(float4 x, float4 y) { return (x[0] * y[0]) + (x[1] * y[1]) + (x[2] * y[2]) + (x[3] * y[3]); } float3 crossf3(float3 x, float3 y) { return (float3){ (x[1] * y[2]) - (x[2] * y[1]), (x[2] * y[0]) - (x[0] * y[2]), (x[0] * y[1]) - (x[1] * y[0]), }; } float magf3(float3 v) { return sqrtf((v[0] * v[0]) + (v[1] * v[1]) + (v[2] * v[2])); } float magf4(float4 v) { return sqrtf((v[0] * v[0]) + (v[1] * v[1]) + (v[2] * v[2]) + (v[3] * v[3])); } float magsqf3(float3 v) { return (v[0] * v[0]) + (v[1] * v[1]) + (v[2] * v[2]); } float magsqf4(float3 v) { return (v[0] * v[0]) + (v[1] * v[1]) + (v[2] * v[2]) + (v[3] * v[3]); } float3 normf3(float3 v) { float invSum = 1 / magf3(v); return (float3){v[0] * invSum, v[1] * invSum, v[2] * invSum}; } void mf33_identity(float3x3 *m) { assert(m); *m = (float3x3){ (float3){1, 0, 0}, (float3){0, 1, 0}, (float3){0, 0, 1}, }; } void mf34_identity(float3x4 *m) { assert(m); *m = (float3x4){ (float4){1, 0, 0, 0}, (float4){0, 1, 0, 0}, (float4){0, 0, 1, 0}, }; } void mf44_identity(float4x4 *m) { assert(m); *m = (float4x4){ (float4){1, 0, 0, 0}, (float4){0, 1, 0, 0}, (float4){0, 0, 1, 0}, (float4){0, 0, 0, 1}, }; } void mulf33(float3x3 *m, float3 v) { assert(m); unroll_loop_3 for (uint32_t i = 0; i < 3; ++i) { float s = v[i]; m->row0[i] *= s; m->row1[i] *= s; m->row2[i] *= s; } } void mulf34(float3x4 *m, float4 v) { assert(m); unroll_loop_4 for (uint32_t i = 0; i < 4; ++i) { float s = v[i]; m->row0[i] *= s; m->row1[i] *= s; m->row2[i] *= s; } } void mulf44(float4x4 *m, float4 v) { assert(m); unroll_loop_4 for (uint32_t i = 0; i < 4; ++i) { float s = v[i]; m->row0[i] *= s; m->row1[i] *= s; m->row2[i] *= s; m->row3[i] *= s; } } void mulmf34(const float3x4 *x, const float3x4 *y, float3x4 *o) { assert(x); assert(y); assert(o); unroll_loop_3 for (uint32_t i = 0; i < 3; ++i) { unroll_loop_4 for (uint32_t ii = 0; ii < 4; ++ii) { float s = 0.0f; unroll_loop_3 for (uint32_t iii = 0; iii < 3; ++iii) { s += x->rows[i][iii] * y->rows[iii][ii]; } if (ii == 3) { s += x->rows[i][3]; } o->rows[i][ii] = s; } } } void mulmf44(const float4x4 *x, const float4x4 *y, float4x4 *o) { TracyCZoneN(ctx, "mulmf44", true); TracyCZoneColor(ctx, TracyCategoryColorMath); assert(x); assert(y); assert(o); unroll_loop_4 for (uint32_t i = 0; i < 4; ++i) { unroll_loop_4 for (uint32_t ii = 0; ii < 4; ++ii) { float s = 0.0f; unroll_loop_4 for (uint32_t iii = 0; iii < 4; ++iii) { s += x->rows[i][iii] * y->rows[iii][ii]; } o->rows[i][ii] = s; } } TracyCZoneEnd(ctx); } void translate(Transform *t, float3 p) { assert(t); t->position += p; } void scale(Transform *t, float3 s) { assert(t); t->scale += s; } void rotate(Transform *t, float3 r) { assert(t); t->rotation += r; } void transform_to_matrix(float4x4 *m, const Transform *t) { TracyCZoneN(ctx, "transform_to_matrix", true); TracyCZoneColor(ctx, TracyCategoryColorMath); assert(m); assert(t); // Position matrix float4x4 p = { (float4){1, 0, 0, t->position[0]}, (float4){0, 1, 0, t->position[1]}, (float4){0, 0, 1, t->position[2]}, (float4){0, 0, 0, 1}, }; // Rotation matrix from euler angles float4x4 r = {0}; { float x_angle = t->rotation[0]; float y_angle = t->rotation[1]; float z_angle = t->rotation[2]; float4x4 rx = { (float4){1, 0, 0, 0}, (float4){0, cosf(x_angle), -sinf(x_angle), 0}, (float4){0, sinf(x_angle), cosf(x_angle), 0}, (float4){0, 0, 0, 1}, }; float4x4 ry = { (float4){cosf(y_angle), 0, sinf(y_angle), 0}, (float4){0, 1, 0, 0}, (float4){-sinf(y_angle), 0, cosf(y_angle), 0}, (float4){0, 0, 0, 1}, }; float4x4 rz = { (float4){cosf(z_angle), -sinf(z_angle), 0, 0}, (float4){sinf(z_angle), cosf(z_angle), 0, 0}, (float4){0, 0, 1, 0}, (float4){0, 0, 0, 1}, }; float4x4 temp = {0}; mulmf44(&rx, &ry, &temp); mulmf44(&temp, &rz, &r); } // Scale matrix float4x4 s = { (float4){t->scale[0], 0, 0, 0}, (float4){0, t->scale[1], 0, 0}, (float4){0, 0, t->scale[2], 0}, (float4){0, 0, 0, 1}, }; // Transformation matrix = r * p * s; float4x4 temp = {0}; mulmf44(&p, &r, &temp); mulmf44(&s, &temp, m); TracyCZoneEnd(ctx); } void look_forward(float4x4 *m, float3 pos, float3 forward, float3 up) { TracyCZoneN(ctx, "look_forward", true); TracyCZoneColor(ctx, TracyCategoryColorMath); assert(m); forward = normf3(forward); float3 right = crossf3(normf3(up), forward); up = crossf3(forward, right); *m = (float4x4){ (float4){right[0], right[1], right[2], -dotf3(right, pos)}, (float4){up[0], up[1], up[2], -dotf3(up, pos)}, (float4){forward[0], forward[1], forward[2], -dotf3(forward, pos)}, (float4){0, 0, 0, 1}, }; TracyCZoneEnd(ctx); } // Left-Handed void look_at(float4x4 *m, float3 pos, float3 target, float3 up) { assert(m); float3 forward = pos - target; look_forward(m, pos, forward, up); } // Left Handed void perspective(float4x4 *m, float fovy, float aspect, float zn, float zf) { assert(m); float focal_length = 1.0f / tanf(fovy * 0.5f); float m00 = focal_length / aspect; float m11 = -focal_length; float m22 = zn / (zf - zn); float m23 = zf * m22; *m = (float4x4){ (float4){m00, 0, 0, 0}, (float4){0, m11, 0, 0}, (float4){0, 0, m22, m23}, (float4){0, 0, -1, 0}, }; } #ifdef __clang__ #pragma clang diagnostic pop #endif
23.937931
79
0.51743
[ "transform" ]
7eafabb86be0ceea744140ad68f4be0406e450e5
322,801
h
C
MHD/FEniCS/MHD/Stabilised/SaddlePointForm/Test/SplitMatrix/ScottTest/MHDgenerator/ffc_form_eca19265a2ab59013b3209e1c7e9bf6a8033d711.h
wathen/PhD
35524f40028541a4d611d8c78574e4cf9ddc3278
[ "MIT" ]
3
2020-10-25T13:30:20.000Z
2021-08-10T21:27:30.000Z
MHD/FEniCS/MHD/Stabilised/SaddlePointForm/Test/SplitMatrix/ScottTest/MHDgenerator/ffc_form_eca19265a2ab59013b3209e1c7e9bf6a8033d711.h
wathen/PhD
35524f40028541a4d611d8c78574e4cf9ddc3278
[ "MIT" ]
null
null
null
MHD/FEniCS/MHD/Stabilised/SaddlePointForm/Test/SplitMatrix/ScottTest/MHDgenerator/ffc_form_eca19265a2ab59013b3209e1c7e9bf6a8033d711.h
wathen/PhD
35524f40028541a4d611d8c78574e4cf9ddc3278
[ "MIT" ]
3
2019-10-28T16:12:13.000Z
2020-01-13T13:59:44.000Z
// This code conforms with the UFC specification version 1.6.0 // and was automatically generated by FFC version 1.6.0. // // This code was generated with the following parameters: // // convert_exceptions_to_warnings: False // cpp_optimize: True // cpp_optimize_flags: '-O2' // epsilon: 1e-14 // error_control: False // form_postfix: False // format: 'ufc' // name: 'ffc' // no-evaluate_basis_derivatives: True // optimize: False // precision: 15 // quadrature_degree: -1 // quadrature_rule: 'auto' // representation: 'auto' // restrict_keyword: '' // split: False #ifndef __FFC_FORM_ECA19265A2AB59013B3209E1C7E9BF6A8033D711_H #define __FFC_FORM_ECA19265A2AB59013B3209E1C7E9BF6A8033D711_H #include <cmath> #include <stdexcept> #include <fstream> #include <ufc.h> /// This class defines the interface for a finite element. class ffc_form_eca19265a2ab59013b3209e1c7e9bf6a8033d711_finite_element_0: public ufc::finite_element { public: /// Constructor ffc_form_eca19265a2ab59013b3209e1c7e9bf6a8033d711_finite_element_0() : ufc::finite_element() { // Do nothing } /// Destructor virtual ~ffc_form_eca19265a2ab59013b3209e1c7e9bf6a8033d711_finite_element_0() { // Do nothing } /// Return a string identifying the finite element virtual const char* signature() const { return "FiniteElement('Nedelec 1st kind H(curl)', Domain(Cell('tetrahedron', 3)), 1, None)"; } /// Return the cell shape virtual ufc::shape cell_shape() const { return ufc::tetrahedron; } /// Return the topological dimension of the cell shape virtual std::size_t topological_dimension() const { return 3; } /// Return the geometric dimension of the cell shape virtual std::size_t geometric_dimension() const { return 3; } /// Return the dimension of the finite element function space virtual std::size_t space_dimension() const { return 6; } /// Return the rank of the value space virtual std::size_t value_rank() const { return 1; } /// Return the dimension of the value space for axis i virtual std::size_t value_dimension(std::size_t i) const { switch (i) { case 0: { return 3; break; } } return 0; } /// Evaluate basis function i at given point x in cell (actual implementation) static void _evaluate_basis(std::size_t i, double* values, const double* x, const double* vertex_coordinates, int cell_orientation) { // Compute Jacobian double J[9]; compute_jacobian_tetrahedron_3d(J, vertex_coordinates); // Compute Jacobian inverse and determinant double K[9]; double detJ; compute_jacobian_inverse_tetrahedron_3d(K, detJ, J); // Compute constants const double C0 = vertex_coordinates[9] + vertex_coordinates[6] + vertex_coordinates[3] - vertex_coordinates[0]; const double C1 = vertex_coordinates[10] + vertex_coordinates[7] + vertex_coordinates[4] - vertex_coordinates[1]; const double C2 = vertex_coordinates[11] + vertex_coordinates[8] + vertex_coordinates[5] - vertex_coordinates[2]; // Compute subdeterminants const double d_00 = J[4]*J[8] - J[5]*J[7]; const double d_01 = J[5]*J[6] - J[3]*J[8]; const double d_02 = J[3]*J[7] - J[4]*J[6]; const double d_10 = J[2]*J[7] - J[1]*J[8]; const double d_11 = J[0]*J[8] - J[2]*J[6]; const double d_12 = J[1]*J[6] - J[0]*J[7]; const double d_20 = J[1]*J[5] - J[2]*J[4]; const double d_21 = J[2]*J[3] - J[0]*J[5]; const double d_22 = J[0]*J[4] - J[1]*J[3]; // Get coordinates and map to the reference (FIAT) element double X = (d_00*(2.0*x[0] - C0) + d_10*(2.0*x[1] - C1) + d_20*(2.0*x[2] - C2)) / detJ; double Y = (d_01*(2.0*x[0] - C0) + d_11*(2.0*x[1] - C1) + d_21*(2.0*x[2] - C2)) / detJ; double Z = (d_02*(2.0*x[0] - C0) + d_12*(2.0*x[1] - C1) + d_22*(2.0*x[2] - C2)) / detJ; // Reset values values[0] = 0.0; values[1] = 0.0; values[2] = 0.0; switch (i) { case 0: { // Array of basisvalues double basisvalues[4] = {0.0, 0.0, 0.0, 0.0}; // Declare helper variables double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X); // Compute basisvalues basisvalues[0] = 1.0; basisvalues[1] = tmp0; basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0]; basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0]; basisvalues[0] *= std::sqrt(0.75); basisvalues[3] *= std::sqrt(1.25); basisvalues[2] *= std::sqrt(2.5); basisvalues[1] *= std::sqrt(7.5); // Table(s) of coefficients static const double coefficients0[4] = \ {0.0, 0.0, 0.0, 0.0}; static const double coefficients1[4] = \ {-0.288675134594813, 0.0, 0.0, -0.223606797749979}; static const double coefficients2[4] = \ {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993}; // Compute value(s) for (unsigned int r = 0; r < 4; r++) { values[0] += coefficients0[r]*basisvalues[r]; values[1] += coefficients1[r]*basisvalues[r]; values[2] += coefficients2[r]*basisvalues[r]; } // end loop over 'r' // Using covariant Piola transform to map values back to the physical element const double tmp_ref0 = values[0]; const double tmp_ref1 = values[1]; const double tmp_ref2 = values[2]; values[0] = (K[0]*tmp_ref0 + K[3]*tmp_ref1 + K[6]*tmp_ref2); values[1] = (K[1]*tmp_ref0 + K[4]*tmp_ref1 + K[7]*tmp_ref2); values[2] = (K[2]*tmp_ref0 + K[5]*tmp_ref1 + K[8]*tmp_ref2); break; } case 1: { // Array of basisvalues double basisvalues[4] = {0.0, 0.0, 0.0, 0.0}; // Declare helper variables double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X); // Compute basisvalues basisvalues[0] = 1.0; basisvalues[1] = tmp0; basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0]; basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0]; basisvalues[0] *= std::sqrt(0.75); basisvalues[3] *= std::sqrt(1.25); basisvalues[2] *= std::sqrt(2.5); basisvalues[1] *= std::sqrt(7.5); // Table(s) of coefficients static const double coefficients0[4] = \ {-0.288675134594813, 0.0, 0.0, -0.223606797749979}; static const double coefficients1[4] = \ {0.0, 0.0, 0.0, 0.0}; static const double coefficients2[4] = \ {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993}; // Compute value(s) for (unsigned int r = 0; r < 4; r++) { values[0] += coefficients0[r]*basisvalues[r]; values[1] += coefficients1[r]*basisvalues[r]; values[2] += coefficients2[r]*basisvalues[r]; } // end loop over 'r' // Using covariant Piola transform to map values back to the physical element const double tmp_ref0 = values[0]; const double tmp_ref1 = values[1]; const double tmp_ref2 = values[2]; values[0] = (K[0]*tmp_ref0 + K[3]*tmp_ref1 + K[6]*tmp_ref2); values[1] = (K[1]*tmp_ref0 + K[4]*tmp_ref1 + K[7]*tmp_ref2); values[2] = (K[2]*tmp_ref0 + K[5]*tmp_ref1 + K[8]*tmp_ref2); break; } case 2: { // Array of basisvalues double basisvalues[4] = {0.0, 0.0, 0.0, 0.0}; // Declare helper variables double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X); // Compute basisvalues basisvalues[0] = 1.0; basisvalues[1] = tmp0; basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0]; basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0]; basisvalues[0] *= std::sqrt(0.75); basisvalues[3] *= std::sqrt(1.25); basisvalues[2] *= std::sqrt(2.5); basisvalues[1] *= std::sqrt(7.5); // Table(s) of coefficients static const double coefficients0[4] = \ {-0.288675134594813, 0.0, -0.210818510677892, 0.074535599249993}; static const double coefficients1[4] = \ {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993}; static const double coefficients2[4] = \ {0.0, 0.0, 0.0, 0.0}; // Compute value(s) for (unsigned int r = 0; r < 4; r++) { values[0] += coefficients0[r]*basisvalues[r]; values[1] += coefficients1[r]*basisvalues[r]; values[2] += coefficients2[r]*basisvalues[r]; } // end loop over 'r' // Using covariant Piola transform to map values back to the physical element const double tmp_ref0 = values[0]; const double tmp_ref1 = values[1]; const double tmp_ref2 = values[2]; values[0] = (K[0]*tmp_ref0 + K[3]*tmp_ref1 + K[6]*tmp_ref2); values[1] = (K[1]*tmp_ref0 + K[4]*tmp_ref1 + K[7]*tmp_ref2); values[2] = (K[2]*tmp_ref0 + K[5]*tmp_ref1 + K[8]*tmp_ref2); break; } case 3: { // Array of basisvalues double basisvalues[4] = {0.0, 0.0, 0.0, 0.0}; // Declare helper variables double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X); // Compute basisvalues basisvalues[0] = 1.0; basisvalues[1] = tmp0; basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0]; basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0]; basisvalues[0] *= std::sqrt(0.75); basisvalues[3] *= std::sqrt(1.25); basisvalues[2] *= std::sqrt(2.5); basisvalues[1] *= std::sqrt(7.5); // Table(s) of coefficients static const double coefficients0[4] = \ {0.288675134594813, 0.0, 0.0, 0.223606797749979}; static const double coefficients1[4] = \ {0.288675134594813, 0.0, 0.0, 0.223606797749979}; static const double coefficients2[4] = \ {0.577350269189626, -0.182574185835055, -0.105409255338946, 0.149071198499986}; // Compute value(s) for (unsigned int r = 0; r < 4; r++) { values[0] += coefficients0[r]*basisvalues[r]; values[1] += coefficients1[r]*basisvalues[r]; values[2] += coefficients2[r]*basisvalues[r]; } // end loop over 'r' // Using covariant Piola transform to map values back to the physical element const double tmp_ref0 = values[0]; const double tmp_ref1 = values[1]; const double tmp_ref2 = values[2]; values[0] = (K[0]*tmp_ref0 + K[3]*tmp_ref1 + K[6]*tmp_ref2); values[1] = (K[1]*tmp_ref0 + K[4]*tmp_ref1 + K[7]*tmp_ref2); values[2] = (K[2]*tmp_ref0 + K[5]*tmp_ref1 + K[8]*tmp_ref2); break; } case 4: { // Array of basisvalues double basisvalues[4] = {0.0, 0.0, 0.0, 0.0}; // Declare helper variables double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X); // Compute basisvalues basisvalues[0] = 1.0; basisvalues[1] = tmp0; basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0]; basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0]; basisvalues[0] *= std::sqrt(0.75); basisvalues[3] *= std::sqrt(1.25); basisvalues[2] *= std::sqrt(2.5); basisvalues[1] *= std::sqrt(7.5); // Table(s) of coefficients static const double coefficients0[4] = \ {0.288675134594813, 0.0, 0.210818510677892, -0.0745355992499929}; static const double coefficients1[4] = \ {0.577350269189626, -0.182574185835055, 0.105409255338946, -0.149071198499986}; static const double coefficients2[4] = \ {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993}; // Compute value(s) for (unsigned int r = 0; r < 4; r++) { values[0] += coefficients0[r]*basisvalues[r]; values[1] += coefficients1[r]*basisvalues[r]; values[2] += coefficients2[r]*basisvalues[r]; } // end loop over 'r' // Using covariant Piola transform to map values back to the physical element const double tmp_ref0 = values[0]; const double tmp_ref1 = values[1]; const double tmp_ref2 = values[2]; values[0] = (K[0]*tmp_ref0 + K[3]*tmp_ref1 + K[6]*tmp_ref2); values[1] = (K[1]*tmp_ref0 + K[4]*tmp_ref1 + K[7]*tmp_ref2); values[2] = (K[2]*tmp_ref0 + K[5]*tmp_ref1 + K[8]*tmp_ref2); break; } case 5: { // Array of basisvalues double basisvalues[4] = {0.0, 0.0, 0.0, 0.0}; // Declare helper variables double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X); // Compute basisvalues basisvalues[0] = 1.0; basisvalues[1] = tmp0; basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0]; basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0]; basisvalues[0] *= std::sqrt(0.75); basisvalues[3] *= std::sqrt(1.25); basisvalues[2] *= std::sqrt(2.5); basisvalues[1] *= std::sqrt(7.5); // Table(s) of coefficients static const double coefficients0[4] = \ {0.577350269189626, 0.0, -0.210818510677892, -0.149071198499986}; static const double coefficients1[4] = \ {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.0745355992499929}; static const double coefficients2[4] = \ {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993}; // Compute value(s) for (unsigned int r = 0; r < 4; r++) { values[0] += coefficients0[r]*basisvalues[r]; values[1] += coefficients1[r]*basisvalues[r]; values[2] += coefficients2[r]*basisvalues[r]; } // end loop over 'r' // Using covariant Piola transform to map values back to the physical element const double tmp_ref0 = values[0]; const double tmp_ref1 = values[1]; const double tmp_ref2 = values[2]; values[0] = (K[0]*tmp_ref0 + K[3]*tmp_ref1 + K[6]*tmp_ref2); values[1] = (K[1]*tmp_ref0 + K[4]*tmp_ref1 + K[7]*tmp_ref2); values[2] = (K[2]*tmp_ref0 + K[5]*tmp_ref1 + K[8]*tmp_ref2); break; } } } /// Evaluate basis function i at given point x in cell (non-static member function) virtual void evaluate_basis(std::size_t i, double* values, const double* x, const double* vertex_coordinates, int cell_orientation) const { _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation); } /// Evaluate all basis functions at given point x in cell (actual implementation) static void _evaluate_basis_all(double* values, const double* x, const double* vertex_coordinates, int cell_orientation) { // Helper variable to hold values of a single dof. double dof_values[3] = {0.0, 0.0, 0.0}; // Loop dofs and call evaluate_basis for (unsigned int r = 0; r < 6; r++) { _evaluate_basis(r, dof_values, x, vertex_coordinates, cell_orientation); for (unsigned int s = 0; s < 3; s++) { values[r*3 + s] = dof_values[s]; } // end loop over 's' } // end loop over 'r' } /// Evaluate all basis functions at given point x in cell (non-static member function) virtual void evaluate_basis_all(double* values, const double* x, const double* vertex_coordinates, int cell_orientation) const { _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation); } /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation) static void _evaluate_basis_derivatives(std::size_t i, std::size_t n, double* values, const double* x, const double* vertex_coordinates, int cell_orientation) { throw std::runtime_error("// Function evaluate_basis_derivatives not generated (compiled with -fno-evaluate_basis_derivatives)"); } /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function) virtual void evaluate_basis_derivatives(std::size_t i, std::size_t n, double* values, const double* x, const double* vertex_coordinates, int cell_orientation) const { _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation); } /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation) static void _evaluate_basis_derivatives_all(std::size_t n, double* values, const double* x, const double* vertex_coordinates, int cell_orientation) { // Call evaluate_basis_all if order of derivatives is equal to zero. if (n == 0) { _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation); return ; } // Compute number of derivatives. unsigned int num_derivatives = 1; for (unsigned int r = 0; r < n; r++) { num_derivatives *= 3; } // end loop over 'r' // Set values equal to zero. for (unsigned int r = 0; r < 6; r++) { for (unsigned int s = 0; s < 3*num_derivatives; s++) { values[r*3*num_derivatives + s] = 0.0; } // end loop over 's' } // end loop over 'r' // If order of derivatives is greater than the maximum polynomial degree, return zeros. if (n > 1) { return ; } // Helper variable to hold values of a single dof. double dof_values[9]; for (unsigned int r = 0; r < 9; r++) { dof_values[r] = 0.0; } // end loop over 'r' // Loop dofs and call evaluate_basis_derivatives. for (unsigned int r = 0; r < 6; r++) { _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation); for (unsigned int s = 0; s < 3*num_derivatives; s++) { values[r*3*num_derivatives + s] = dof_values[s]; } // end loop over 's' } // end loop over 'r' } /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function) virtual void evaluate_basis_derivatives_all(std::size_t n, double* values, const double* x, const double* vertex_coordinates, int cell_orientation) const { _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation); } /// Evaluate linear functional for dof i on the function f virtual double evaluate_dof(std::size_t i, const ufc::function& f, const double* vertex_coordinates, int cell_orientation, const ufc::cell& c) const { // Declare variables for result of evaluation double vals[3]; // Declare variable for physical coordinates double y[3]; double result; // Compute Jacobian double J[9]; compute_jacobian_tetrahedron_3d(J, vertex_coordinates); switch (i) { case 0: { y[0] = 0.5*vertex_coordinates[6] + 0.5*vertex_coordinates[9]; y[1] = 0.5*vertex_coordinates[7] + 0.5*vertex_coordinates[10]; y[2] = 0.5*vertex_coordinates[8] + 0.5*vertex_coordinates[11]; f.evaluate(vals, y, c); result = (-1.0)*(J[1]*vals[0] + J[4]*vals[1] + J[7]*vals[2]) + (J[2]*vals[0] + J[5]*vals[1] + J[8]*vals[2]); return result; break; } case 1: { y[0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[9]; y[1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[10]; y[2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[11]; f.evaluate(vals, y, c); result = (-1.0)*(J[0]*vals[0] + J[3]*vals[1] + J[6]*vals[2]) + (J[2]*vals[0] + J[5]*vals[1] + J[8]*vals[2]); return result; break; } case 2: { y[0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[6]; y[1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[7]; y[2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[8]; f.evaluate(vals, y, c); result = (-1.0)*(J[0]*vals[0] + J[3]*vals[1] + J[6]*vals[2]) + (J[1]*vals[0] + J[4]*vals[1] + J[7]*vals[2]); return result; break; } case 3: { y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[9]; y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[10]; y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[11]; f.evaluate(vals, y, c); result = (J[2]*vals[0] + J[5]*vals[1] + J[8]*vals[2]); return result; break; } case 4: { y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[6]; y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[7]; y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[8]; f.evaluate(vals, y, c); result = (J[1]*vals[0] + J[4]*vals[1] + J[7]*vals[2]); return result; break; } case 5: { y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[3]; y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[4]; y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[5]; f.evaluate(vals, y, c); result = (J[0]*vals[0] + J[3]*vals[1] + J[6]*vals[2]); return result; break; } } return 0.0; } /// Evaluate linear functionals for all dofs on the function f virtual void evaluate_dofs(double* values, const ufc::function& f, const double* vertex_coordinates, int cell_orientation, const ufc::cell& c) const { // Declare variables for result of evaluation double vals[3]; // Declare variable for physical coordinates double y[3]; double result; // Compute Jacobian double J[9]; compute_jacobian_tetrahedron_3d(J, vertex_coordinates); y[0] = 0.5*vertex_coordinates[6] + 0.5*vertex_coordinates[9]; y[1] = 0.5*vertex_coordinates[7] + 0.5*vertex_coordinates[10]; y[2] = 0.5*vertex_coordinates[8] + 0.5*vertex_coordinates[11]; f.evaluate(vals, y, c); result = (-1.0)*(J[1]*vals[0] + J[4]*vals[1] + J[7]*vals[2]) + (J[2]*vals[0] + J[5]*vals[1] + J[8]*vals[2]); values[0] = result; y[0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[9]; y[1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[10]; y[2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[11]; f.evaluate(vals, y, c); result = (-1.0)*(J[0]*vals[0] + J[3]*vals[1] + J[6]*vals[2]) + (J[2]*vals[0] + J[5]*vals[1] + J[8]*vals[2]); values[1] = result; y[0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[6]; y[1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[7]; y[2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[8]; f.evaluate(vals, y, c); result = (-1.0)*(J[0]*vals[0] + J[3]*vals[1] + J[6]*vals[2]) + (J[1]*vals[0] + J[4]*vals[1] + J[7]*vals[2]); values[2] = result; y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[9]; y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[10]; y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[11]; f.evaluate(vals, y, c); result = (J[2]*vals[0] + J[5]*vals[1] + J[8]*vals[2]); values[3] = result; y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[6]; y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[7]; y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[8]; f.evaluate(vals, y, c); result = (J[1]*vals[0] + J[4]*vals[1] + J[7]*vals[2]); values[4] = result; y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[3]; y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[4]; y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[5]; f.evaluate(vals, y, c); result = (J[0]*vals[0] + J[3]*vals[1] + J[6]*vals[2]); values[5] = result; } /// Interpolate vertex values from dof values virtual void interpolate_vertex_values(double* vertex_values, const double* dof_values, const double* vertex_coordinates, int cell_orientation, const ufc::cell& c) const { // Compute Jacobian double J[9]; compute_jacobian_tetrahedron_3d(J, vertex_coordinates); // Compute Jacobian inverse and determinant double K[9]; double detJ; compute_jacobian_inverse_tetrahedron_3d(K, detJ, J); // Evaluate function and change variables vertex_values[0] = dof_values[3]*K[6] + dof_values[4]*K[3] + dof_values[5]*K[0]; vertex_values[3] = dof_values[1]*K[6] + dof_values[2]*K[3] + dof_values[5]*(K[0] + K[3] + K[6]); vertex_values[6] = dof_values[0]*K[6] + dof_values[2]*(K[0]*(-1.0)) + dof_values[4]*(K[0] + K[3] + K[6]); vertex_values[9] = dof_values[0]*(K[3]*(-1.0)) + dof_values[1]*(K[0]*(-1.0)) + dof_values[3]*(K[0] + K[3] + K[6]); vertex_values[1] = dof_values[3]*K[7] + dof_values[4]*K[4] + dof_values[5]*K[1]; vertex_values[4] = dof_values[1]*K[7] + dof_values[2]*K[4] + dof_values[5]*(K[1] + K[4] + K[7]); vertex_values[7] = dof_values[0]*K[7] + dof_values[2]*(K[1]*(-1.0)) + dof_values[4]*(K[1] + K[4] + K[7]); vertex_values[10] = dof_values[0]*(K[4]*(-1.0)) + dof_values[1]*(K[1]*(-1.0)) + dof_values[3]*(K[1] + K[4] + K[7]); vertex_values[2] = dof_values[3]*K[8] + dof_values[4]*K[5] + dof_values[5]*K[2]; vertex_values[5] = dof_values[1]*K[8] + dof_values[2]*K[5] + dof_values[5]*(K[2] + K[5] + K[8]); vertex_values[8] = dof_values[0]*K[8] + dof_values[2]*(K[2]*(-1.0)) + dof_values[4]*(K[2] + K[5] + K[8]); vertex_values[11] = dof_values[0]*(K[5]*(-1.0)) + dof_values[1]*(K[2]*(-1.0)) + dof_values[3]*(K[2] + K[5] + K[8]); } /// Map coordinate xhat from reference cell to coordinate x in cell virtual void map_from_reference_cell(double* x, const double* xhat, const ufc::cell& c) const { throw std::runtime_error("map_from_reference_cell not yet implemented."); } /// Map from coordinate x in cell to coordinate xhat in reference cell virtual void map_to_reference_cell(double* xhat, const double* x, const ufc::cell& c) const { throw std::runtime_error("map_to_reference_cell not yet implemented."); } /// Return the number of sub elements (for a mixed element) virtual std::size_t num_sub_elements() const { return 0; } /// Create a new finite element for sub element i (for a mixed element) virtual ufc::finite_element* create_sub_element(std::size_t i) const { return 0; } /// Create a new class instance virtual ufc::finite_element* create() const { return new ffc_form_eca19265a2ab59013b3209e1c7e9bf6a8033d711_finite_element_0(); } }; /// This class defines the interface for a finite element. class ffc_form_eca19265a2ab59013b3209e1c7e9bf6a8033d711_finite_element_1: public ufc::finite_element { public: /// Constructor ffc_form_eca19265a2ab59013b3209e1c7e9bf6a8033d711_finite_element_1() : ufc::finite_element() { // Do nothing } /// Destructor virtual ~ffc_form_eca19265a2ab59013b3209e1c7e9bf6a8033d711_finite_element_1() { // Do nothing } /// Return a string identifying the finite element virtual const char* signature() const { return "FiniteElement('Lagrange', Domain(Cell('tetrahedron', 3)), 2, None)"; } /// Return the cell shape virtual ufc::shape cell_shape() const { return ufc::tetrahedron; } /// Return the topological dimension of the cell shape virtual std::size_t topological_dimension() const { return 3; } /// Return the geometric dimension of the cell shape virtual std::size_t geometric_dimension() const { return 3; } /// Return the dimension of the finite element function space virtual std::size_t space_dimension() const { return 10; } /// Return the rank of the value space virtual std::size_t value_rank() const { return 0; } /// Return the dimension of the value space for axis i virtual std::size_t value_dimension(std::size_t i) const { return 1; } /// Evaluate basis function i at given point x in cell (actual implementation) static void _evaluate_basis(std::size_t i, double* values, const double* x, const double* vertex_coordinates, int cell_orientation) { // Compute Jacobian double J[9]; compute_jacobian_tetrahedron_3d(J, vertex_coordinates); // Compute Jacobian inverse and determinant double K[9]; double detJ; compute_jacobian_inverse_tetrahedron_3d(K, detJ, J); // Compute constants const double C0 = vertex_coordinates[9] + vertex_coordinates[6] + vertex_coordinates[3] - vertex_coordinates[0]; const double C1 = vertex_coordinates[10] + vertex_coordinates[7] + vertex_coordinates[4] - vertex_coordinates[1]; const double C2 = vertex_coordinates[11] + vertex_coordinates[8] + vertex_coordinates[5] - vertex_coordinates[2]; // Compute subdeterminants const double d_00 = J[4]*J[8] - J[5]*J[7]; const double d_01 = J[5]*J[6] - J[3]*J[8]; const double d_02 = J[3]*J[7] - J[4]*J[6]; const double d_10 = J[2]*J[7] - J[1]*J[8]; const double d_11 = J[0]*J[8] - J[2]*J[6]; const double d_12 = J[1]*J[6] - J[0]*J[7]; const double d_20 = J[1]*J[5] - J[2]*J[4]; const double d_21 = J[2]*J[3] - J[0]*J[5]; const double d_22 = J[0]*J[4] - J[1]*J[3]; // Get coordinates and map to the reference (FIAT) element double X = (d_00*(2.0*x[0] - C0) + d_10*(2.0*x[1] - C1) + d_20*(2.0*x[2] - C2)) / detJ; double Y = (d_01*(2.0*x[0] - C0) + d_11*(2.0*x[1] - C1) + d_21*(2.0*x[2] - C2)) / detJ; double Z = (d_02*(2.0*x[0] - C0) + d_12*(2.0*x[1] - C1) + d_22*(2.0*x[2] - C2)) / detJ; // Reset values *values = 0.0; switch (i) { case 0: { // Array of basisvalues double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; // Declare helper variables double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X); double tmp1 = 0.25*(Y + Z)*(Y + Z); double tmp2 = 0.5*(1.0 + Z + 2.0*Y); double tmp3 = 0.5*(1.0 - Z); double tmp4 = tmp3*tmp3; // Compute basisvalues basisvalues[0] = 1.0; basisvalues[1] = tmp0; basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0]; basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0]; basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1]; basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0]; basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0]; basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2]; basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1]; basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0]; basisvalues[0] *= std::sqrt(0.75); basisvalues[3] *= std::sqrt(1.25); basisvalues[9] *= std::sqrt(1.75); basisvalues[2] *= std::sqrt(2.5); basisvalues[8] *= std::sqrt(3.5); basisvalues[7] *= std::sqrt(5.25); basisvalues[1] *= std::sqrt(7.5); basisvalues[6] *= std::sqrt(10.5); basisvalues[5] *= std::sqrt(15.75); basisvalues[4] *= std::sqrt(26.25); // Table(s) of coefficients static const double coefficients0[10] = \ {-0.0577350269189625, -0.0608580619450185, -0.0351364184463153, -0.0248451997499977, 0.0650600048632355, 0.050395263067897, 0.0411475599898912, 0.0290957186981323, 0.0237565548366599, 0.0167984210226323}; // Compute value(s) for (unsigned int r = 0; r < 10; r++) { *values += coefficients0[r]*basisvalues[r]; } // end loop over 'r' break; } case 1: { // Array of basisvalues double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; // Declare helper variables double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X); double tmp1 = 0.25*(Y + Z)*(Y + Z); double tmp2 = 0.5*(1.0 + Z + 2.0*Y); double tmp3 = 0.5*(1.0 - Z); double tmp4 = tmp3*tmp3; // Compute basisvalues basisvalues[0] = 1.0; basisvalues[1] = tmp0; basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0]; basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0]; basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1]; basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0]; basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0]; basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2]; basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1]; basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0]; basisvalues[0] *= std::sqrt(0.75); basisvalues[3] *= std::sqrt(1.25); basisvalues[9] *= std::sqrt(1.75); basisvalues[2] *= std::sqrt(2.5); basisvalues[8] *= std::sqrt(3.5); basisvalues[7] *= std::sqrt(5.25); basisvalues[1] *= std::sqrt(7.5); basisvalues[6] *= std::sqrt(10.5); basisvalues[5] *= std::sqrt(15.75); basisvalues[4] *= std::sqrt(26.25); // Table(s) of coefficients static const double coefficients0[10] = \ {-0.0577350269189625, 0.0608580619450185, -0.0351364184463153, -0.0248451997499977, 0.0650600048632355, -0.050395263067897, -0.0411475599898912, 0.0290957186981323, 0.0237565548366599, 0.0167984210226323}; // Compute value(s) for (unsigned int r = 0; r < 10; r++) { *values += coefficients0[r]*basisvalues[r]; } // end loop over 'r' break; } case 2: { // Array of basisvalues double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; // Declare helper variables double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X); double tmp1 = 0.25*(Y + Z)*(Y + Z); double tmp2 = 0.5*(1.0 + Z + 2.0*Y); double tmp3 = 0.5*(1.0 - Z); double tmp4 = tmp3*tmp3; // Compute basisvalues basisvalues[0] = 1.0; basisvalues[1] = tmp0; basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0]; basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0]; basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1]; basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0]; basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0]; basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2]; basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1]; basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0]; basisvalues[0] *= std::sqrt(0.75); basisvalues[3] *= std::sqrt(1.25); basisvalues[9] *= std::sqrt(1.75); basisvalues[2] *= std::sqrt(2.5); basisvalues[8] *= std::sqrt(3.5); basisvalues[7] *= std::sqrt(5.25); basisvalues[1] *= std::sqrt(7.5); basisvalues[6] *= std::sqrt(10.5); basisvalues[5] *= std::sqrt(15.75); basisvalues[4] *= std::sqrt(26.25); // Table(s) of coefficients static const double coefficients0[10] = \ {-0.0577350269189625, 0.0, 0.0702728368926306, -0.0248451997499977, 0.0, 0.0, 0.0, 0.0872871560943969, -0.0475131096733199, 0.0167984210226323}; // Compute value(s) for (unsigned int r = 0; r < 10; r++) { *values += coefficients0[r]*basisvalues[r]; } // end loop over 'r' break; } case 3: { // Array of basisvalues double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; // Declare helper variables double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X); double tmp1 = 0.25*(Y + Z)*(Y + Z); double tmp2 = 0.5*(1.0 + Z + 2.0*Y); double tmp3 = 0.5*(1.0 - Z); double tmp4 = tmp3*tmp3; // Compute basisvalues basisvalues[0] = 1.0; basisvalues[1] = tmp0; basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0]; basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0]; basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1]; basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0]; basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0]; basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2]; basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1]; basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0]; basisvalues[0] *= std::sqrt(0.75); basisvalues[3] *= std::sqrt(1.25); basisvalues[9] *= std::sqrt(1.75); basisvalues[2] *= std::sqrt(2.5); basisvalues[8] *= std::sqrt(3.5); basisvalues[7] *= std::sqrt(5.25); basisvalues[1] *= std::sqrt(7.5); basisvalues[6] *= std::sqrt(10.5); basisvalues[5] *= std::sqrt(15.75); basisvalues[4] *= std::sqrt(26.25); // Table(s) of coefficients static const double coefficients0[10] = \ {-0.0577350269189626, 0.0, 0.0, 0.074535599249993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.100790526135794}; // Compute value(s) for (unsigned int r = 0; r < 10; r++) { *values += coefficients0[r]*basisvalues[r]; } // end loop over 'r' break; } case 4: { // Array of basisvalues double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; // Declare helper variables double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X); double tmp1 = 0.25*(Y + Z)*(Y + Z); double tmp2 = 0.5*(1.0 + Z + 2.0*Y); double tmp3 = 0.5*(1.0 - Z); double tmp4 = tmp3*tmp3; // Compute basisvalues basisvalues[0] = 1.0; basisvalues[1] = tmp0; basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0]; basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0]; basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1]; basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0]; basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0]; basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2]; basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1]; basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0]; basisvalues[0] *= std::sqrt(0.75); basisvalues[3] *= std::sqrt(1.25); basisvalues[9] *= std::sqrt(1.75); basisvalues[2] *= std::sqrt(2.5); basisvalues[8] *= std::sqrt(3.5); basisvalues[7] *= std::sqrt(5.25); basisvalues[1] *= std::sqrt(7.5); basisvalues[6] *= std::sqrt(10.5); basisvalues[5] *= std::sqrt(15.75); basisvalues[4] *= std::sqrt(26.25); // Table(s) of coefficients static const double coefficients0[10] = \ {0.23094010767585, 0.0, 0.140545673785261, 0.0993807989999906, 0.0, 0.0, 0.0, 0.0, 0.1187827741833, -0.0671936840905293}; // Compute value(s) for (unsigned int r = 0; r < 10; r++) { *values += coefficients0[r]*basisvalues[r]; } // end loop over 'r' break; } case 5: { // Array of basisvalues double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; // Declare helper variables double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X); double tmp1 = 0.25*(Y + Z)*(Y + Z); double tmp2 = 0.5*(1.0 + Z + 2.0*Y); double tmp3 = 0.5*(1.0 - Z); double tmp4 = tmp3*tmp3; // Compute basisvalues basisvalues[0] = 1.0; basisvalues[1] = tmp0; basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0]; basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0]; basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1]; basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0]; basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0]; basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2]; basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1]; basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0]; basisvalues[0] *= std::sqrt(0.75); basisvalues[3] *= std::sqrt(1.25); basisvalues[9] *= std::sqrt(1.75); basisvalues[2] *= std::sqrt(2.5); basisvalues[8] *= std::sqrt(3.5); basisvalues[7] *= std::sqrt(5.25); basisvalues[1] *= std::sqrt(7.5); basisvalues[6] *= std::sqrt(10.5); basisvalues[5] *= std::sqrt(15.75); basisvalues[4] *= std::sqrt(26.25); // Table(s) of coefficients static const double coefficients0[10] = \ {0.23094010767585, 0.121716123890037, -0.0702728368926306, 0.0993807989999907, 0.0, 0.0, 0.102868899974728, 0.0, -0.0593913870916499, -0.0671936840905293}; // Compute value(s) for (unsigned int r = 0; r < 10; r++) { *values += coefficients0[r]*basisvalues[r]; } // end loop over 'r' break; } case 6: { // Array of basisvalues double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; // Declare helper variables double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X); double tmp1 = 0.25*(Y + Z)*(Y + Z); double tmp2 = 0.5*(1.0 + Z + 2.0*Y); double tmp3 = 0.5*(1.0 - Z); double tmp4 = tmp3*tmp3; // Compute basisvalues basisvalues[0] = 1.0; basisvalues[1] = tmp0; basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0]; basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0]; basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1]; basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0]; basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0]; basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2]; basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1]; basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0]; basisvalues[0] *= std::sqrt(0.75); basisvalues[3] *= std::sqrt(1.25); basisvalues[9] *= std::sqrt(1.75); basisvalues[2] *= std::sqrt(2.5); basisvalues[8] *= std::sqrt(3.5); basisvalues[7] *= std::sqrt(5.25); basisvalues[1] *= std::sqrt(7.5); basisvalues[6] *= std::sqrt(10.5); basisvalues[5] *= std::sqrt(15.75); basisvalues[4] *= std::sqrt(26.25); // Table(s) of coefficients static const double coefficients0[10] = \ {0.23094010767585, 0.121716123890037, 0.0702728368926307, -0.0993807989999907, 0.0, 0.100790526135794, -0.0205737799949456, -0.087287156094397, -0.01187827741833, 0.0167984210226323}; // Compute value(s) for (unsigned int r = 0; r < 10; r++) { *values += coefficients0[r]*basisvalues[r]; } // end loop over 'r' break; } case 7: { // Array of basisvalues double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; // Declare helper variables double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X); double tmp1 = 0.25*(Y + Z)*(Y + Z); double tmp2 = 0.5*(1.0 + Z + 2.0*Y); double tmp3 = 0.5*(1.0 - Z); double tmp4 = tmp3*tmp3; // Compute basisvalues basisvalues[0] = 1.0; basisvalues[1] = tmp0; basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0]; basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0]; basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1]; basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0]; basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0]; basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2]; basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1]; basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0]; basisvalues[0] *= std::sqrt(0.75); basisvalues[3] *= std::sqrt(1.25); basisvalues[9] *= std::sqrt(1.75); basisvalues[2] *= std::sqrt(2.5); basisvalues[8] *= std::sqrt(3.5); basisvalues[7] *= std::sqrt(5.25); basisvalues[1] *= std::sqrt(7.5); basisvalues[6] *= std::sqrt(10.5); basisvalues[5] *= std::sqrt(15.75); basisvalues[4] *= std::sqrt(26.25); // Table(s) of coefficients static const double coefficients0[10] = \ {0.23094010767585, -0.121716123890037, -0.0702728368926307, 0.0993807989999906, 0.0, 0.0, -0.102868899974728, 0.0, -0.0593913870916499, -0.0671936840905293}; // Compute value(s) for (unsigned int r = 0; r < 10; r++) { *values += coefficients0[r]*basisvalues[r]; } // end loop over 'r' break; } case 8: { // Array of basisvalues double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; // Declare helper variables double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X); double tmp1 = 0.25*(Y + Z)*(Y + Z); double tmp2 = 0.5*(1.0 + Z + 2.0*Y); double tmp3 = 0.5*(1.0 - Z); double tmp4 = tmp3*tmp3; // Compute basisvalues basisvalues[0] = 1.0; basisvalues[1] = tmp0; basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0]; basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0]; basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1]; basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0]; basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0]; basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2]; basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1]; basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0]; basisvalues[0] *= std::sqrt(0.75); basisvalues[3] *= std::sqrt(1.25); basisvalues[9] *= std::sqrt(1.75); basisvalues[2] *= std::sqrt(2.5); basisvalues[8] *= std::sqrt(3.5); basisvalues[7] *= std::sqrt(5.25); basisvalues[1] *= std::sqrt(7.5); basisvalues[6] *= std::sqrt(10.5); basisvalues[5] *= std::sqrt(15.75); basisvalues[4] *= std::sqrt(26.25); // Table(s) of coefficients static const double coefficients0[10] = \ {0.23094010767585, -0.121716123890037, 0.0702728368926306, -0.0993807989999907, 0.0, -0.100790526135794, 0.0205737799949456, -0.0872871560943969, -0.01187827741833, 0.0167984210226323}; // Compute value(s) for (unsigned int r = 0; r < 10; r++) { *values += coefficients0[r]*basisvalues[r]; } // end loop over 'r' break; } case 9: { // Array of basisvalues double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; // Declare helper variables double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X); double tmp1 = 0.25*(Y + Z)*(Y + Z); double tmp2 = 0.5*(1.0 + Z + 2.0*Y); double tmp3 = 0.5*(1.0 - Z); double tmp4 = tmp3*tmp3; // Compute basisvalues basisvalues[0] = 1.0; basisvalues[1] = tmp0; basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0]; basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0]; basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1]; basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0]; basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0]; basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2]; basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1]; basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0]; basisvalues[0] *= std::sqrt(0.75); basisvalues[3] *= std::sqrt(1.25); basisvalues[9] *= std::sqrt(1.75); basisvalues[2] *= std::sqrt(2.5); basisvalues[8] *= std::sqrt(3.5); basisvalues[7] *= std::sqrt(5.25); basisvalues[1] *= std::sqrt(7.5); basisvalues[6] *= std::sqrt(10.5); basisvalues[5] *= std::sqrt(15.75); basisvalues[4] *= std::sqrt(26.25); // Table(s) of coefficients static const double coefficients0[10] = \ {0.23094010767585, 0.0, -0.140545673785261, -0.0993807989999906, -0.130120009726471, 0.0, 0.0, 0.0290957186981323, 0.02375655483666, 0.0167984210226323}; // Compute value(s) for (unsigned int r = 0; r < 10; r++) { *values += coefficients0[r]*basisvalues[r]; } // end loop over 'r' break; } } } /// Evaluate basis function i at given point x in cell (non-static member function) virtual void evaluate_basis(std::size_t i, double* values, const double* x, const double* vertex_coordinates, int cell_orientation) const { _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation); } /// Evaluate all basis functions at given point x in cell (actual implementation) static void _evaluate_basis_all(double* values, const double* x, const double* vertex_coordinates, int cell_orientation) { // Helper variable to hold values of a single dof. double dof_values = 0.0; // Loop dofs and call evaluate_basis for (unsigned int r = 0; r < 10; r++) { _evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation); values[r] = dof_values; } // end loop over 'r' } /// Evaluate all basis functions at given point x in cell (non-static member function) virtual void evaluate_basis_all(double* values, const double* x, const double* vertex_coordinates, int cell_orientation) const { _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation); } /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation) static void _evaluate_basis_derivatives(std::size_t i, std::size_t n, double* values, const double* x, const double* vertex_coordinates, int cell_orientation) { throw std::runtime_error("// Function evaluate_basis_derivatives not generated (compiled with -fno-evaluate_basis_derivatives)"); } /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function) virtual void evaluate_basis_derivatives(std::size_t i, std::size_t n, double* values, const double* x, const double* vertex_coordinates, int cell_orientation) const { _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation); } /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation) static void _evaluate_basis_derivatives_all(std::size_t n, double* values, const double* x, const double* vertex_coordinates, int cell_orientation) { // Call evaluate_basis_all if order of derivatives is equal to zero. if (n == 0) { _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation); return ; } // Compute number of derivatives. unsigned int num_derivatives = 1; for (unsigned int r = 0; r < n; r++) { num_derivatives *= 3; } // end loop over 'r' // Set values equal to zero. for (unsigned int r = 0; r < 10; r++) { for (unsigned int s = 0; s < num_derivatives; s++) { values[r*num_derivatives + s] = 0.0; } // end loop over 's' } // end loop over 'r' // If order of derivatives is greater than the maximum polynomial degree, return zeros. if (n > 2) { return ; } // Helper variable to hold values of a single dof. double dof_values[9]; for (unsigned int r = 0; r < 9; r++) { dof_values[r] = 0.0; } // end loop over 'r' // Loop dofs and call evaluate_basis_derivatives. for (unsigned int r = 0; r < 10; r++) { _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation); for (unsigned int s = 0; s < num_derivatives; s++) { values[r*num_derivatives + s] = dof_values[s]; } // end loop over 's' } // end loop over 'r' } /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function) virtual void evaluate_basis_derivatives_all(std::size_t n, double* values, const double* x, const double* vertex_coordinates, int cell_orientation) const { _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation); } /// Evaluate linear functional for dof i on the function f virtual double evaluate_dof(std::size_t i, const ufc::function& f, const double* vertex_coordinates, int cell_orientation, const ufc::cell& c) const { // Declare variables for result of evaluation double vals[1]; // Declare variable for physical coordinates double y[3]; switch (i) { case 0: { y[0] = vertex_coordinates[0]; y[1] = vertex_coordinates[1]; y[2] = vertex_coordinates[2]; f.evaluate(vals, y, c); return vals[0]; break; } case 1: { y[0] = vertex_coordinates[3]; y[1] = vertex_coordinates[4]; y[2] = vertex_coordinates[5]; f.evaluate(vals, y, c); return vals[0]; break; } case 2: { y[0] = vertex_coordinates[6]; y[1] = vertex_coordinates[7]; y[2] = vertex_coordinates[8]; f.evaluate(vals, y, c); return vals[0]; break; } case 3: { y[0] = vertex_coordinates[9]; y[1] = vertex_coordinates[10]; y[2] = vertex_coordinates[11]; f.evaluate(vals, y, c); return vals[0]; break; } case 4: { y[0] = 0.5*vertex_coordinates[6] + 0.5*vertex_coordinates[9]; y[1] = 0.5*vertex_coordinates[7] + 0.5*vertex_coordinates[10]; y[2] = 0.5*vertex_coordinates[8] + 0.5*vertex_coordinates[11]; f.evaluate(vals, y, c); return vals[0]; break; } case 5: { y[0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[9]; y[1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[10]; y[2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[11]; f.evaluate(vals, y, c); return vals[0]; break; } case 6: { y[0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[6]; y[1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[7]; y[2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[8]; f.evaluate(vals, y, c); return vals[0]; break; } case 7: { y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[9]; y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[10]; y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[11]; f.evaluate(vals, y, c); return vals[0]; break; } case 8: { y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[6]; y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[7]; y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[8]; f.evaluate(vals, y, c); return vals[0]; break; } case 9: { y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[3]; y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[4]; y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[5]; f.evaluate(vals, y, c); return vals[0]; break; } } return 0.0; } /// Evaluate linear functionals for all dofs on the function f virtual void evaluate_dofs(double* values, const ufc::function& f, const double* vertex_coordinates, int cell_orientation, const ufc::cell& c) const { // Declare variables for result of evaluation double vals[1]; // Declare variable for physical coordinates double y[3]; y[0] = vertex_coordinates[0]; y[1] = vertex_coordinates[1]; y[2] = vertex_coordinates[2]; f.evaluate(vals, y, c); values[0] = vals[0]; y[0] = vertex_coordinates[3]; y[1] = vertex_coordinates[4]; y[2] = vertex_coordinates[5]; f.evaluate(vals, y, c); values[1] = vals[0]; y[0] = vertex_coordinates[6]; y[1] = vertex_coordinates[7]; y[2] = vertex_coordinates[8]; f.evaluate(vals, y, c); values[2] = vals[0]; y[0] = vertex_coordinates[9]; y[1] = vertex_coordinates[10]; y[2] = vertex_coordinates[11]; f.evaluate(vals, y, c); values[3] = vals[0]; y[0] = 0.5*vertex_coordinates[6] + 0.5*vertex_coordinates[9]; y[1] = 0.5*vertex_coordinates[7] + 0.5*vertex_coordinates[10]; y[2] = 0.5*vertex_coordinates[8] + 0.5*vertex_coordinates[11]; f.evaluate(vals, y, c); values[4] = vals[0]; y[0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[9]; y[1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[10]; y[2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[11]; f.evaluate(vals, y, c); values[5] = vals[0]; y[0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[6]; y[1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[7]; y[2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[8]; f.evaluate(vals, y, c); values[6] = vals[0]; y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[9]; y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[10]; y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[11]; f.evaluate(vals, y, c); values[7] = vals[0]; y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[6]; y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[7]; y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[8]; f.evaluate(vals, y, c); values[8] = vals[0]; y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[3]; y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[4]; y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[5]; f.evaluate(vals, y, c); values[9] = vals[0]; } /// Interpolate vertex values from dof values virtual void interpolate_vertex_values(double* vertex_values, const double* dof_values, const double* vertex_coordinates, int cell_orientation, const ufc::cell& c) const { // Evaluate function and change variables vertex_values[0] = dof_values[0]; vertex_values[1] = dof_values[1]; vertex_values[2] = dof_values[2]; vertex_values[3] = dof_values[3]; } /// Map coordinate xhat from reference cell to coordinate x in cell virtual void map_from_reference_cell(double* x, const double* xhat, const ufc::cell& c) const { throw std::runtime_error("map_from_reference_cell not yet implemented."); } /// Map from coordinate x in cell to coordinate xhat in reference cell virtual void map_to_reference_cell(double* xhat, const double* x, const ufc::cell& c) const { throw std::runtime_error("map_to_reference_cell not yet implemented."); } /// Return the number of sub elements (for a mixed element) virtual std::size_t num_sub_elements() const { return 0; } /// Create a new finite element for sub element i (for a mixed element) virtual ufc::finite_element* create_sub_element(std::size_t i) const { return 0; } /// Create a new class instance virtual ufc::finite_element* create() const { return new ffc_form_eca19265a2ab59013b3209e1c7e9bf6a8033d711_finite_element_1(); } }; /// This class defines the interface for a finite element. class ffc_form_eca19265a2ab59013b3209e1c7e9bf6a8033d711_finite_element_2: public ufc::finite_element { public: /// Constructor ffc_form_eca19265a2ab59013b3209e1c7e9bf6a8033d711_finite_element_2() : ufc::finite_element() { // Do nothing } /// Destructor virtual ~ffc_form_eca19265a2ab59013b3209e1c7e9bf6a8033d711_finite_element_2() { // Do nothing } /// Return a string identifying the finite element virtual const char* signature() const { return "VectorElement('Lagrange', Domain(Cell('tetrahedron', 3)), 2, 3, None)"; } /// Return the cell shape virtual ufc::shape cell_shape() const { return ufc::tetrahedron; } /// Return the topological dimension of the cell shape virtual std::size_t topological_dimension() const { return 3; } /// Return the geometric dimension of the cell shape virtual std::size_t geometric_dimension() const { return 3; } /// Return the dimension of the finite element function space virtual std::size_t space_dimension() const { return 30; } /// Return the rank of the value space virtual std::size_t value_rank() const { return 1; } /// Return the dimension of the value space for axis i virtual std::size_t value_dimension(std::size_t i) const { switch (i) { case 0: { return 3; break; } } return 0; } /// Evaluate basis function i at given point x in cell (actual implementation) static void _evaluate_basis(std::size_t i, double* values, const double* x, const double* vertex_coordinates, int cell_orientation) { // Compute Jacobian double J[9]; compute_jacobian_tetrahedron_3d(J, vertex_coordinates); // Compute Jacobian inverse and determinant double K[9]; double detJ; compute_jacobian_inverse_tetrahedron_3d(K, detJ, J); // Compute constants const double C0 = vertex_coordinates[9] + vertex_coordinates[6] + vertex_coordinates[3] - vertex_coordinates[0]; const double C1 = vertex_coordinates[10] + vertex_coordinates[7] + vertex_coordinates[4] - vertex_coordinates[1]; const double C2 = vertex_coordinates[11] + vertex_coordinates[8] + vertex_coordinates[5] - vertex_coordinates[2]; // Compute subdeterminants const double d_00 = J[4]*J[8] - J[5]*J[7]; const double d_01 = J[5]*J[6] - J[3]*J[8]; const double d_02 = J[3]*J[7] - J[4]*J[6]; const double d_10 = J[2]*J[7] - J[1]*J[8]; const double d_11 = J[0]*J[8] - J[2]*J[6]; const double d_12 = J[1]*J[6] - J[0]*J[7]; const double d_20 = J[1]*J[5] - J[2]*J[4]; const double d_21 = J[2]*J[3] - J[0]*J[5]; const double d_22 = J[0]*J[4] - J[1]*J[3]; // Get coordinates and map to the reference (FIAT) element double X = (d_00*(2.0*x[0] - C0) + d_10*(2.0*x[1] - C1) + d_20*(2.0*x[2] - C2)) / detJ; double Y = (d_01*(2.0*x[0] - C0) + d_11*(2.0*x[1] - C1) + d_21*(2.0*x[2] - C2)) / detJ; double Z = (d_02*(2.0*x[0] - C0) + d_12*(2.0*x[1] - C1) + d_22*(2.0*x[2] - C2)) / detJ; // Reset values values[0] = 0.0; values[1] = 0.0; values[2] = 0.0; switch (i) { case 0: { // Array of basisvalues double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; // Declare helper variables double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X); double tmp1 = 0.25*(Y + Z)*(Y + Z); double tmp2 = 0.5*(1.0 + Z + 2.0*Y); double tmp3 = 0.5*(1.0 - Z); double tmp4 = tmp3*tmp3; // Compute basisvalues basisvalues[0] = 1.0; basisvalues[1] = tmp0; basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0]; basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0]; basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1]; basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0]; basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0]; basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2]; basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1]; basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0]; basisvalues[0] *= std::sqrt(0.75); basisvalues[3] *= std::sqrt(1.25); basisvalues[9] *= std::sqrt(1.75); basisvalues[2] *= std::sqrt(2.5); basisvalues[8] *= std::sqrt(3.5); basisvalues[7] *= std::sqrt(5.25); basisvalues[1] *= std::sqrt(7.5); basisvalues[6] *= std::sqrt(10.5); basisvalues[5] *= std::sqrt(15.75); basisvalues[4] *= std::sqrt(26.25); // Table(s) of coefficients static const double coefficients0[10] = \ {-0.0577350269189625, -0.0608580619450185, -0.0351364184463153, -0.0248451997499977, 0.0650600048632355, 0.050395263067897, 0.0411475599898912, 0.0290957186981323, 0.0237565548366599, 0.0167984210226323}; // Compute value(s) for (unsigned int r = 0; r < 10; r++) { values[0] += coefficients0[r]*basisvalues[r]; } // end loop over 'r' break; } case 1: { // Array of basisvalues double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; // Declare helper variables double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X); double tmp1 = 0.25*(Y + Z)*(Y + Z); double tmp2 = 0.5*(1.0 + Z + 2.0*Y); double tmp3 = 0.5*(1.0 - Z); double tmp4 = tmp3*tmp3; // Compute basisvalues basisvalues[0] = 1.0; basisvalues[1] = tmp0; basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0]; basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0]; basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1]; basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0]; basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0]; basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2]; basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1]; basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0]; basisvalues[0] *= std::sqrt(0.75); basisvalues[3] *= std::sqrt(1.25); basisvalues[9] *= std::sqrt(1.75); basisvalues[2] *= std::sqrt(2.5); basisvalues[8] *= std::sqrt(3.5); basisvalues[7] *= std::sqrt(5.25); basisvalues[1] *= std::sqrt(7.5); basisvalues[6] *= std::sqrt(10.5); basisvalues[5] *= std::sqrt(15.75); basisvalues[4] *= std::sqrt(26.25); // Table(s) of coefficients static const double coefficients0[10] = \ {-0.0577350269189625, 0.0608580619450185, -0.0351364184463153, -0.0248451997499977, 0.0650600048632355, -0.050395263067897, -0.0411475599898912, 0.0290957186981323, 0.0237565548366599, 0.0167984210226323}; // Compute value(s) for (unsigned int r = 0; r < 10; r++) { values[0] += coefficients0[r]*basisvalues[r]; } // end loop over 'r' break; } case 2: { // Array of basisvalues double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; // Declare helper variables double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X); double tmp1 = 0.25*(Y + Z)*(Y + Z); double tmp2 = 0.5*(1.0 + Z + 2.0*Y); double tmp3 = 0.5*(1.0 - Z); double tmp4 = tmp3*tmp3; // Compute basisvalues basisvalues[0] = 1.0; basisvalues[1] = tmp0; basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0]; basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0]; basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1]; basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0]; basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0]; basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2]; basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1]; basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0]; basisvalues[0] *= std::sqrt(0.75); basisvalues[3] *= std::sqrt(1.25); basisvalues[9] *= std::sqrt(1.75); basisvalues[2] *= std::sqrt(2.5); basisvalues[8] *= std::sqrt(3.5); basisvalues[7] *= std::sqrt(5.25); basisvalues[1] *= std::sqrt(7.5); basisvalues[6] *= std::sqrt(10.5); basisvalues[5] *= std::sqrt(15.75); basisvalues[4] *= std::sqrt(26.25); // Table(s) of coefficients static const double coefficients0[10] = \ {-0.0577350269189625, 0.0, 0.0702728368926306, -0.0248451997499977, 0.0, 0.0, 0.0, 0.0872871560943969, -0.0475131096733199, 0.0167984210226323}; // Compute value(s) for (unsigned int r = 0; r < 10; r++) { values[0] += coefficients0[r]*basisvalues[r]; } // end loop over 'r' break; } case 3: { // Array of basisvalues double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; // Declare helper variables double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X); double tmp1 = 0.25*(Y + Z)*(Y + Z); double tmp2 = 0.5*(1.0 + Z + 2.0*Y); double tmp3 = 0.5*(1.0 - Z); double tmp4 = tmp3*tmp3; // Compute basisvalues basisvalues[0] = 1.0; basisvalues[1] = tmp0; basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0]; basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0]; basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1]; basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0]; basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0]; basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2]; basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1]; basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0]; basisvalues[0] *= std::sqrt(0.75); basisvalues[3] *= std::sqrt(1.25); basisvalues[9] *= std::sqrt(1.75); basisvalues[2] *= std::sqrt(2.5); basisvalues[8] *= std::sqrt(3.5); basisvalues[7] *= std::sqrt(5.25); basisvalues[1] *= std::sqrt(7.5); basisvalues[6] *= std::sqrt(10.5); basisvalues[5] *= std::sqrt(15.75); basisvalues[4] *= std::sqrt(26.25); // Table(s) of coefficients static const double coefficients0[10] = \ {-0.0577350269189626, 0.0, 0.0, 0.074535599249993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.100790526135794}; // Compute value(s) for (unsigned int r = 0; r < 10; r++) { values[0] += coefficients0[r]*basisvalues[r]; } // end loop over 'r' break; } case 4: { // Array of basisvalues double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; // Declare helper variables double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X); double tmp1 = 0.25*(Y + Z)*(Y + Z); double tmp2 = 0.5*(1.0 + Z + 2.0*Y); double tmp3 = 0.5*(1.0 - Z); double tmp4 = tmp3*tmp3; // Compute basisvalues basisvalues[0] = 1.0; basisvalues[1] = tmp0; basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0]; basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0]; basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1]; basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0]; basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0]; basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2]; basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1]; basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0]; basisvalues[0] *= std::sqrt(0.75); basisvalues[3] *= std::sqrt(1.25); basisvalues[9] *= std::sqrt(1.75); basisvalues[2] *= std::sqrt(2.5); basisvalues[8] *= std::sqrt(3.5); basisvalues[7] *= std::sqrt(5.25); basisvalues[1] *= std::sqrt(7.5); basisvalues[6] *= std::sqrt(10.5); basisvalues[5] *= std::sqrt(15.75); basisvalues[4] *= std::sqrt(26.25); // Table(s) of coefficients static const double coefficients0[10] = \ {0.23094010767585, 0.0, 0.140545673785261, 0.0993807989999906, 0.0, 0.0, 0.0, 0.0, 0.1187827741833, -0.0671936840905293}; // Compute value(s) for (unsigned int r = 0; r < 10; r++) { values[0] += coefficients0[r]*basisvalues[r]; } // end loop over 'r' break; } case 5: { // Array of basisvalues double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; // Declare helper variables double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X); double tmp1 = 0.25*(Y + Z)*(Y + Z); double tmp2 = 0.5*(1.0 + Z + 2.0*Y); double tmp3 = 0.5*(1.0 - Z); double tmp4 = tmp3*tmp3; // Compute basisvalues basisvalues[0] = 1.0; basisvalues[1] = tmp0; basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0]; basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0]; basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1]; basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0]; basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0]; basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2]; basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1]; basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0]; basisvalues[0] *= std::sqrt(0.75); basisvalues[3] *= std::sqrt(1.25); basisvalues[9] *= std::sqrt(1.75); basisvalues[2] *= std::sqrt(2.5); basisvalues[8] *= std::sqrt(3.5); basisvalues[7] *= std::sqrt(5.25); basisvalues[1] *= std::sqrt(7.5); basisvalues[6] *= std::sqrt(10.5); basisvalues[5] *= std::sqrt(15.75); basisvalues[4] *= std::sqrt(26.25); // Table(s) of coefficients static const double coefficients0[10] = \ {0.23094010767585, 0.121716123890037, -0.0702728368926306, 0.0993807989999907, 0.0, 0.0, 0.102868899974728, 0.0, -0.0593913870916499, -0.0671936840905293}; // Compute value(s) for (unsigned int r = 0; r < 10; r++) { values[0] += coefficients0[r]*basisvalues[r]; } // end loop over 'r' break; } case 6: { // Array of basisvalues double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; // Declare helper variables double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X); double tmp1 = 0.25*(Y + Z)*(Y + Z); double tmp2 = 0.5*(1.0 + Z + 2.0*Y); double tmp3 = 0.5*(1.0 - Z); double tmp4 = tmp3*tmp3; // Compute basisvalues basisvalues[0] = 1.0; basisvalues[1] = tmp0; basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0]; basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0]; basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1]; basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0]; basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0]; basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2]; basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1]; basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0]; basisvalues[0] *= std::sqrt(0.75); basisvalues[3] *= std::sqrt(1.25); basisvalues[9] *= std::sqrt(1.75); basisvalues[2] *= std::sqrt(2.5); basisvalues[8] *= std::sqrt(3.5); basisvalues[7] *= std::sqrt(5.25); basisvalues[1] *= std::sqrt(7.5); basisvalues[6] *= std::sqrt(10.5); basisvalues[5] *= std::sqrt(15.75); basisvalues[4] *= std::sqrt(26.25); // Table(s) of coefficients static const double coefficients0[10] = \ {0.23094010767585, 0.121716123890037, 0.0702728368926307, -0.0993807989999907, 0.0, 0.100790526135794, -0.0205737799949456, -0.087287156094397, -0.01187827741833, 0.0167984210226323}; // Compute value(s) for (unsigned int r = 0; r < 10; r++) { values[0] += coefficients0[r]*basisvalues[r]; } // end loop over 'r' break; } case 7: { // Array of basisvalues double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; // Declare helper variables double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X); double tmp1 = 0.25*(Y + Z)*(Y + Z); double tmp2 = 0.5*(1.0 + Z + 2.0*Y); double tmp3 = 0.5*(1.0 - Z); double tmp4 = tmp3*tmp3; // Compute basisvalues basisvalues[0] = 1.0; basisvalues[1] = tmp0; basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0]; basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0]; basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1]; basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0]; basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0]; basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2]; basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1]; basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0]; basisvalues[0] *= std::sqrt(0.75); basisvalues[3] *= std::sqrt(1.25); basisvalues[9] *= std::sqrt(1.75); basisvalues[2] *= std::sqrt(2.5); basisvalues[8] *= std::sqrt(3.5); basisvalues[7] *= std::sqrt(5.25); basisvalues[1] *= std::sqrt(7.5); basisvalues[6] *= std::sqrt(10.5); basisvalues[5] *= std::sqrt(15.75); basisvalues[4] *= std::sqrt(26.25); // Table(s) of coefficients static const double coefficients0[10] = \ {0.23094010767585, -0.121716123890037, -0.0702728368926307, 0.0993807989999906, 0.0, 0.0, -0.102868899974728, 0.0, -0.0593913870916499, -0.0671936840905293}; // Compute value(s) for (unsigned int r = 0; r < 10; r++) { values[0] += coefficients0[r]*basisvalues[r]; } // end loop over 'r' break; } case 8: { // Array of basisvalues double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; // Declare helper variables double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X); double tmp1 = 0.25*(Y + Z)*(Y + Z); double tmp2 = 0.5*(1.0 + Z + 2.0*Y); double tmp3 = 0.5*(1.0 - Z); double tmp4 = tmp3*tmp3; // Compute basisvalues basisvalues[0] = 1.0; basisvalues[1] = tmp0; basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0]; basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0]; basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1]; basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0]; basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0]; basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2]; basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1]; basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0]; basisvalues[0] *= std::sqrt(0.75); basisvalues[3] *= std::sqrt(1.25); basisvalues[9] *= std::sqrt(1.75); basisvalues[2] *= std::sqrt(2.5); basisvalues[8] *= std::sqrt(3.5); basisvalues[7] *= std::sqrt(5.25); basisvalues[1] *= std::sqrt(7.5); basisvalues[6] *= std::sqrt(10.5); basisvalues[5] *= std::sqrt(15.75); basisvalues[4] *= std::sqrt(26.25); // Table(s) of coefficients static const double coefficients0[10] = \ {0.23094010767585, -0.121716123890037, 0.0702728368926306, -0.0993807989999907, 0.0, -0.100790526135794, 0.0205737799949456, -0.0872871560943969, -0.01187827741833, 0.0167984210226323}; // Compute value(s) for (unsigned int r = 0; r < 10; r++) { values[0] += coefficients0[r]*basisvalues[r]; } // end loop over 'r' break; } case 9: { // Array of basisvalues double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; // Declare helper variables double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X); double tmp1 = 0.25*(Y + Z)*(Y + Z); double tmp2 = 0.5*(1.0 + Z + 2.0*Y); double tmp3 = 0.5*(1.0 - Z); double tmp4 = tmp3*tmp3; // Compute basisvalues basisvalues[0] = 1.0; basisvalues[1] = tmp0; basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0]; basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0]; basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1]; basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0]; basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0]; basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2]; basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1]; basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0]; basisvalues[0] *= std::sqrt(0.75); basisvalues[3] *= std::sqrt(1.25); basisvalues[9] *= std::sqrt(1.75); basisvalues[2] *= std::sqrt(2.5); basisvalues[8] *= std::sqrt(3.5); basisvalues[7] *= std::sqrt(5.25); basisvalues[1] *= std::sqrt(7.5); basisvalues[6] *= std::sqrt(10.5); basisvalues[5] *= std::sqrt(15.75); basisvalues[4] *= std::sqrt(26.25); // Table(s) of coefficients static const double coefficients0[10] = \ {0.23094010767585, 0.0, -0.140545673785261, -0.0993807989999906, -0.130120009726471, 0.0, 0.0, 0.0290957186981323, 0.02375655483666, 0.0167984210226323}; // Compute value(s) for (unsigned int r = 0; r < 10; r++) { values[0] += coefficients0[r]*basisvalues[r]; } // end loop over 'r' break; } case 10: { // Array of basisvalues double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; // Declare helper variables double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X); double tmp1 = 0.25*(Y + Z)*(Y + Z); double tmp2 = 0.5*(1.0 + Z + 2.0*Y); double tmp3 = 0.5*(1.0 - Z); double tmp4 = tmp3*tmp3; // Compute basisvalues basisvalues[0] = 1.0; basisvalues[1] = tmp0; basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0]; basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0]; basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1]; basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0]; basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0]; basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2]; basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1]; basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0]; basisvalues[0] *= std::sqrt(0.75); basisvalues[3] *= std::sqrt(1.25); basisvalues[9] *= std::sqrt(1.75); basisvalues[2] *= std::sqrt(2.5); basisvalues[8] *= std::sqrt(3.5); basisvalues[7] *= std::sqrt(5.25); basisvalues[1] *= std::sqrt(7.5); basisvalues[6] *= std::sqrt(10.5); basisvalues[5] *= std::sqrt(15.75); basisvalues[4] *= std::sqrt(26.25); // Table(s) of coefficients static const double coefficients0[10] = \ {-0.0577350269189625, -0.0608580619450185, -0.0351364184463153, -0.0248451997499977, 0.0650600048632355, 0.050395263067897, 0.0411475599898912, 0.0290957186981323, 0.0237565548366599, 0.0167984210226323}; // Compute value(s) for (unsigned int r = 0; r < 10; r++) { values[1] += coefficients0[r]*basisvalues[r]; } // end loop over 'r' break; } case 11: { // Array of basisvalues double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; // Declare helper variables double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X); double tmp1 = 0.25*(Y + Z)*(Y + Z); double tmp2 = 0.5*(1.0 + Z + 2.0*Y); double tmp3 = 0.5*(1.0 - Z); double tmp4 = tmp3*tmp3; // Compute basisvalues basisvalues[0] = 1.0; basisvalues[1] = tmp0; basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0]; basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0]; basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1]; basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0]; basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0]; basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2]; basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1]; basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0]; basisvalues[0] *= std::sqrt(0.75); basisvalues[3] *= std::sqrt(1.25); basisvalues[9] *= std::sqrt(1.75); basisvalues[2] *= std::sqrt(2.5); basisvalues[8] *= std::sqrt(3.5); basisvalues[7] *= std::sqrt(5.25); basisvalues[1] *= std::sqrt(7.5); basisvalues[6] *= std::sqrt(10.5); basisvalues[5] *= std::sqrt(15.75); basisvalues[4] *= std::sqrt(26.25); // Table(s) of coefficients static const double coefficients0[10] = \ {-0.0577350269189625, 0.0608580619450185, -0.0351364184463153, -0.0248451997499977, 0.0650600048632355, -0.050395263067897, -0.0411475599898912, 0.0290957186981323, 0.0237565548366599, 0.0167984210226323}; // Compute value(s) for (unsigned int r = 0; r < 10; r++) { values[1] += coefficients0[r]*basisvalues[r]; } // end loop over 'r' break; } case 12: { // Array of basisvalues double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; // Declare helper variables double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X); double tmp1 = 0.25*(Y + Z)*(Y + Z); double tmp2 = 0.5*(1.0 + Z + 2.0*Y); double tmp3 = 0.5*(1.0 - Z); double tmp4 = tmp3*tmp3; // Compute basisvalues basisvalues[0] = 1.0; basisvalues[1] = tmp0; basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0]; basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0]; basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1]; basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0]; basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0]; basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2]; basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1]; basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0]; basisvalues[0] *= std::sqrt(0.75); basisvalues[3] *= std::sqrt(1.25); basisvalues[9] *= std::sqrt(1.75); basisvalues[2] *= std::sqrt(2.5); basisvalues[8] *= std::sqrt(3.5); basisvalues[7] *= std::sqrt(5.25); basisvalues[1] *= std::sqrt(7.5); basisvalues[6] *= std::sqrt(10.5); basisvalues[5] *= std::sqrt(15.75); basisvalues[4] *= std::sqrt(26.25); // Table(s) of coefficients static const double coefficients0[10] = \ {-0.0577350269189625, 0.0, 0.0702728368926306, -0.0248451997499977, 0.0, 0.0, 0.0, 0.0872871560943969, -0.0475131096733199, 0.0167984210226323}; // Compute value(s) for (unsigned int r = 0; r < 10; r++) { values[1] += coefficients0[r]*basisvalues[r]; } // end loop over 'r' break; } case 13: { // Array of basisvalues double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; // Declare helper variables double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X); double tmp1 = 0.25*(Y + Z)*(Y + Z); double tmp2 = 0.5*(1.0 + Z + 2.0*Y); double tmp3 = 0.5*(1.0 - Z); double tmp4 = tmp3*tmp3; // Compute basisvalues basisvalues[0] = 1.0; basisvalues[1] = tmp0; basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0]; basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0]; basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1]; basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0]; basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0]; basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2]; basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1]; basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0]; basisvalues[0] *= std::sqrt(0.75); basisvalues[3] *= std::sqrt(1.25); basisvalues[9] *= std::sqrt(1.75); basisvalues[2] *= std::sqrt(2.5); basisvalues[8] *= std::sqrt(3.5); basisvalues[7] *= std::sqrt(5.25); basisvalues[1] *= std::sqrt(7.5); basisvalues[6] *= std::sqrt(10.5); basisvalues[5] *= std::sqrt(15.75); basisvalues[4] *= std::sqrt(26.25); // Table(s) of coefficients static const double coefficients0[10] = \ {-0.0577350269189626, 0.0, 0.0, 0.074535599249993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.100790526135794}; // Compute value(s) for (unsigned int r = 0; r < 10; r++) { values[1] += coefficients0[r]*basisvalues[r]; } // end loop over 'r' break; } case 14: { // Array of basisvalues double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; // Declare helper variables double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X); double tmp1 = 0.25*(Y + Z)*(Y + Z); double tmp2 = 0.5*(1.0 + Z + 2.0*Y); double tmp3 = 0.5*(1.0 - Z); double tmp4 = tmp3*tmp3; // Compute basisvalues basisvalues[0] = 1.0; basisvalues[1] = tmp0; basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0]; basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0]; basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1]; basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0]; basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0]; basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2]; basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1]; basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0]; basisvalues[0] *= std::sqrt(0.75); basisvalues[3] *= std::sqrt(1.25); basisvalues[9] *= std::sqrt(1.75); basisvalues[2] *= std::sqrt(2.5); basisvalues[8] *= std::sqrt(3.5); basisvalues[7] *= std::sqrt(5.25); basisvalues[1] *= std::sqrt(7.5); basisvalues[6] *= std::sqrt(10.5); basisvalues[5] *= std::sqrt(15.75); basisvalues[4] *= std::sqrt(26.25); // Table(s) of coefficients static const double coefficients0[10] = \ {0.23094010767585, 0.0, 0.140545673785261, 0.0993807989999906, 0.0, 0.0, 0.0, 0.0, 0.1187827741833, -0.0671936840905293}; // Compute value(s) for (unsigned int r = 0; r < 10; r++) { values[1] += coefficients0[r]*basisvalues[r]; } // end loop over 'r' break; } case 15: { // Array of basisvalues double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; // Declare helper variables double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X); double tmp1 = 0.25*(Y + Z)*(Y + Z); double tmp2 = 0.5*(1.0 + Z + 2.0*Y); double tmp3 = 0.5*(1.0 - Z); double tmp4 = tmp3*tmp3; // Compute basisvalues basisvalues[0] = 1.0; basisvalues[1] = tmp0; basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0]; basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0]; basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1]; basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0]; basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0]; basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2]; basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1]; basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0]; basisvalues[0] *= std::sqrt(0.75); basisvalues[3] *= std::sqrt(1.25); basisvalues[9] *= std::sqrt(1.75); basisvalues[2] *= std::sqrt(2.5); basisvalues[8] *= std::sqrt(3.5); basisvalues[7] *= std::sqrt(5.25); basisvalues[1] *= std::sqrt(7.5); basisvalues[6] *= std::sqrt(10.5); basisvalues[5] *= std::sqrt(15.75); basisvalues[4] *= std::sqrt(26.25); // Table(s) of coefficients static const double coefficients0[10] = \ {0.23094010767585, 0.121716123890037, -0.0702728368926306, 0.0993807989999907, 0.0, 0.0, 0.102868899974728, 0.0, -0.0593913870916499, -0.0671936840905293}; // Compute value(s) for (unsigned int r = 0; r < 10; r++) { values[1] += coefficients0[r]*basisvalues[r]; } // end loop over 'r' break; } case 16: { // Array of basisvalues double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; // Declare helper variables double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X); double tmp1 = 0.25*(Y + Z)*(Y + Z); double tmp2 = 0.5*(1.0 + Z + 2.0*Y); double tmp3 = 0.5*(1.0 - Z); double tmp4 = tmp3*tmp3; // Compute basisvalues basisvalues[0] = 1.0; basisvalues[1] = tmp0; basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0]; basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0]; basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1]; basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0]; basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0]; basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2]; basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1]; basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0]; basisvalues[0] *= std::sqrt(0.75); basisvalues[3] *= std::sqrt(1.25); basisvalues[9] *= std::sqrt(1.75); basisvalues[2] *= std::sqrt(2.5); basisvalues[8] *= std::sqrt(3.5); basisvalues[7] *= std::sqrt(5.25); basisvalues[1] *= std::sqrt(7.5); basisvalues[6] *= std::sqrt(10.5); basisvalues[5] *= std::sqrt(15.75); basisvalues[4] *= std::sqrt(26.25); // Table(s) of coefficients static const double coefficients0[10] = \ {0.23094010767585, 0.121716123890037, 0.0702728368926307, -0.0993807989999907, 0.0, 0.100790526135794, -0.0205737799949456, -0.087287156094397, -0.01187827741833, 0.0167984210226323}; // Compute value(s) for (unsigned int r = 0; r < 10; r++) { values[1] += coefficients0[r]*basisvalues[r]; } // end loop over 'r' break; } case 17: { // Array of basisvalues double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; // Declare helper variables double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X); double tmp1 = 0.25*(Y + Z)*(Y + Z); double tmp2 = 0.5*(1.0 + Z + 2.0*Y); double tmp3 = 0.5*(1.0 - Z); double tmp4 = tmp3*tmp3; // Compute basisvalues basisvalues[0] = 1.0; basisvalues[1] = tmp0; basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0]; basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0]; basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1]; basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0]; basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0]; basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2]; basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1]; basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0]; basisvalues[0] *= std::sqrt(0.75); basisvalues[3] *= std::sqrt(1.25); basisvalues[9] *= std::sqrt(1.75); basisvalues[2] *= std::sqrt(2.5); basisvalues[8] *= std::sqrt(3.5); basisvalues[7] *= std::sqrt(5.25); basisvalues[1] *= std::sqrt(7.5); basisvalues[6] *= std::sqrt(10.5); basisvalues[5] *= std::sqrt(15.75); basisvalues[4] *= std::sqrt(26.25); // Table(s) of coefficients static const double coefficients0[10] = \ {0.23094010767585, -0.121716123890037, -0.0702728368926307, 0.0993807989999906, 0.0, 0.0, -0.102868899974728, 0.0, -0.0593913870916499, -0.0671936840905293}; // Compute value(s) for (unsigned int r = 0; r < 10; r++) { values[1] += coefficients0[r]*basisvalues[r]; } // end loop over 'r' break; } case 18: { // Array of basisvalues double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; // Declare helper variables double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X); double tmp1 = 0.25*(Y + Z)*(Y + Z); double tmp2 = 0.5*(1.0 + Z + 2.0*Y); double tmp3 = 0.5*(1.0 - Z); double tmp4 = tmp3*tmp3; // Compute basisvalues basisvalues[0] = 1.0; basisvalues[1] = tmp0; basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0]; basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0]; basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1]; basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0]; basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0]; basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2]; basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1]; basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0]; basisvalues[0] *= std::sqrt(0.75); basisvalues[3] *= std::sqrt(1.25); basisvalues[9] *= std::sqrt(1.75); basisvalues[2] *= std::sqrt(2.5); basisvalues[8] *= std::sqrt(3.5); basisvalues[7] *= std::sqrt(5.25); basisvalues[1] *= std::sqrt(7.5); basisvalues[6] *= std::sqrt(10.5); basisvalues[5] *= std::sqrt(15.75); basisvalues[4] *= std::sqrt(26.25); // Table(s) of coefficients static const double coefficients0[10] = \ {0.23094010767585, -0.121716123890037, 0.0702728368926306, -0.0993807989999907, 0.0, -0.100790526135794, 0.0205737799949456, -0.0872871560943969, -0.01187827741833, 0.0167984210226323}; // Compute value(s) for (unsigned int r = 0; r < 10; r++) { values[1] += coefficients0[r]*basisvalues[r]; } // end loop over 'r' break; } case 19: { // Array of basisvalues double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; // Declare helper variables double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X); double tmp1 = 0.25*(Y + Z)*(Y + Z); double tmp2 = 0.5*(1.0 + Z + 2.0*Y); double tmp3 = 0.5*(1.0 - Z); double tmp4 = tmp3*tmp3; // Compute basisvalues basisvalues[0] = 1.0; basisvalues[1] = tmp0; basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0]; basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0]; basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1]; basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0]; basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0]; basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2]; basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1]; basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0]; basisvalues[0] *= std::sqrt(0.75); basisvalues[3] *= std::sqrt(1.25); basisvalues[9] *= std::sqrt(1.75); basisvalues[2] *= std::sqrt(2.5); basisvalues[8] *= std::sqrt(3.5); basisvalues[7] *= std::sqrt(5.25); basisvalues[1] *= std::sqrt(7.5); basisvalues[6] *= std::sqrt(10.5); basisvalues[5] *= std::sqrt(15.75); basisvalues[4] *= std::sqrt(26.25); // Table(s) of coefficients static const double coefficients0[10] = \ {0.23094010767585, 0.0, -0.140545673785261, -0.0993807989999906, -0.130120009726471, 0.0, 0.0, 0.0290957186981323, 0.02375655483666, 0.0167984210226323}; // Compute value(s) for (unsigned int r = 0; r < 10; r++) { values[1] += coefficients0[r]*basisvalues[r]; } // end loop over 'r' break; } case 20: { // Array of basisvalues double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; // Declare helper variables double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X); double tmp1 = 0.25*(Y + Z)*(Y + Z); double tmp2 = 0.5*(1.0 + Z + 2.0*Y); double tmp3 = 0.5*(1.0 - Z); double tmp4 = tmp3*tmp3; // Compute basisvalues basisvalues[0] = 1.0; basisvalues[1] = tmp0; basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0]; basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0]; basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1]; basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0]; basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0]; basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2]; basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1]; basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0]; basisvalues[0] *= std::sqrt(0.75); basisvalues[3] *= std::sqrt(1.25); basisvalues[9] *= std::sqrt(1.75); basisvalues[2] *= std::sqrt(2.5); basisvalues[8] *= std::sqrt(3.5); basisvalues[7] *= std::sqrt(5.25); basisvalues[1] *= std::sqrt(7.5); basisvalues[6] *= std::sqrt(10.5); basisvalues[5] *= std::sqrt(15.75); basisvalues[4] *= std::sqrt(26.25); // Table(s) of coefficients static const double coefficients0[10] = \ {-0.0577350269189625, -0.0608580619450185, -0.0351364184463153, -0.0248451997499977, 0.0650600048632355, 0.050395263067897, 0.0411475599898912, 0.0290957186981323, 0.0237565548366599, 0.0167984210226323}; // Compute value(s) for (unsigned int r = 0; r < 10; r++) { values[2] += coefficients0[r]*basisvalues[r]; } // end loop over 'r' break; } case 21: { // Array of basisvalues double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; // Declare helper variables double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X); double tmp1 = 0.25*(Y + Z)*(Y + Z); double tmp2 = 0.5*(1.0 + Z + 2.0*Y); double tmp3 = 0.5*(1.0 - Z); double tmp4 = tmp3*tmp3; // Compute basisvalues basisvalues[0] = 1.0; basisvalues[1] = tmp0; basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0]; basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0]; basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1]; basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0]; basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0]; basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2]; basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1]; basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0]; basisvalues[0] *= std::sqrt(0.75); basisvalues[3] *= std::sqrt(1.25); basisvalues[9] *= std::sqrt(1.75); basisvalues[2] *= std::sqrt(2.5); basisvalues[8] *= std::sqrt(3.5); basisvalues[7] *= std::sqrt(5.25); basisvalues[1] *= std::sqrt(7.5); basisvalues[6] *= std::sqrt(10.5); basisvalues[5] *= std::sqrt(15.75); basisvalues[4] *= std::sqrt(26.25); // Table(s) of coefficients static const double coefficients0[10] = \ {-0.0577350269189625, 0.0608580619450185, -0.0351364184463153, -0.0248451997499977, 0.0650600048632355, -0.050395263067897, -0.0411475599898912, 0.0290957186981323, 0.0237565548366599, 0.0167984210226323}; // Compute value(s) for (unsigned int r = 0; r < 10; r++) { values[2] += coefficients0[r]*basisvalues[r]; } // end loop over 'r' break; } case 22: { // Array of basisvalues double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; // Declare helper variables double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X); double tmp1 = 0.25*(Y + Z)*(Y + Z); double tmp2 = 0.5*(1.0 + Z + 2.0*Y); double tmp3 = 0.5*(1.0 - Z); double tmp4 = tmp3*tmp3; // Compute basisvalues basisvalues[0] = 1.0; basisvalues[1] = tmp0; basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0]; basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0]; basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1]; basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0]; basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0]; basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2]; basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1]; basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0]; basisvalues[0] *= std::sqrt(0.75); basisvalues[3] *= std::sqrt(1.25); basisvalues[9] *= std::sqrt(1.75); basisvalues[2] *= std::sqrt(2.5); basisvalues[8] *= std::sqrt(3.5); basisvalues[7] *= std::sqrt(5.25); basisvalues[1] *= std::sqrt(7.5); basisvalues[6] *= std::sqrt(10.5); basisvalues[5] *= std::sqrt(15.75); basisvalues[4] *= std::sqrt(26.25); // Table(s) of coefficients static const double coefficients0[10] = \ {-0.0577350269189625, 0.0, 0.0702728368926306, -0.0248451997499977, 0.0, 0.0, 0.0, 0.0872871560943969, -0.0475131096733199, 0.0167984210226323}; // Compute value(s) for (unsigned int r = 0; r < 10; r++) { values[2] += coefficients0[r]*basisvalues[r]; } // end loop over 'r' break; } case 23: { // Array of basisvalues double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; // Declare helper variables double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X); double tmp1 = 0.25*(Y + Z)*(Y + Z); double tmp2 = 0.5*(1.0 + Z + 2.0*Y); double tmp3 = 0.5*(1.0 - Z); double tmp4 = tmp3*tmp3; // Compute basisvalues basisvalues[0] = 1.0; basisvalues[1] = tmp0; basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0]; basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0]; basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1]; basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0]; basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0]; basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2]; basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1]; basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0]; basisvalues[0] *= std::sqrt(0.75); basisvalues[3] *= std::sqrt(1.25); basisvalues[9] *= std::sqrt(1.75); basisvalues[2] *= std::sqrt(2.5); basisvalues[8] *= std::sqrt(3.5); basisvalues[7] *= std::sqrt(5.25); basisvalues[1] *= std::sqrt(7.5); basisvalues[6] *= std::sqrt(10.5); basisvalues[5] *= std::sqrt(15.75); basisvalues[4] *= std::sqrt(26.25); // Table(s) of coefficients static const double coefficients0[10] = \ {-0.0577350269189626, 0.0, 0.0, 0.074535599249993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.100790526135794}; // Compute value(s) for (unsigned int r = 0; r < 10; r++) { values[2] += coefficients0[r]*basisvalues[r]; } // end loop over 'r' break; } case 24: { // Array of basisvalues double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; // Declare helper variables double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X); double tmp1 = 0.25*(Y + Z)*(Y + Z); double tmp2 = 0.5*(1.0 + Z + 2.0*Y); double tmp3 = 0.5*(1.0 - Z); double tmp4 = tmp3*tmp3; // Compute basisvalues basisvalues[0] = 1.0; basisvalues[1] = tmp0; basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0]; basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0]; basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1]; basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0]; basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0]; basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2]; basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1]; basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0]; basisvalues[0] *= std::sqrt(0.75); basisvalues[3] *= std::sqrt(1.25); basisvalues[9] *= std::sqrt(1.75); basisvalues[2] *= std::sqrt(2.5); basisvalues[8] *= std::sqrt(3.5); basisvalues[7] *= std::sqrt(5.25); basisvalues[1] *= std::sqrt(7.5); basisvalues[6] *= std::sqrt(10.5); basisvalues[5] *= std::sqrt(15.75); basisvalues[4] *= std::sqrt(26.25); // Table(s) of coefficients static const double coefficients0[10] = \ {0.23094010767585, 0.0, 0.140545673785261, 0.0993807989999906, 0.0, 0.0, 0.0, 0.0, 0.1187827741833, -0.0671936840905293}; // Compute value(s) for (unsigned int r = 0; r < 10; r++) { values[2] += coefficients0[r]*basisvalues[r]; } // end loop over 'r' break; } case 25: { // Array of basisvalues double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; // Declare helper variables double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X); double tmp1 = 0.25*(Y + Z)*(Y + Z); double tmp2 = 0.5*(1.0 + Z + 2.0*Y); double tmp3 = 0.5*(1.0 - Z); double tmp4 = tmp3*tmp3; // Compute basisvalues basisvalues[0] = 1.0; basisvalues[1] = tmp0; basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0]; basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0]; basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1]; basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0]; basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0]; basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2]; basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1]; basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0]; basisvalues[0] *= std::sqrt(0.75); basisvalues[3] *= std::sqrt(1.25); basisvalues[9] *= std::sqrt(1.75); basisvalues[2] *= std::sqrt(2.5); basisvalues[8] *= std::sqrt(3.5); basisvalues[7] *= std::sqrt(5.25); basisvalues[1] *= std::sqrt(7.5); basisvalues[6] *= std::sqrt(10.5); basisvalues[5] *= std::sqrt(15.75); basisvalues[4] *= std::sqrt(26.25); // Table(s) of coefficients static const double coefficients0[10] = \ {0.23094010767585, 0.121716123890037, -0.0702728368926306, 0.0993807989999907, 0.0, 0.0, 0.102868899974728, 0.0, -0.0593913870916499, -0.0671936840905293}; // Compute value(s) for (unsigned int r = 0; r < 10; r++) { values[2] += coefficients0[r]*basisvalues[r]; } // end loop over 'r' break; } case 26: { // Array of basisvalues double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; // Declare helper variables double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X); double tmp1 = 0.25*(Y + Z)*(Y + Z); double tmp2 = 0.5*(1.0 + Z + 2.0*Y); double tmp3 = 0.5*(1.0 - Z); double tmp4 = tmp3*tmp3; // Compute basisvalues basisvalues[0] = 1.0; basisvalues[1] = tmp0; basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0]; basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0]; basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1]; basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0]; basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0]; basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2]; basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1]; basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0]; basisvalues[0] *= std::sqrt(0.75); basisvalues[3] *= std::sqrt(1.25); basisvalues[9] *= std::sqrt(1.75); basisvalues[2] *= std::sqrt(2.5); basisvalues[8] *= std::sqrt(3.5); basisvalues[7] *= std::sqrt(5.25); basisvalues[1] *= std::sqrt(7.5); basisvalues[6] *= std::sqrt(10.5); basisvalues[5] *= std::sqrt(15.75); basisvalues[4] *= std::sqrt(26.25); // Table(s) of coefficients static const double coefficients0[10] = \ {0.23094010767585, 0.121716123890037, 0.0702728368926307, -0.0993807989999907, 0.0, 0.100790526135794, -0.0205737799949456, -0.087287156094397, -0.01187827741833, 0.0167984210226323}; // Compute value(s) for (unsigned int r = 0; r < 10; r++) { values[2] += coefficients0[r]*basisvalues[r]; } // end loop over 'r' break; } case 27: { // Array of basisvalues double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; // Declare helper variables double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X); double tmp1 = 0.25*(Y + Z)*(Y + Z); double tmp2 = 0.5*(1.0 + Z + 2.0*Y); double tmp3 = 0.5*(1.0 - Z); double tmp4 = tmp3*tmp3; // Compute basisvalues basisvalues[0] = 1.0; basisvalues[1] = tmp0; basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0]; basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0]; basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1]; basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0]; basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0]; basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2]; basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1]; basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0]; basisvalues[0] *= std::sqrt(0.75); basisvalues[3] *= std::sqrt(1.25); basisvalues[9] *= std::sqrt(1.75); basisvalues[2] *= std::sqrt(2.5); basisvalues[8] *= std::sqrt(3.5); basisvalues[7] *= std::sqrt(5.25); basisvalues[1] *= std::sqrt(7.5); basisvalues[6] *= std::sqrt(10.5); basisvalues[5] *= std::sqrt(15.75); basisvalues[4] *= std::sqrt(26.25); // Table(s) of coefficients static const double coefficients0[10] = \ {0.23094010767585, -0.121716123890037, -0.0702728368926307, 0.0993807989999906, 0.0, 0.0, -0.102868899974728, 0.0, -0.0593913870916499, -0.0671936840905293}; // Compute value(s) for (unsigned int r = 0; r < 10; r++) { values[2] += coefficients0[r]*basisvalues[r]; } // end loop over 'r' break; } case 28: { // Array of basisvalues double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; // Declare helper variables double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X); double tmp1 = 0.25*(Y + Z)*(Y + Z); double tmp2 = 0.5*(1.0 + Z + 2.0*Y); double tmp3 = 0.5*(1.0 - Z); double tmp4 = tmp3*tmp3; // Compute basisvalues basisvalues[0] = 1.0; basisvalues[1] = tmp0; basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0]; basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0]; basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1]; basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0]; basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0]; basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2]; basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1]; basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0]; basisvalues[0] *= std::sqrt(0.75); basisvalues[3] *= std::sqrt(1.25); basisvalues[9] *= std::sqrt(1.75); basisvalues[2] *= std::sqrt(2.5); basisvalues[8] *= std::sqrt(3.5); basisvalues[7] *= std::sqrt(5.25); basisvalues[1] *= std::sqrt(7.5); basisvalues[6] *= std::sqrt(10.5); basisvalues[5] *= std::sqrt(15.75); basisvalues[4] *= std::sqrt(26.25); // Table(s) of coefficients static const double coefficients0[10] = \ {0.23094010767585, -0.121716123890037, 0.0702728368926306, -0.0993807989999907, 0.0, -0.100790526135794, 0.0205737799949456, -0.0872871560943969, -0.01187827741833, 0.0167984210226323}; // Compute value(s) for (unsigned int r = 0; r < 10; r++) { values[2] += coefficients0[r]*basisvalues[r]; } // end loop over 'r' break; } case 29: { // Array of basisvalues double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; // Declare helper variables double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X); double tmp1 = 0.25*(Y + Z)*(Y + Z); double tmp2 = 0.5*(1.0 + Z + 2.0*Y); double tmp3 = 0.5*(1.0 - Z); double tmp4 = tmp3*tmp3; // Compute basisvalues basisvalues[0] = 1.0; basisvalues[1] = tmp0; basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0]; basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0]; basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1]; basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0]; basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0]; basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2]; basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1]; basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0]; basisvalues[0] *= std::sqrt(0.75); basisvalues[3] *= std::sqrt(1.25); basisvalues[9] *= std::sqrt(1.75); basisvalues[2] *= std::sqrt(2.5); basisvalues[8] *= std::sqrt(3.5); basisvalues[7] *= std::sqrt(5.25); basisvalues[1] *= std::sqrt(7.5); basisvalues[6] *= std::sqrt(10.5); basisvalues[5] *= std::sqrt(15.75); basisvalues[4] *= std::sqrt(26.25); // Table(s) of coefficients static const double coefficients0[10] = \ {0.23094010767585, 0.0, -0.140545673785261, -0.0993807989999906, -0.130120009726471, 0.0, 0.0, 0.0290957186981323, 0.02375655483666, 0.0167984210226323}; // Compute value(s) for (unsigned int r = 0; r < 10; r++) { values[2] += coefficients0[r]*basisvalues[r]; } // end loop over 'r' break; } } } /// Evaluate basis function i at given point x in cell (non-static member function) virtual void evaluate_basis(std::size_t i, double* values, const double* x, const double* vertex_coordinates, int cell_orientation) const { _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation); } /// Evaluate all basis functions at given point x in cell (actual implementation) static void _evaluate_basis_all(double* values, const double* x, const double* vertex_coordinates, int cell_orientation) { // Helper variable to hold values of a single dof. double dof_values[3] = {0.0, 0.0, 0.0}; // Loop dofs and call evaluate_basis for (unsigned int r = 0; r < 30; r++) { _evaluate_basis(r, dof_values, x, vertex_coordinates, cell_orientation); for (unsigned int s = 0; s < 3; s++) { values[r*3 + s] = dof_values[s]; } // end loop over 's' } // end loop over 'r' } /// Evaluate all basis functions at given point x in cell (non-static member function) virtual void evaluate_basis_all(double* values, const double* x, const double* vertex_coordinates, int cell_orientation) const { _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation); } /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation) static void _evaluate_basis_derivatives(std::size_t i, std::size_t n, double* values, const double* x, const double* vertex_coordinates, int cell_orientation) { throw std::runtime_error("// Function evaluate_basis_derivatives not generated (compiled with -fno-evaluate_basis_derivatives)"); } /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function) virtual void evaluate_basis_derivatives(std::size_t i, std::size_t n, double* values, const double* x, const double* vertex_coordinates, int cell_orientation) const { _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation); } /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation) static void _evaluate_basis_derivatives_all(std::size_t n, double* values, const double* x, const double* vertex_coordinates, int cell_orientation) { // Call evaluate_basis_all if order of derivatives is equal to zero. if (n == 0) { _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation); return ; } // Compute number of derivatives. unsigned int num_derivatives = 1; for (unsigned int r = 0; r < n; r++) { num_derivatives *= 3; } // end loop over 'r' // Set values equal to zero. for (unsigned int r = 0; r < 30; r++) { for (unsigned int s = 0; s < 3*num_derivatives; s++) { values[r*3*num_derivatives + s] = 0.0; } // end loop over 's' } // end loop over 'r' // If order of derivatives is greater than the maximum polynomial degree, return zeros. if (n > 2) { return ; } // Helper variable to hold values of a single dof. double dof_values[27]; for (unsigned int r = 0; r < 27; r++) { dof_values[r] = 0.0; } // end loop over 'r' // Loop dofs and call evaluate_basis_derivatives. for (unsigned int r = 0; r < 30; r++) { _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation); for (unsigned int s = 0; s < 3*num_derivatives; s++) { values[r*3*num_derivatives + s] = dof_values[s]; } // end loop over 's' } // end loop over 'r' } /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function) virtual void evaluate_basis_derivatives_all(std::size_t n, double* values, const double* x, const double* vertex_coordinates, int cell_orientation) const { _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation); } /// Evaluate linear functional for dof i on the function f virtual double evaluate_dof(std::size_t i, const ufc::function& f, const double* vertex_coordinates, int cell_orientation, const ufc::cell& c) const { // Declare variables for result of evaluation double vals[3]; // Declare variable for physical coordinates double y[3]; switch (i) { case 0: { y[0] = vertex_coordinates[0]; y[1] = vertex_coordinates[1]; y[2] = vertex_coordinates[2]; f.evaluate(vals, y, c); return vals[0]; break; } case 1: { y[0] = vertex_coordinates[3]; y[1] = vertex_coordinates[4]; y[2] = vertex_coordinates[5]; f.evaluate(vals, y, c); return vals[0]; break; } case 2: { y[0] = vertex_coordinates[6]; y[1] = vertex_coordinates[7]; y[2] = vertex_coordinates[8]; f.evaluate(vals, y, c); return vals[0]; break; } case 3: { y[0] = vertex_coordinates[9]; y[1] = vertex_coordinates[10]; y[2] = vertex_coordinates[11]; f.evaluate(vals, y, c); return vals[0]; break; } case 4: { y[0] = 0.5*vertex_coordinates[6] + 0.5*vertex_coordinates[9]; y[1] = 0.5*vertex_coordinates[7] + 0.5*vertex_coordinates[10]; y[2] = 0.5*vertex_coordinates[8] + 0.5*vertex_coordinates[11]; f.evaluate(vals, y, c); return vals[0]; break; } case 5: { y[0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[9]; y[1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[10]; y[2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[11]; f.evaluate(vals, y, c); return vals[0]; break; } case 6: { y[0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[6]; y[1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[7]; y[2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[8]; f.evaluate(vals, y, c); return vals[0]; break; } case 7: { y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[9]; y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[10]; y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[11]; f.evaluate(vals, y, c); return vals[0]; break; } case 8: { y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[6]; y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[7]; y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[8]; f.evaluate(vals, y, c); return vals[0]; break; } case 9: { y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[3]; y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[4]; y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[5]; f.evaluate(vals, y, c); return vals[0]; break; } case 10: { y[0] = vertex_coordinates[0]; y[1] = vertex_coordinates[1]; y[2] = vertex_coordinates[2]; f.evaluate(vals, y, c); return vals[1]; break; } case 11: { y[0] = vertex_coordinates[3]; y[1] = vertex_coordinates[4]; y[2] = vertex_coordinates[5]; f.evaluate(vals, y, c); return vals[1]; break; } case 12: { y[0] = vertex_coordinates[6]; y[1] = vertex_coordinates[7]; y[2] = vertex_coordinates[8]; f.evaluate(vals, y, c); return vals[1]; break; } case 13: { y[0] = vertex_coordinates[9]; y[1] = vertex_coordinates[10]; y[2] = vertex_coordinates[11]; f.evaluate(vals, y, c); return vals[1]; break; } case 14: { y[0] = 0.5*vertex_coordinates[6] + 0.5*vertex_coordinates[9]; y[1] = 0.5*vertex_coordinates[7] + 0.5*vertex_coordinates[10]; y[2] = 0.5*vertex_coordinates[8] + 0.5*vertex_coordinates[11]; f.evaluate(vals, y, c); return vals[1]; break; } case 15: { y[0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[9]; y[1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[10]; y[2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[11]; f.evaluate(vals, y, c); return vals[1]; break; } case 16: { y[0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[6]; y[1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[7]; y[2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[8]; f.evaluate(vals, y, c); return vals[1]; break; } case 17: { y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[9]; y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[10]; y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[11]; f.evaluate(vals, y, c); return vals[1]; break; } case 18: { y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[6]; y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[7]; y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[8]; f.evaluate(vals, y, c); return vals[1]; break; } case 19: { y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[3]; y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[4]; y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[5]; f.evaluate(vals, y, c); return vals[1]; break; } case 20: { y[0] = vertex_coordinates[0]; y[1] = vertex_coordinates[1]; y[2] = vertex_coordinates[2]; f.evaluate(vals, y, c); return vals[2]; break; } case 21: { y[0] = vertex_coordinates[3]; y[1] = vertex_coordinates[4]; y[2] = vertex_coordinates[5]; f.evaluate(vals, y, c); return vals[2]; break; } case 22: { y[0] = vertex_coordinates[6]; y[1] = vertex_coordinates[7]; y[2] = vertex_coordinates[8]; f.evaluate(vals, y, c); return vals[2]; break; } case 23: { y[0] = vertex_coordinates[9]; y[1] = vertex_coordinates[10]; y[2] = vertex_coordinates[11]; f.evaluate(vals, y, c); return vals[2]; break; } case 24: { y[0] = 0.5*vertex_coordinates[6] + 0.5*vertex_coordinates[9]; y[1] = 0.5*vertex_coordinates[7] + 0.5*vertex_coordinates[10]; y[2] = 0.5*vertex_coordinates[8] + 0.5*vertex_coordinates[11]; f.evaluate(vals, y, c); return vals[2]; break; } case 25: { y[0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[9]; y[1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[10]; y[2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[11]; f.evaluate(vals, y, c); return vals[2]; break; } case 26: { y[0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[6]; y[1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[7]; y[2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[8]; f.evaluate(vals, y, c); return vals[2]; break; } case 27: { y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[9]; y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[10]; y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[11]; f.evaluate(vals, y, c); return vals[2]; break; } case 28: { y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[6]; y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[7]; y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[8]; f.evaluate(vals, y, c); return vals[2]; break; } case 29: { y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[3]; y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[4]; y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[5]; f.evaluate(vals, y, c); return vals[2]; break; } } return 0.0; } /// Evaluate linear functionals for all dofs on the function f virtual void evaluate_dofs(double* values, const ufc::function& f, const double* vertex_coordinates, int cell_orientation, const ufc::cell& c) const { // Declare variables for result of evaluation double vals[3]; // Declare variable for physical coordinates double y[3]; y[0] = vertex_coordinates[0]; y[1] = vertex_coordinates[1]; y[2] = vertex_coordinates[2]; f.evaluate(vals, y, c); values[0] = vals[0]; y[0] = vertex_coordinates[3]; y[1] = vertex_coordinates[4]; y[2] = vertex_coordinates[5]; f.evaluate(vals, y, c); values[1] = vals[0]; y[0] = vertex_coordinates[6]; y[1] = vertex_coordinates[7]; y[2] = vertex_coordinates[8]; f.evaluate(vals, y, c); values[2] = vals[0]; y[0] = vertex_coordinates[9]; y[1] = vertex_coordinates[10]; y[2] = vertex_coordinates[11]; f.evaluate(vals, y, c); values[3] = vals[0]; y[0] = 0.5*vertex_coordinates[6] + 0.5*vertex_coordinates[9]; y[1] = 0.5*vertex_coordinates[7] + 0.5*vertex_coordinates[10]; y[2] = 0.5*vertex_coordinates[8] + 0.5*vertex_coordinates[11]; f.evaluate(vals, y, c); values[4] = vals[0]; y[0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[9]; y[1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[10]; y[2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[11]; f.evaluate(vals, y, c); values[5] = vals[0]; y[0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[6]; y[1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[7]; y[2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[8]; f.evaluate(vals, y, c); values[6] = vals[0]; y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[9]; y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[10]; y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[11]; f.evaluate(vals, y, c); values[7] = vals[0]; y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[6]; y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[7]; y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[8]; f.evaluate(vals, y, c); values[8] = vals[0]; y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[3]; y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[4]; y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[5]; f.evaluate(vals, y, c); values[9] = vals[0]; y[0] = vertex_coordinates[0]; y[1] = vertex_coordinates[1]; y[2] = vertex_coordinates[2]; f.evaluate(vals, y, c); values[10] = vals[1]; y[0] = vertex_coordinates[3]; y[1] = vertex_coordinates[4]; y[2] = vertex_coordinates[5]; f.evaluate(vals, y, c); values[11] = vals[1]; y[0] = vertex_coordinates[6]; y[1] = vertex_coordinates[7]; y[2] = vertex_coordinates[8]; f.evaluate(vals, y, c); values[12] = vals[1]; y[0] = vertex_coordinates[9]; y[1] = vertex_coordinates[10]; y[2] = vertex_coordinates[11]; f.evaluate(vals, y, c); values[13] = vals[1]; y[0] = 0.5*vertex_coordinates[6] + 0.5*vertex_coordinates[9]; y[1] = 0.5*vertex_coordinates[7] + 0.5*vertex_coordinates[10]; y[2] = 0.5*vertex_coordinates[8] + 0.5*vertex_coordinates[11]; f.evaluate(vals, y, c); values[14] = vals[1]; y[0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[9]; y[1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[10]; y[2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[11]; f.evaluate(vals, y, c); values[15] = vals[1]; y[0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[6]; y[1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[7]; y[2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[8]; f.evaluate(vals, y, c); values[16] = vals[1]; y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[9]; y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[10]; y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[11]; f.evaluate(vals, y, c); values[17] = vals[1]; y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[6]; y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[7]; y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[8]; f.evaluate(vals, y, c); values[18] = vals[1]; y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[3]; y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[4]; y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[5]; f.evaluate(vals, y, c); values[19] = vals[1]; y[0] = vertex_coordinates[0]; y[1] = vertex_coordinates[1]; y[2] = vertex_coordinates[2]; f.evaluate(vals, y, c); values[20] = vals[2]; y[0] = vertex_coordinates[3]; y[1] = vertex_coordinates[4]; y[2] = vertex_coordinates[5]; f.evaluate(vals, y, c); values[21] = vals[2]; y[0] = vertex_coordinates[6]; y[1] = vertex_coordinates[7]; y[2] = vertex_coordinates[8]; f.evaluate(vals, y, c); values[22] = vals[2]; y[0] = vertex_coordinates[9]; y[1] = vertex_coordinates[10]; y[2] = vertex_coordinates[11]; f.evaluate(vals, y, c); values[23] = vals[2]; y[0] = 0.5*vertex_coordinates[6] + 0.5*vertex_coordinates[9]; y[1] = 0.5*vertex_coordinates[7] + 0.5*vertex_coordinates[10]; y[2] = 0.5*vertex_coordinates[8] + 0.5*vertex_coordinates[11]; f.evaluate(vals, y, c); values[24] = vals[2]; y[0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[9]; y[1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[10]; y[2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[11]; f.evaluate(vals, y, c); values[25] = vals[2]; y[0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[6]; y[1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[7]; y[2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[8]; f.evaluate(vals, y, c); values[26] = vals[2]; y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[9]; y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[10]; y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[11]; f.evaluate(vals, y, c); values[27] = vals[2]; y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[6]; y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[7]; y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[8]; f.evaluate(vals, y, c); values[28] = vals[2]; y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[3]; y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[4]; y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[5]; f.evaluate(vals, y, c); values[29] = vals[2]; } /// Interpolate vertex values from dof values virtual void interpolate_vertex_values(double* vertex_values, const double* dof_values, const double* vertex_coordinates, int cell_orientation, const ufc::cell& c) const { // Evaluate function and change variables vertex_values[0] = dof_values[0]; vertex_values[3] = dof_values[1]; vertex_values[6] = dof_values[2]; vertex_values[9] = dof_values[3]; // Evaluate function and change variables vertex_values[1] = dof_values[10]; vertex_values[4] = dof_values[11]; vertex_values[7] = dof_values[12]; vertex_values[10] = dof_values[13]; // Evaluate function and change variables vertex_values[2] = dof_values[20]; vertex_values[5] = dof_values[21]; vertex_values[8] = dof_values[22]; vertex_values[11] = dof_values[23]; } /// Map coordinate xhat from reference cell to coordinate x in cell virtual void map_from_reference_cell(double* x, const double* xhat, const ufc::cell& c) const { throw std::runtime_error("map_from_reference_cell not yet implemented."); } /// Map from coordinate x in cell to coordinate xhat in reference cell virtual void map_to_reference_cell(double* xhat, const double* x, const ufc::cell& c) const { throw std::runtime_error("map_to_reference_cell not yet implemented."); } /// Return the number of sub elements (for a mixed element) virtual std::size_t num_sub_elements() const { return 3; } /// Create a new finite element for sub element i (for a mixed element) virtual ufc::finite_element* create_sub_element(std::size_t i) const { switch (i) { case 0: { return new ffc_form_eca19265a2ab59013b3209e1c7e9bf6a8033d711_finite_element_1(); break; } case 1: { return new ffc_form_eca19265a2ab59013b3209e1c7e9bf6a8033d711_finite_element_1(); break; } case 2: { return new ffc_form_eca19265a2ab59013b3209e1c7e9bf6a8033d711_finite_element_1(); break; } } return 0; } /// Create a new class instance virtual ufc::finite_element* create() const { return new ffc_form_eca19265a2ab59013b3209e1c7e9bf6a8033d711_finite_element_2(); } }; /// This class defines the interface for a local-to-global mapping of /// degrees of freedom (dofs). class ffc_form_eca19265a2ab59013b3209e1c7e9bf6a8033d711_dofmap_0: public ufc::dofmap { public: /// Constructor ffc_form_eca19265a2ab59013b3209e1c7e9bf6a8033d711_dofmap_0() : ufc::dofmap() { // Do nothing } /// Destructor virtual ~ffc_form_eca19265a2ab59013b3209e1c7e9bf6a8033d711_dofmap_0() { // Do nothing } /// Return a string identifying the dofmap virtual const char* signature() const { return "FFC dofmap for FiniteElement('Nedelec 1st kind H(curl)', Domain(Cell('tetrahedron', 3)), 1, None)"; } /// Return true iff mesh entities of topological dimension d are needed virtual bool needs_mesh_entities(std::size_t d) const { switch (d) { case 0: { return false; break; } case 1: { return true; break; } case 2: { return false; break; } case 3: { return false; break; } } return false; } /// Return the topological dimension of the associated cell shape virtual std::size_t topological_dimension() const { return 3; } /// Return the geometric dimension of the associated cell shape virtual std::size_t geometric_dimension() const { return 3; } /// Return the dimension of the global finite element function space virtual std::size_t global_dimension(const std::vector<std::size_t>& num_global_entities) const { return num_global_entities[1]; } /// Return the dimension of the local finite element function space for a cell virtual std::size_t num_element_dofs() const { return 6; } /// Return the number of dofs on each cell facet virtual std::size_t num_facet_dofs() const { return 3; } /// Return the number of dofs associated with each cell entity of dimension d virtual std::size_t num_entity_dofs(std::size_t d) const { switch (d) { case 0: { return 0; break; } case 1: { return 1; break; } case 2: { return 0; break; } case 3: { return 0; break; } } return 0; } /// Tabulate the local-to-global mapping of dofs on a cell virtual void tabulate_dofs(std::size_t* dofs, const std::vector<std::size_t>& num_global_entities, const ufc::cell& c) const { dofs[0] = c.entity_indices[1][0]; dofs[1] = c.entity_indices[1][1]; dofs[2] = c.entity_indices[1][2]; dofs[3] = c.entity_indices[1][3]; dofs[4] = c.entity_indices[1][4]; dofs[5] = c.entity_indices[1][5]; } /// Tabulate the local-to-local mapping from facet dofs to cell dofs virtual void tabulate_facet_dofs(std::size_t* dofs, std::size_t facet) const { switch (facet) { case 0: { dofs[0] = 0; dofs[1] = 1; dofs[2] = 2; break; } case 1: { dofs[0] = 0; dofs[1] = 3; dofs[2] = 4; break; } case 2: { dofs[0] = 1; dofs[1] = 3; dofs[2] = 5; break; } case 3: { dofs[0] = 2; dofs[1] = 4; dofs[2] = 5; break; } } } /// Tabulate the local-to-local mapping of dofs on entity (d, i) virtual void tabulate_entity_dofs(std::size_t* dofs, std::size_t d, std::size_t i) const { if (d > 3) { throw std::runtime_error("d is larger than dimension (3)"); } switch (d) { case 0: { break; } case 1: { if (i > 5) { throw std::runtime_error("i is larger than number of entities (5)"); } switch (i) { case 0: { dofs[0] = 0; break; } case 1: { dofs[0] = 1; break; } case 2: { dofs[0] = 2; break; } case 3: { dofs[0] = 3; break; } case 4: { dofs[0] = 4; break; } case 5: { dofs[0] = 5; break; } } break; } case 2: { break; } case 3: { break; } } } /// Tabulate the coordinates of all dofs on a cell virtual void tabulate_coordinates(double* dof_coordinates, const double* vertex_coordinates) const { dof_coordinates[0] = 0.5*vertex_coordinates[6] + 0.5*vertex_coordinates[9]; dof_coordinates[1] = 0.5*vertex_coordinates[7] + 0.5*vertex_coordinates[10]; dof_coordinates[2] = 0.5*vertex_coordinates[8] + 0.5*vertex_coordinates[11]; dof_coordinates[3] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[9]; dof_coordinates[4] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[10]; dof_coordinates[5] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[11]; dof_coordinates[6] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[6]; dof_coordinates[7] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[7]; dof_coordinates[8] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[8]; dof_coordinates[9] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[9]; dof_coordinates[10] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[10]; dof_coordinates[11] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[11]; dof_coordinates[12] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[6]; dof_coordinates[13] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[7]; dof_coordinates[14] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[8]; dof_coordinates[15] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[3]; dof_coordinates[16] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[4]; dof_coordinates[17] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[5]; } /// Return the number of sub dofmaps (for a mixed element) virtual std::size_t num_sub_dofmaps() const { return 0; } /// Create a new dofmap for sub dofmap i (for a mixed element) virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const { return 0; } /// Create a new class instance virtual ufc::dofmap* create() const { return new ffc_form_eca19265a2ab59013b3209e1c7e9bf6a8033d711_dofmap_0(); } }; /// This class defines the interface for a local-to-global mapping of /// degrees of freedom (dofs). class ffc_form_eca19265a2ab59013b3209e1c7e9bf6a8033d711_dofmap_1: public ufc::dofmap { public: /// Constructor ffc_form_eca19265a2ab59013b3209e1c7e9bf6a8033d711_dofmap_1() : ufc::dofmap() { // Do nothing } /// Destructor virtual ~ffc_form_eca19265a2ab59013b3209e1c7e9bf6a8033d711_dofmap_1() { // Do nothing } /// Return a string identifying the dofmap virtual const char* signature() const { return "FFC dofmap for FiniteElement('Lagrange', Domain(Cell('tetrahedron', 3)), 2, None)"; } /// Return true iff mesh entities of topological dimension d are needed virtual bool needs_mesh_entities(std::size_t d) const { switch (d) { case 0: { return true; break; } case 1: { return true; break; } case 2: { return false; break; } case 3: { return false; break; } } return false; } /// Return the topological dimension of the associated cell shape virtual std::size_t topological_dimension() const { return 3; } /// Return the geometric dimension of the associated cell shape virtual std::size_t geometric_dimension() const { return 3; } /// Return the dimension of the global finite element function space virtual std::size_t global_dimension(const std::vector<std::size_t>& num_global_entities) const { return num_global_entities[0] + num_global_entities[1]; } /// Return the dimension of the local finite element function space for a cell virtual std::size_t num_element_dofs() const { return 10; } /// Return the number of dofs on each cell facet virtual std::size_t num_facet_dofs() const { return 6; } /// Return the number of dofs associated with each cell entity of dimension d virtual std::size_t num_entity_dofs(std::size_t d) const { switch (d) { case 0: { return 1; break; } case 1: { return 1; break; } case 2: { return 0; break; } case 3: { return 0; break; } } return 0; } /// Tabulate the local-to-global mapping of dofs on a cell virtual void tabulate_dofs(std::size_t* dofs, const std::vector<std::size_t>& num_global_entities, const ufc::cell& c) const { unsigned int offset = 0; dofs[0] = offset + c.entity_indices[0][0]; dofs[1] = offset + c.entity_indices[0][1]; dofs[2] = offset + c.entity_indices[0][2]; dofs[3] = offset + c.entity_indices[0][3]; offset += num_global_entities[0]; dofs[4] = offset + c.entity_indices[1][0]; dofs[5] = offset + c.entity_indices[1][1]; dofs[6] = offset + c.entity_indices[1][2]; dofs[7] = offset + c.entity_indices[1][3]; dofs[8] = offset + c.entity_indices[1][4]; dofs[9] = offset + c.entity_indices[1][5]; offset += num_global_entities[1]; } /// Tabulate the local-to-local mapping from facet dofs to cell dofs virtual void tabulate_facet_dofs(std::size_t* dofs, std::size_t facet) const { switch (facet) { case 0: { dofs[0] = 1; dofs[1] = 2; dofs[2] = 3; dofs[3] = 4; dofs[4] = 5; dofs[5] = 6; break; } case 1: { dofs[0] = 0; dofs[1] = 2; dofs[2] = 3; dofs[3] = 4; dofs[4] = 7; dofs[5] = 8; break; } case 2: { dofs[0] = 0; dofs[1] = 1; dofs[2] = 3; dofs[3] = 5; dofs[4] = 7; dofs[5] = 9; break; } case 3: { dofs[0] = 0; dofs[1] = 1; dofs[2] = 2; dofs[3] = 6; dofs[4] = 8; dofs[5] = 9; break; } } } /// Tabulate the local-to-local mapping of dofs on entity (d, i) virtual void tabulate_entity_dofs(std::size_t* dofs, std::size_t d, std::size_t i) const { if (d > 3) { throw std::runtime_error("d is larger than dimension (3)"); } switch (d) { case 0: { if (i > 3) { throw std::runtime_error("i is larger than number of entities (3)"); } switch (i) { case 0: { dofs[0] = 0; break; } case 1: { dofs[0] = 1; break; } case 2: { dofs[0] = 2; break; } case 3: { dofs[0] = 3; break; } } break; } case 1: { if (i > 5) { throw std::runtime_error("i is larger than number of entities (5)"); } switch (i) { case 0: { dofs[0] = 4; break; } case 1: { dofs[0] = 5; break; } case 2: { dofs[0] = 6; break; } case 3: { dofs[0] = 7; break; } case 4: { dofs[0] = 8; break; } case 5: { dofs[0] = 9; break; } } break; } case 2: { break; } case 3: { break; } } } /// Tabulate the coordinates of all dofs on a cell virtual void tabulate_coordinates(double* dof_coordinates, const double* vertex_coordinates) const { dof_coordinates[0] = vertex_coordinates[0]; dof_coordinates[1] = vertex_coordinates[1]; dof_coordinates[2] = vertex_coordinates[2]; dof_coordinates[3] = vertex_coordinates[3]; dof_coordinates[4] = vertex_coordinates[4]; dof_coordinates[5] = vertex_coordinates[5]; dof_coordinates[6] = vertex_coordinates[6]; dof_coordinates[7] = vertex_coordinates[7]; dof_coordinates[8] = vertex_coordinates[8]; dof_coordinates[9] = vertex_coordinates[9]; dof_coordinates[10] = vertex_coordinates[10]; dof_coordinates[11] = vertex_coordinates[11]; dof_coordinates[12] = 0.5*vertex_coordinates[6] + 0.5*vertex_coordinates[9]; dof_coordinates[13] = 0.5*vertex_coordinates[7] + 0.5*vertex_coordinates[10]; dof_coordinates[14] = 0.5*vertex_coordinates[8] + 0.5*vertex_coordinates[11]; dof_coordinates[15] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[9]; dof_coordinates[16] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[10]; dof_coordinates[17] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[11]; dof_coordinates[18] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[6]; dof_coordinates[19] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[7]; dof_coordinates[20] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[8]; dof_coordinates[21] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[9]; dof_coordinates[22] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[10]; dof_coordinates[23] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[11]; dof_coordinates[24] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[6]; dof_coordinates[25] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[7]; dof_coordinates[26] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[8]; dof_coordinates[27] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[3]; dof_coordinates[28] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[4]; dof_coordinates[29] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[5]; } /// Return the number of sub dofmaps (for a mixed element) virtual std::size_t num_sub_dofmaps() const { return 0; } /// Create a new dofmap for sub dofmap i (for a mixed element) virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const { return 0; } /// Create a new class instance virtual ufc::dofmap* create() const { return new ffc_form_eca19265a2ab59013b3209e1c7e9bf6a8033d711_dofmap_1(); } }; /// This class defines the interface for a local-to-global mapping of /// degrees of freedom (dofs). class ffc_form_eca19265a2ab59013b3209e1c7e9bf6a8033d711_dofmap_2: public ufc::dofmap { public: /// Constructor ffc_form_eca19265a2ab59013b3209e1c7e9bf6a8033d711_dofmap_2() : ufc::dofmap() { // Do nothing } /// Destructor virtual ~ffc_form_eca19265a2ab59013b3209e1c7e9bf6a8033d711_dofmap_2() { // Do nothing } /// Return a string identifying the dofmap virtual const char* signature() const { return "FFC dofmap for VectorElement('Lagrange', Domain(Cell('tetrahedron', 3)), 2, 3, None)"; } /// Return true iff mesh entities of topological dimension d are needed virtual bool needs_mesh_entities(std::size_t d) const { switch (d) { case 0: { return true; break; } case 1: { return true; break; } case 2: { return false; break; } case 3: { return false; break; } } return false; } /// Return the topological dimension of the associated cell shape virtual std::size_t topological_dimension() const { return 3; } /// Return the geometric dimension of the associated cell shape virtual std::size_t geometric_dimension() const { return 3; } /// Return the dimension of the global finite element function space virtual std::size_t global_dimension(const std::vector<std::size_t>& num_global_entities) const { return 3*num_global_entities[0] + 3*num_global_entities[1]; } /// Return the dimension of the local finite element function space for a cell virtual std::size_t num_element_dofs() const { return 30; } /// Return the number of dofs on each cell facet virtual std::size_t num_facet_dofs() const { return 18; } /// Return the number of dofs associated with each cell entity of dimension d virtual std::size_t num_entity_dofs(std::size_t d) const { switch (d) { case 0: { return 3; break; } case 1: { return 3; break; } case 2: { return 0; break; } case 3: { return 0; break; } } return 0; } /// Tabulate the local-to-global mapping of dofs on a cell virtual void tabulate_dofs(std::size_t* dofs, const std::vector<std::size_t>& num_global_entities, const ufc::cell& c) const { unsigned int offset = 0; dofs[0] = offset + c.entity_indices[0][0]; dofs[1] = offset + c.entity_indices[0][1]; dofs[2] = offset + c.entity_indices[0][2]; dofs[3] = offset + c.entity_indices[0][3]; offset += num_global_entities[0]; dofs[4] = offset + c.entity_indices[1][0]; dofs[5] = offset + c.entity_indices[1][1]; dofs[6] = offset + c.entity_indices[1][2]; dofs[7] = offset + c.entity_indices[1][3]; dofs[8] = offset + c.entity_indices[1][4]; dofs[9] = offset + c.entity_indices[1][5]; offset += num_global_entities[1]; dofs[10] = offset + c.entity_indices[0][0]; dofs[11] = offset + c.entity_indices[0][1]; dofs[12] = offset + c.entity_indices[0][2]; dofs[13] = offset + c.entity_indices[0][3]; offset += num_global_entities[0]; dofs[14] = offset + c.entity_indices[1][0]; dofs[15] = offset + c.entity_indices[1][1]; dofs[16] = offset + c.entity_indices[1][2]; dofs[17] = offset + c.entity_indices[1][3]; dofs[18] = offset + c.entity_indices[1][4]; dofs[19] = offset + c.entity_indices[1][5]; offset += num_global_entities[1]; dofs[20] = offset + c.entity_indices[0][0]; dofs[21] = offset + c.entity_indices[0][1]; dofs[22] = offset + c.entity_indices[0][2]; dofs[23] = offset + c.entity_indices[0][3]; offset += num_global_entities[0]; dofs[24] = offset + c.entity_indices[1][0]; dofs[25] = offset + c.entity_indices[1][1]; dofs[26] = offset + c.entity_indices[1][2]; dofs[27] = offset + c.entity_indices[1][3]; dofs[28] = offset + c.entity_indices[1][4]; dofs[29] = offset + c.entity_indices[1][5]; offset += num_global_entities[1]; } /// Tabulate the local-to-local mapping from facet dofs to cell dofs virtual void tabulate_facet_dofs(std::size_t* dofs, std::size_t facet) const { switch (facet) { case 0: { dofs[0] = 1; dofs[1] = 2; dofs[2] = 3; dofs[3] = 4; dofs[4] = 5; dofs[5] = 6; dofs[6] = 11; dofs[7] = 12; dofs[8] = 13; dofs[9] = 14; dofs[10] = 15; dofs[11] = 16; dofs[12] = 21; dofs[13] = 22; dofs[14] = 23; dofs[15] = 24; dofs[16] = 25; dofs[17] = 26; break; } case 1: { dofs[0] = 0; dofs[1] = 2; dofs[2] = 3; dofs[3] = 4; dofs[4] = 7; dofs[5] = 8; dofs[6] = 10; dofs[7] = 12; dofs[8] = 13; dofs[9] = 14; dofs[10] = 17; dofs[11] = 18; dofs[12] = 20; dofs[13] = 22; dofs[14] = 23; dofs[15] = 24; dofs[16] = 27; dofs[17] = 28; break; } case 2: { dofs[0] = 0; dofs[1] = 1; dofs[2] = 3; dofs[3] = 5; dofs[4] = 7; dofs[5] = 9; dofs[6] = 10; dofs[7] = 11; dofs[8] = 13; dofs[9] = 15; dofs[10] = 17; dofs[11] = 19; dofs[12] = 20; dofs[13] = 21; dofs[14] = 23; dofs[15] = 25; dofs[16] = 27; dofs[17] = 29; break; } case 3: { dofs[0] = 0; dofs[1] = 1; dofs[2] = 2; dofs[3] = 6; dofs[4] = 8; dofs[5] = 9; dofs[6] = 10; dofs[7] = 11; dofs[8] = 12; dofs[9] = 16; dofs[10] = 18; dofs[11] = 19; dofs[12] = 20; dofs[13] = 21; dofs[14] = 22; dofs[15] = 26; dofs[16] = 28; dofs[17] = 29; break; } } } /// Tabulate the local-to-local mapping of dofs on entity (d, i) virtual void tabulate_entity_dofs(std::size_t* dofs, std::size_t d, std::size_t i) const { if (d > 3) { throw std::runtime_error("d is larger than dimension (3)"); } switch (d) { case 0: { if (i > 3) { throw std::runtime_error("i is larger than number of entities (3)"); } switch (i) { case 0: { dofs[0] = 0; dofs[1] = 10; dofs[2] = 20; break; } case 1: { dofs[0] = 1; dofs[1] = 11; dofs[2] = 21; break; } case 2: { dofs[0] = 2; dofs[1] = 12; dofs[2] = 22; break; } case 3: { dofs[0] = 3; dofs[1] = 13; dofs[2] = 23; break; } } break; } case 1: { if (i > 5) { throw std::runtime_error("i is larger than number of entities (5)"); } switch (i) { case 0: { dofs[0] = 4; dofs[1] = 14; dofs[2] = 24; break; } case 1: { dofs[0] = 5; dofs[1] = 15; dofs[2] = 25; break; } case 2: { dofs[0] = 6; dofs[1] = 16; dofs[2] = 26; break; } case 3: { dofs[0] = 7; dofs[1] = 17; dofs[2] = 27; break; } case 4: { dofs[0] = 8; dofs[1] = 18; dofs[2] = 28; break; } case 5: { dofs[0] = 9; dofs[1] = 19; dofs[2] = 29; break; } } break; } case 2: { break; } case 3: { break; } } } /// Tabulate the coordinates of all dofs on a cell virtual void tabulate_coordinates(double* dof_coordinates, const double* vertex_coordinates) const { dof_coordinates[0] = vertex_coordinates[0]; dof_coordinates[1] = vertex_coordinates[1]; dof_coordinates[2] = vertex_coordinates[2]; dof_coordinates[3] = vertex_coordinates[3]; dof_coordinates[4] = vertex_coordinates[4]; dof_coordinates[5] = vertex_coordinates[5]; dof_coordinates[6] = vertex_coordinates[6]; dof_coordinates[7] = vertex_coordinates[7]; dof_coordinates[8] = vertex_coordinates[8]; dof_coordinates[9] = vertex_coordinates[9]; dof_coordinates[10] = vertex_coordinates[10]; dof_coordinates[11] = vertex_coordinates[11]; dof_coordinates[12] = 0.5*vertex_coordinates[6] + 0.5*vertex_coordinates[9]; dof_coordinates[13] = 0.5*vertex_coordinates[7] + 0.5*vertex_coordinates[10]; dof_coordinates[14] = 0.5*vertex_coordinates[8] + 0.5*vertex_coordinates[11]; dof_coordinates[15] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[9]; dof_coordinates[16] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[10]; dof_coordinates[17] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[11]; dof_coordinates[18] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[6]; dof_coordinates[19] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[7]; dof_coordinates[20] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[8]; dof_coordinates[21] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[9]; dof_coordinates[22] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[10]; dof_coordinates[23] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[11]; dof_coordinates[24] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[6]; dof_coordinates[25] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[7]; dof_coordinates[26] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[8]; dof_coordinates[27] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[3]; dof_coordinates[28] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[4]; dof_coordinates[29] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[5]; dof_coordinates[30] = vertex_coordinates[0]; dof_coordinates[31] = vertex_coordinates[1]; dof_coordinates[32] = vertex_coordinates[2]; dof_coordinates[33] = vertex_coordinates[3]; dof_coordinates[34] = vertex_coordinates[4]; dof_coordinates[35] = vertex_coordinates[5]; dof_coordinates[36] = vertex_coordinates[6]; dof_coordinates[37] = vertex_coordinates[7]; dof_coordinates[38] = vertex_coordinates[8]; dof_coordinates[39] = vertex_coordinates[9]; dof_coordinates[40] = vertex_coordinates[10]; dof_coordinates[41] = vertex_coordinates[11]; dof_coordinates[42] = 0.5*vertex_coordinates[6] + 0.5*vertex_coordinates[9]; dof_coordinates[43] = 0.5*vertex_coordinates[7] + 0.5*vertex_coordinates[10]; dof_coordinates[44] = 0.5*vertex_coordinates[8] + 0.5*vertex_coordinates[11]; dof_coordinates[45] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[9]; dof_coordinates[46] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[10]; dof_coordinates[47] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[11]; dof_coordinates[48] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[6]; dof_coordinates[49] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[7]; dof_coordinates[50] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[8]; dof_coordinates[51] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[9]; dof_coordinates[52] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[10]; dof_coordinates[53] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[11]; dof_coordinates[54] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[6]; dof_coordinates[55] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[7]; dof_coordinates[56] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[8]; dof_coordinates[57] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[3]; dof_coordinates[58] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[4]; dof_coordinates[59] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[5]; dof_coordinates[60] = vertex_coordinates[0]; dof_coordinates[61] = vertex_coordinates[1]; dof_coordinates[62] = vertex_coordinates[2]; dof_coordinates[63] = vertex_coordinates[3]; dof_coordinates[64] = vertex_coordinates[4]; dof_coordinates[65] = vertex_coordinates[5]; dof_coordinates[66] = vertex_coordinates[6]; dof_coordinates[67] = vertex_coordinates[7]; dof_coordinates[68] = vertex_coordinates[8]; dof_coordinates[69] = vertex_coordinates[9]; dof_coordinates[70] = vertex_coordinates[10]; dof_coordinates[71] = vertex_coordinates[11]; dof_coordinates[72] = 0.5*vertex_coordinates[6] + 0.5*vertex_coordinates[9]; dof_coordinates[73] = 0.5*vertex_coordinates[7] + 0.5*vertex_coordinates[10]; dof_coordinates[74] = 0.5*vertex_coordinates[8] + 0.5*vertex_coordinates[11]; dof_coordinates[75] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[9]; dof_coordinates[76] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[10]; dof_coordinates[77] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[11]; dof_coordinates[78] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[6]; dof_coordinates[79] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[7]; dof_coordinates[80] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[8]; dof_coordinates[81] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[9]; dof_coordinates[82] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[10]; dof_coordinates[83] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[11]; dof_coordinates[84] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[6]; dof_coordinates[85] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[7]; dof_coordinates[86] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[8]; dof_coordinates[87] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[3]; dof_coordinates[88] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[4]; dof_coordinates[89] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[5]; } /// Return the number of sub dofmaps (for a mixed element) virtual std::size_t num_sub_dofmaps() const { return 3; } /// Create a new dofmap for sub dofmap i (for a mixed element) virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const { switch (i) { case 0: { return new ffc_form_eca19265a2ab59013b3209e1c7e9bf6a8033d711_dofmap_1(); break; } case 1: { return new ffc_form_eca19265a2ab59013b3209e1c7e9bf6a8033d711_dofmap_1(); break; } case 2: { return new ffc_form_eca19265a2ab59013b3209e1c7e9bf6a8033d711_dofmap_1(); break; } } return 0; } /// Create a new class instance virtual ufc::dofmap* create() const { return new ffc_form_eca19265a2ab59013b3209e1c7e9bf6a8033d711_dofmap_2(); } }; /// This class defines the interface for the tabulation of the cell /// tensor corresponding to the local contribution to a form from /// the integral over a cell. class ffc_form_eca19265a2ab59013b3209e1c7e9bf6a8033d711_cell_integral_0_otherwise: public ufc::cell_integral { public: /// Constructor ffc_form_eca19265a2ab59013b3209e1c7e9bf6a8033d711_cell_integral_0_otherwise() : ufc::cell_integral() { // Do nothing } /// Destructor virtual ~ffc_form_eca19265a2ab59013b3209e1c7e9bf6a8033d711_cell_integral_0_otherwise() { // Do nothing } /// Tabulate which form coefficients are used by this integral virtual const std::vector<bool> & enabled_coefficients() const { static const std::vector<bool> enabled({true, true}); return enabled; } /// Tabulate the tensor for the contribution from a local cell virtual void tabulate_tensor(double* A, const double * const * w, const double* vertex_coordinates, int cell_orientation) const { // Compute Jacobian double J[9]; compute_jacobian_tetrahedron_3d(J, vertex_coordinates); // Compute Jacobian inverse and determinant double K[9]; double detJ; compute_jacobian_inverse_tetrahedron_3d(K, detJ, J); // Set scale factor const double det = std::abs(detJ); // Compute cell volume // Compute circumradius // Array of quadrature weights. static const double W24[24] = {0.00665379170969465, 0.00665379170969465, 0.00665379170969465, 0.00665379170969465, 0.00167953517588678, 0.00167953517588678, 0.00167953517588678, 0.00167953517588678, 0.0092261969239424, 0.0092261969239424, 0.0092261969239424, 0.0092261969239424, 0.00803571428571428, 0.00803571428571428, 0.00803571428571428, 0.00803571428571428, 0.00803571428571428, 0.00803571428571428, 0.00803571428571428, 0.00803571428571428, 0.00803571428571428, 0.00803571428571428, 0.00803571428571428, 0.00803571428571428}; // Quadrature points on the UFC reference element: (0.356191386222545, 0.214602871259152, 0.214602871259152), (0.214602871259152, 0.214602871259152, 0.214602871259152), (0.214602871259152, 0.214602871259152, 0.356191386222545), (0.214602871259152, 0.356191386222545, 0.214602871259152), (0.877978124396166, 0.0406739585346113, 0.0406739585346113), (0.0406739585346113, 0.0406739585346113, 0.0406739585346113), (0.0406739585346113, 0.0406739585346113, 0.877978124396166), (0.0406739585346113, 0.877978124396166, 0.0406739585346113), (0.0329863295731731, 0.322337890142276, 0.322337890142276), (0.322337890142276, 0.322337890142276, 0.322337890142276), (0.322337890142276, 0.322337890142276, 0.0329863295731731), (0.322337890142276, 0.0329863295731731, 0.322337890142276), (0.269672331458316, 0.0636610018750175, 0.0636610018750175), (0.0636610018750175, 0.269672331458316, 0.0636610018750175), (0.0636610018750175, 0.0636610018750175, 0.269672331458316), (0.603005664791649, 0.0636610018750175, 0.0636610018750175), (0.0636610018750175, 0.603005664791649, 0.0636610018750175), (0.0636610018750175, 0.0636610018750175, 0.603005664791649), (0.0636610018750175, 0.269672331458316, 0.603005664791649), (0.269672331458316, 0.603005664791649, 0.0636610018750175), (0.603005664791649, 0.0636610018750175, 0.269672331458316), (0.0636610018750175, 0.603005664791649, 0.269672331458316), (0.269672331458316, 0.0636610018750175, 0.603005664791649), (0.603005664791649, 0.269672331458316, 0.0636610018750175) // Values of basis functions at quadrature points. static const double FE1_C0[24][30] = \ {{-0.122494086553808, -0.102446778984269, -0.122494086553808, -0.122494086553808, 0.184217569410688, 0.305758776804542, 0.305758776804542, 0.184217569410688, 0.184217569410688, 0.305758776804542, 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.102446778984269, -0.122494086553808, -0.122494086553808, -0.122494086553808, 0.184217569410688, 0.184217569410688, 0.184217569410688, 0.305758776804542, 0.305758776804542, 0.305758776804542, 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.122494086553808, -0.122494086553808, -0.122494086553808, -0.102446778984269, 0.305758776804542, 0.305758776804542, 0.184217569410688, 0.305758776804542, 0.184217569410688, 0.184217569410688, 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.122494086553808, -0.122494086553808, -0.102446778984269, -0.122494086553808, 0.305758776804542, 0.184217569410688, 0.305758776804542, 0.184217569410688, 0.305758776804542, 0.184217569410688, 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.0373652167288608, 0.663713049440253, -0.0373652167288607, -0.0373652167288607, 0.00661748361150104, 0.142843383303942, 0.142843383303942, 0.00661748361150104, 0.00661748361150125, 0.142843383303942, 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.663713049440253, -0.0373652167288607, -0.0373652167288607, -0.0373652167288607, 0.00661748361150104, 0.00661748361150113, 0.00661748361150104, 0.142843383303942, 0.142843383303942, 0.142843383303942, 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.0373652167288608, -0.0373652167288607, -0.0373652167288607, 0.663713049440253, 0.142843383303942, 0.142843383303942, 0.00661748361150118, 0.142843383303942, 0.00661748361150114, 0.00661748361150118, 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.0373652167288609, -0.0373652167288608, 0.663713049440253, -0.0373652167288607, 0.142843383303942, 0.00661748361150115, 0.142843383303942, 0.00661748361150096, 0.142843383303942, 0.00661748361150115, 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.114534459299528, -0.0308101336957531, -0.114534459299528, -0.114534459299528, 0.415606861685495, 0.0425309755126176, 0.0425309755126175, 0.415606861685495, 0.415606861685495, 0.0425309755126175, 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.0308101336957529, -0.114534459299528, -0.114534459299528, -0.114534459299528, 0.415606861685495, 0.415606861685495, 0.415606861685495, 0.0425309755126171, 0.0425309755126172, 0.0425309755126172, 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.114534459299528, -0.114534459299528, -0.114534459299528, -0.0308101336957531, 0.0425309755126174, 0.0425309755126175, 0.415606861685495, 0.0425309755126174, 0.415606861685495, 0.415606861685495, 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.114534459299528, -0.114534459299528, -0.0308101336957531, -0.114534459299528, 0.0425309755126173, 0.415606861685495, 0.0425309755126174, 0.415606861685495, 0.0425309755126175, 0.415606861685495, 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.124225998749988, -0.124225998749988, -0.0555555555555555, -0.0555555555555555, 0.0162108926389238, 0.0686704431944328, 0.0686704431944327, 0.153551779027789, 0.153551779027789, 0.650455774027743, 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.124225998749988, -0.0555555555555555, -0.124225998749988, -0.0555555555555555, 0.0686704431944327, 0.0162108926389239, 0.0686704431944327, 0.153551779027789, 0.650455774027743, 0.153551779027789, 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.124225998749988, -0.0555555555555555, -0.0555555555555555, -0.124225998749988, 0.0686704431944326, 0.0686704431944328, 0.0162108926389239, 0.650455774027743, 0.153551779027789, 0.153551779027789, 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.124225998749988, 0.124225998749988, -0.0555555555555555, -0.0555555555555555, 0.0162108926389238, 0.153551779027789, 0.153551779027789, 0.0686704431944327, 0.0686704431944328, 0.650455774027743, 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.124225998749988, -0.0555555555555555, 0.124225998749988, -0.0555555555555555, 0.153551779027789, 0.016210892638924, 0.153551779027789, 0.0686704431944327, 0.650455774027743, 0.0686704431944328, 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.124225998749988, -0.0555555555555555, -0.0555555555555555, 0.124225998749988, 0.153551779027789, 0.153551779027789, 0.0162108926389239, 0.650455774027743, 0.0686704431944328, 0.0686704431944328, 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.0555555555555555, -0.0555555555555555, -0.124225998749988, 0.124225998749988, 0.650455774027743, 0.153551779027789, 0.0686704431944327, 0.153551779027789, 0.0686704431944328, 0.016210892638924, 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.0555555555555556, -0.124225998749988, 0.124225998749988, -0.0555555555555555, 0.153551779027789, 0.0686704431944328, 0.650455774027743, 0.0162108926389238, 0.15355177902779, 0.0686704431944328, 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.0555555555555556, 0.124225998749988, -0.0555555555555555, -0.124225998749988, 0.0686704431944325, 0.650455774027743, 0.153551779027789, 0.0686704431944328, 0.016210892638924, 0.15355177902779, 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.0555555555555556, -0.0555555555555556, 0.124225998749988, -0.124225998749988, 0.650455774027743, 0.0686704431944328, 0.153551779027789, 0.0686704431944327, 0.15355177902779, 0.016210892638924, 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.0555555555555555, -0.124225998749988, -0.0555555555555555, 0.124225998749988, 0.153551779027789, 0.650455774027743, 0.0686704431944327, 0.153551779027789, 0.0162108926389239, 0.0686704431944328, 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.0555555555555556, 0.124225998749988, -0.124225998749988, -0.0555555555555555, 0.0686704431944326, 0.153551779027789, 0.650455774027743, 0.0162108926389239, 0.0686704431944329, 0.15355177902779, 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}}; static const double FE1_C0_D001[24][30] = \ {{0.141588514963394, 0.0, 0.0, -0.141588514963397, 0.858411485036608, 1.42476554489019, 0.0, 0.0, -0.858411485036606, -1.42476554489018, 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.424765544890179, 0.0, 0.0, -0.141588514963397, 0.858411485036608, 0.858411485036613, 0.0, 0.566354059853573, -0.858411485036607, -0.858411485036607, 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.141588514963394, 0.0, 0.0, 0.424765544890176, 0.858411485036607, 0.858411485036613, 0.0, -0.566354059853573, -0.858411485036606, -0.858411485036607, 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.141588514963394, 0.0, 0.0, -0.141588514963397, 1.42476554489018, 0.858411485036613, 0.0, 0.0, -1.42476554489018, -0.858411485036607, 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.837304165861558, 0.0, 0.0, -0.837304165861558, 0.162695834138448, 3.51191249758467, 0.0, 0.0, -0.162695834138445, -3.51191249758466, 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}, {-2.51191249758467, 0.0, 0.0, -0.837304165861559, 0.162695834138448, 0.162695834138448, 0.0, 3.34921666344622, -0.162695834138446, -0.162695834138444, 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.837304165861556, 0.0, 0.0, 2.51191249758466, 0.162695834138441, 0.162695834138453, 0.0, -3.34921666344622, -0.162695834138443, -0.162695834138447, 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.837304165861555, 0.0, 0.0, -0.837304165861559, 3.51191249758467, 0.162695834138448, 0.0, 0.0, -3.51191249758467, -0.162695834138446, 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.289351560569101, 0.0, 0.0, 0.289351560569099, 1.2893515605691, 0.1319453182927, 0.0, 0.0, -1.2893515605691, -0.131945318292693, 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.868054681707309, 0.0, 0.0, 0.289351560569099, 1.2893515605691, 1.28935156056911, 0.0, -1.15740624227641, -1.2893515605691, -1.2893515605691, 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.289351560569101, 0.0, 0.0, -0.868054681707312, 1.28935156056911, 1.28935156056911, 0.0, 1.15740624227641, -1.2893515605691, -1.2893515605691, 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.289351560569102, 0.0, 0.0, 0.289351560569099, 0.131945318292692, 1.28935156056911, 0.0, 0.0, -0.131945318292692, -1.2893515605691, 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}, {-1.4120226591666, 0.0, 0.0, -0.745355992499934, 0.254644007500072, 1.07868932583327, 0.0, 2.15737865166653, -0.25464400750007, -1.07868932583326, 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}, {-1.4120226591666, 0.0, 0.0, -0.745355992499935, 1.07868932583327, 0.254644007500076, 0.0, 2.15737865166653, -1.07868932583326, -0.25464400750007, 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}, {-1.4120226591666, 0.0, 0.0, 0.0786893258332599, 0.25464400750007, 0.254644007500076, 0.0, 1.33333333333333, -0.25464400750007, -0.254644007500071, 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.0786893258332623, 0.0, 0.0, -0.745355992499934, 0.254644007500072, 2.4120226591666, 0.0, 0.824045318333192, -0.25464400750007, -2.4120226591666, 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.0786893258332624, 0.0, 0.0, -0.745355992499935, 2.4120226591666, 0.254644007500076, 0.0, 0.824045318333193, -2.4120226591666, -0.25464400750007, 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.0786893258332625, 0.0, 0.0, 1.41202265916659, 0.254644007500067, 0.254644007500078, 0.0, -1.33333333333333, -0.254644007500068, -0.254644007500072, 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.745355992499931, 0.0, 0.0, 1.41202265916659, 1.07868932583326, 0.254644007500077, 0.0, -2.15737865166653, -1.07868932583326, -0.25464400750007, 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.74535599249993, 0.0, 0.0, -0.745355992499934, 2.4120226591666, 1.07868932583327, 0.0, 0.0, -2.4120226591666, -1.07868932583326, 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.745355992499931, 0.0, 0.0, 0.0786893258332599, 0.25464400750007, 2.41202265916661, 0.0, -0.824045318333195, -0.254644007500069, -2.4120226591666, 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.745355992499931, 0.0, 0.0, 0.07868932583326, 2.4120226591666, 0.254644007500075, 0.0, -0.824045318333194, -2.4120226591666, -0.254644007500069, 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.74535599249993, 0.0, 0.0, 1.41202265916659, 0.254644007500068, 1.07868932583327, 0.0, -2.15737865166653, -0.254644007500069, -1.07868932583327, 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.745355992499931, 0.0, 0.0, -0.745355992499934, 1.07868932583327, 2.4120226591666, 0.0, 0.0, -1.07868932583326, -2.4120226591666, 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}}; static const double FE1_C0_D010[24][30] = \ {{0.141588514963394, 0.0, -0.141588514963396, 0.0, 0.858411485036608, 0.0, 1.42476554489019, -0.858411485036607, 0.0, -1.42476554489018, 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.424765544890179, 0.0, -0.141588514963397, 0.0, 0.858411485036608, 0.0, 0.858411485036612, -0.858411485036608, 0.566354059853573, -0.858411485036608, 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.141588514963394, 0.0, -0.141588514963396, 0.0, 1.42476554489018, 0.0, 0.858411485036612, -1.42476554489018, 0.0, -0.858411485036607, 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.141588514963394, 0.0, 0.424765544890176, 0.0, 0.858411485036608, 0.0, 0.858411485036613, -0.858411485036607, -0.566354059853573, -0.858411485036608, 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.837304165861558, 0.0, -0.837304165861557, 0.0, 0.162695834138445, 0.0, 3.51191249758467, -0.162695834138445, 0.0, -3.51191249758466, 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}, {-2.51191249758466, 0.0, -0.837304165861557, 0.0, 0.162695834138446, 0.0, 0.162695834138449, -0.162695834138446, 3.34921666344622, -0.162695834138444, 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.837304165861558, 0.0, -0.837304165861556, 0.0, 3.51191249758467, 0.0, 0.162695834138447, -3.51191249758467, 0.0, -0.162695834138445, 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.837304165861557, 0.0, 2.51191249758466, 0.0, 0.162695834138446, 0.0, 0.162695834138453, -0.162695834138446, -3.34921666344622, -0.162695834138447, 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.289351560569101, 0.0, 0.289351560569099, 0.0, 1.2893515605691, 0.0, 0.131945318292698, -1.2893515605691, 0.0, -0.131945318292693, 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.868054681707309, 0.0, 0.2893515605691, 0.0, 1.2893515605691, 0.0, 1.28935156056911, -1.2893515605691, -1.15740624227641, -1.2893515605691, 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.2893515605691, 0.0, 0.289351560569099, 0.0, 0.131945318292693, 0.0, 1.28935156056911, -0.131945318292693, 0.0, -1.2893515605691, 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.2893515605691, 0.0, -0.86805468170731, 0.0, 1.2893515605691, 0.0, 1.28935156056911, -1.2893515605691, 1.15740624227641, -1.2893515605691, 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}, {-1.4120226591666, 0.0, -0.745355992499933, 0.0, 0.254644007500071, 0.0, 1.07868932583327, -0.25464400750007, 2.15737865166653, -1.07868932583326, 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}, {-1.4120226591666, 0.0, 0.0786893258332597, 0.0, 0.254644007500071, 0.0, 0.254644007500077, -0.254644007500071, 1.33333333333333, -0.254644007500071, 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}, {-1.4120226591666, 0.0, -0.745355992499932, 0.0, 1.07868932583327, 0.0, 0.254644007500073, -1.07868932583326, 2.15737865166653, -0.254644007500071, 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.0786893258332615, 0.0, -0.745355992499933, 0.0, 0.25464400750007, 0.0, 2.4120226591666, -0.25464400750007, 0.824045318333192, -2.4120226591666, 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.078689325833262, 0.0, 1.41202265916659, 0.0, 0.254644007500071, 0.0, 0.254644007500078, -0.254644007500071, -1.33333333333333, -0.254644007500072, 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.0786893258332616, 0.0, -0.745355992499932, 0.0, 2.4120226591666, 0.0, 0.254644007500073, -2.4120226591666, 0.824045318333193, -0.25464400750007, 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.745355992499932, 0.0, 0.0786893258332607, 0.0, 2.4120226591666, 0.0, 0.254644007500074, -2.4120226591666, -0.824045318333194, -0.254644007500069, 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.745355992499931, 0.0, 1.41202265916659, 0.0, 0.254644007500071, 0.0, 1.07868932583327, -0.25464400750007, -2.15737865166653, -1.07868932583326, 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.745355992499931, 0.0, -0.745355992499932, 0.0, 1.07868932583327, 0.0, 2.4120226591666, -1.07868932583326, 0.0, -2.4120226591666, 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.745355992499931, 0.0, 1.41202265916659, 0.0, 1.07868932583326, 0.0, 0.254644007500076, -1.07868932583326, -2.15737865166653, -0.25464400750007, 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.745355992499932, 0.0, -0.745355992499932, 0.0, 2.4120226591666, 0.0, 1.07868932583327, -2.4120226591666, 0.0, -1.07868932583326, 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.745355992499932, 0.0, 0.0786893258332603, 0.0, 0.25464400750007, 0.0, 2.4120226591666, -0.25464400750007, -0.824045318333195, -2.4120226591666, 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}}; static const double FE1_C0_D100[24][30] = \ {{0.141588514963394, 0.424765544890178, 0.0, 0.0, 0.0, 0.858411485036607, 0.858411485036607, -0.858411485036607, -0.858411485036607, -0.566354059853573, 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.424765544890179, -0.141588514963394, 0.0, 0.0, 0.0, 0.858411485036607, 0.858411485036607, -0.858411485036607, -0.858411485036607, 0.566354059853573, 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.141588514963394, -0.141588514963394, 0.0, 0.0, 0.0, 1.42476554489018, 0.858411485036607, -1.42476554489018, -0.858411485036607, 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.141588514963394, -0.141588514963395, 0.0, 0.0, 0.0, 0.858411485036607, 1.42476554489018, -0.858411485036607, -1.42476554489018, 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.837304165861558, 2.51191249758467, 0.0, 0.0, 0.0, 0.162695834138445, 0.162695834138445, -0.162695834138445, -0.162695834138445, -3.34921666344622, 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}, {-2.51191249758466, -0.837304165861554, 0.0, 0.0, 0.0, 0.162695834138445, 0.162695834138445, -0.162695834138445, -0.162695834138445, 3.34921666344622, 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.837304165861558, -0.837304165861555, 0.0, 0.0, 0.0, 3.51191249758467, 0.162695834138443, -3.51191249758467, -0.162695834138443, 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.837304165861556, -0.837304165861559, 0.0, 0.0, 0.0, 0.162695834138446, 3.51191249758467, -0.162695834138446, -3.51191249758467, 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.2893515605691, -0.868054681707308, 0.0, 0.0, 0.0, 1.2893515605691, 1.2893515605691, -1.2893515605691, -1.2893515605691, 1.15740624227641, 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.86805468170731, 0.289351560569102, 0.0, 0.0, 0.0, 1.2893515605691, 1.2893515605691, -1.2893515605691, -1.2893515605691, -1.15740624227641, 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.289351560569101, 0.289351560569102, 0.0, 0.0, 0.0, 0.131945318292692, 1.2893515605691, -0.131945318292692, -1.2893515605691, 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.289351560569102, 0.289351560569101, 0.0, 0.0, 0.0, 1.2893515605691, 0.131945318292693, -1.2893515605691, -0.131945318292693, 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}, {-1.4120226591666, 0.0786893258332631, 0.0, 0.0, 0.0, 0.25464400750007, 0.25464400750007, -0.25464400750007, -0.25464400750007, 1.33333333333333, 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}, {-1.41202265916659, -0.74535599249993, 0.0, 0.0, 0.0, 0.25464400750007, 1.07868932583326, -0.25464400750007, -1.07868932583326, 2.15737865166653, 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}, {-1.4120226591666, -0.74535599249993, 0.0, 0.0, 0.0, 1.07868932583326, 0.254644007500071, -1.07868932583326, -0.254644007500071, 2.15737865166653, 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.0786893258332627, 1.4120226591666, 0.0, 0.0, 0.0, 0.25464400750007, 0.25464400750007, -0.25464400750007, -0.25464400750007, -1.33333333333333, 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.0786893258332623, -0.745355992499933, 0.0, 0.0, 0.0, 0.25464400750007, 2.4120226591666, -0.25464400750007, -2.4120226591666, 0.824045318333195, 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.0786893258332616, -0.745355992499931, 0.0, 0.0, 0.0, 2.4120226591666, 0.25464400750007, -2.4120226591666, -0.25464400750007, 0.824045318333192, 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.745355992499932, -0.74535599249993, 0.0, 0.0, 0.0, 2.4120226591666, 1.07868932583326, -2.4120226591666, -1.07868932583326, 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.745355992499932, 0.078689325833261, 0.0, 0.0, 0.0, 0.25464400750007, 2.4120226591666, -0.25464400750007, -2.4120226591666, -0.824045318333193, 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.74535599249993, 1.41202265916659, 0.0, 0.0, 0.0, 1.07868932583326, 0.25464400750007, -1.07868932583326, -0.25464400750007, -2.15737865166653, 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.745355992499931, -0.745355992499932, 0.0, 0.0, 0.0, 1.07868932583326, 2.4120226591666, -1.07868932583326, -2.4120226591666, 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.745355992499931, 0.0786893258332616, 0.0, 0.0, 0.0, 2.4120226591666, 0.25464400750007, -2.4120226591666, -0.25464400750007, -0.824045318333192, 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.745355992499932, 1.4120226591666, 0.0, 0.0, 0.0, 0.25464400750007, 1.07868932583326, -0.25464400750007, -1.07868932583326, -2.15737865166653, 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}}; static const double FE1_C1[24][30] = \ {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -0.122494086553808, -0.102446778984269, -0.122494086553808, -0.122494086553808, 0.184217569410688, 0.305758776804542, 0.305758776804542, 0.184217569410688, 0.184217569410688, 0.305758776804542, 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.102446778984269, -0.122494086553808, -0.122494086553808, -0.122494086553808, 0.184217569410688, 0.184217569410688, 0.184217569410688, 0.305758776804542, 0.305758776804542, 0.305758776804542, 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.122494086553808, -0.122494086553808, -0.122494086553808, -0.102446778984269, 0.305758776804542, 0.305758776804542, 0.184217569410688, 0.305758776804542, 0.184217569410688, 0.184217569410688, 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.122494086553808, -0.122494086553808, -0.102446778984269, -0.122494086553808, 0.305758776804542, 0.184217569410688, 0.305758776804542, 0.184217569410688, 0.305758776804542, 0.184217569410688, 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.0373652167288608, 0.663713049440253, -0.0373652167288607, -0.0373652167288607, 0.00661748361150104, 0.142843383303942, 0.142843383303942, 0.00661748361150104, 0.00661748361150125, 0.142843383303942, 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.663713049440253, -0.0373652167288607, -0.0373652167288607, -0.0373652167288607, 0.00661748361150104, 0.00661748361150113, 0.00661748361150104, 0.142843383303942, 0.142843383303942, 0.142843383303942, 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.0373652167288608, -0.0373652167288607, -0.0373652167288607, 0.663713049440253, 0.142843383303942, 0.142843383303942, 0.00661748361150118, 0.142843383303942, 0.00661748361150114, 0.00661748361150118, 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.0373652167288609, -0.0373652167288608, 0.663713049440253, -0.0373652167288607, 0.142843383303942, 0.00661748361150115, 0.142843383303942, 0.00661748361150096, 0.142843383303942, 0.00661748361150115, 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.114534459299528, -0.0308101336957531, -0.114534459299528, -0.114534459299528, 0.415606861685495, 0.0425309755126176, 0.0425309755126175, 0.415606861685495, 0.415606861685495, 0.0425309755126175, 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.0308101336957529, -0.114534459299528, -0.114534459299528, -0.114534459299528, 0.415606861685495, 0.415606861685495, 0.415606861685495, 0.0425309755126171, 0.0425309755126172, 0.0425309755126172, 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.114534459299528, -0.114534459299528, -0.114534459299528, -0.0308101336957531, 0.0425309755126174, 0.0425309755126175, 0.415606861685495, 0.0425309755126174, 0.415606861685495, 0.415606861685495, 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.114534459299528, -0.114534459299528, -0.0308101336957531, -0.114534459299528, 0.0425309755126173, 0.415606861685495, 0.0425309755126174, 0.415606861685495, 0.0425309755126175, 0.415606861685495, 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.124225998749988, -0.124225998749988, -0.0555555555555555, -0.0555555555555555, 0.0162108926389238, 0.0686704431944328, 0.0686704431944327, 0.153551779027789, 0.153551779027789, 0.650455774027743, 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.124225998749988, -0.0555555555555555, -0.124225998749988, -0.0555555555555555, 0.0686704431944327, 0.0162108926389239, 0.0686704431944327, 0.153551779027789, 0.650455774027743, 0.153551779027789, 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.124225998749988, -0.0555555555555555, -0.0555555555555555, -0.124225998749988, 0.0686704431944326, 0.0686704431944328, 0.0162108926389239, 0.650455774027743, 0.153551779027789, 0.153551779027789, 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.124225998749988, 0.124225998749988, -0.0555555555555555, -0.0555555555555555, 0.0162108926389238, 0.153551779027789, 0.153551779027789, 0.0686704431944327, 0.0686704431944328, 0.650455774027743, 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.124225998749988, -0.0555555555555555, 0.124225998749988, -0.0555555555555555, 0.153551779027789, 0.016210892638924, 0.153551779027789, 0.0686704431944327, 0.650455774027743, 0.0686704431944328, 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.124225998749988, -0.0555555555555555, -0.0555555555555555, 0.124225998749988, 0.153551779027789, 0.153551779027789, 0.0162108926389239, 0.650455774027743, 0.0686704431944328, 0.0686704431944328, 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.0555555555555555, -0.0555555555555555, -0.124225998749988, 0.124225998749988, 0.650455774027743, 0.153551779027789, 0.0686704431944327, 0.153551779027789, 0.0686704431944328, 0.016210892638924, 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.0555555555555556, -0.124225998749988, 0.124225998749988, -0.0555555555555555, 0.153551779027789, 0.0686704431944328, 0.650455774027743, 0.0162108926389238, 0.15355177902779, 0.0686704431944328, 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.0555555555555556, 0.124225998749988, -0.0555555555555555, -0.124225998749988, 0.0686704431944325, 0.650455774027743, 0.153551779027789, 0.0686704431944328, 0.016210892638924, 0.15355177902779, 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.0555555555555556, -0.0555555555555556, 0.124225998749988, -0.124225998749988, 0.650455774027743, 0.0686704431944328, 0.153551779027789, 0.0686704431944327, 0.15355177902779, 0.016210892638924, 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.0555555555555555, -0.124225998749988, -0.0555555555555555, 0.124225998749988, 0.153551779027789, 0.650455774027743, 0.0686704431944327, 0.153551779027789, 0.0162108926389239, 0.0686704431944328, 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.0555555555555556, 0.124225998749988, -0.124225998749988, -0.0555555555555555, 0.0686704431944326, 0.153551779027789, 0.650455774027743, 0.0162108926389239, 0.0686704431944329, 0.15355177902779, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}}; static const double FE1_C1_D001[24][30] = \ {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.141588514963394, 0.0, 0.0, -0.141588514963397, 0.858411485036608, 1.42476554489019, 0.0, 0.0, -0.858411485036606, -1.42476554489018, 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.424765544890179, 0.0, 0.0, -0.141588514963397, 0.858411485036608, 0.858411485036613, 0.0, 0.566354059853573, -0.858411485036607, -0.858411485036607, 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.141588514963394, 0.0, 0.0, 0.424765544890176, 0.858411485036607, 0.858411485036613, 0.0, -0.566354059853573, -0.858411485036606, -0.858411485036607, 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.141588514963394, 0.0, 0.0, -0.141588514963397, 1.42476554489018, 0.858411485036613, 0.0, 0.0, -1.42476554489018, -0.858411485036607, 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.837304165861558, 0.0, 0.0, -0.837304165861558, 0.162695834138448, 3.51191249758467, 0.0, 0.0, -0.162695834138445, -3.51191249758466, 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, -2.51191249758467, 0.0, 0.0, -0.837304165861559, 0.162695834138448, 0.162695834138448, 0.0, 3.34921666344622, -0.162695834138446, -0.162695834138444, 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.837304165861556, 0.0, 0.0, 2.51191249758466, 0.162695834138441, 0.162695834138453, 0.0, -3.34921666344622, -0.162695834138443, -0.162695834138447, 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.837304165861555, 0.0, 0.0, -0.837304165861559, 3.51191249758467, 0.162695834138448, 0.0, 0.0, -3.51191249758467, -0.162695834138446, 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.289351560569101, 0.0, 0.0, 0.289351560569099, 1.2893515605691, 0.1319453182927, 0.0, 0.0, -1.2893515605691, -0.131945318292693, 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.868054681707309, 0.0, 0.0, 0.289351560569099, 1.2893515605691, 1.28935156056911, 0.0, -1.15740624227641, -1.2893515605691, -1.2893515605691, 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.289351560569101, 0.0, 0.0, -0.868054681707312, 1.28935156056911, 1.28935156056911, 0.0, 1.15740624227641, -1.2893515605691, -1.2893515605691, 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.289351560569102, 0.0, 0.0, 0.289351560569099, 0.131945318292692, 1.28935156056911, 0.0, 0.0, -0.131945318292692, -1.2893515605691, 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, -1.4120226591666, 0.0, 0.0, -0.745355992499934, 0.254644007500072, 1.07868932583327, 0.0, 2.15737865166653, -0.25464400750007, -1.07868932583326, 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, -1.4120226591666, 0.0, 0.0, -0.745355992499935, 1.07868932583327, 0.254644007500076, 0.0, 2.15737865166653, -1.07868932583326, -0.25464400750007, 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, -1.4120226591666, 0.0, 0.0, 0.0786893258332599, 0.25464400750007, 0.254644007500076, 0.0, 1.33333333333333, -0.25464400750007, -0.254644007500071, 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.0786893258332623, 0.0, 0.0, -0.745355992499934, 0.254644007500072, 2.4120226591666, 0.0, 0.824045318333192, -0.25464400750007, -2.4120226591666, 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.0786893258332624, 0.0, 0.0, -0.745355992499935, 2.4120226591666, 0.254644007500076, 0.0, 0.824045318333193, -2.4120226591666, -0.25464400750007, 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.0786893258332625, 0.0, 0.0, 1.41202265916659, 0.254644007500067, 0.254644007500078, 0.0, -1.33333333333333, -0.254644007500068, -0.254644007500072, 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.745355992499931, 0.0, 0.0, 1.41202265916659, 1.07868932583326, 0.254644007500077, 0.0, -2.15737865166653, -1.07868932583326, -0.25464400750007, 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.74535599249993, 0.0, 0.0, -0.745355992499934, 2.4120226591666, 1.07868932583327, 0.0, 0.0, -2.4120226591666, -1.07868932583326, 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.745355992499931, 0.0, 0.0, 0.0786893258332599, 0.25464400750007, 2.41202265916661, 0.0, -0.824045318333195, -0.254644007500069, -2.4120226591666, 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.745355992499931, 0.0, 0.0, 0.07868932583326, 2.4120226591666, 0.254644007500075, 0.0, -0.824045318333194, -2.4120226591666, -0.254644007500069, 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.74535599249993, 0.0, 0.0, 1.41202265916659, 0.254644007500068, 1.07868932583327, 0.0, -2.15737865166653, -0.254644007500069, -1.07868932583327, 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.745355992499931, 0.0, 0.0, -0.745355992499934, 1.07868932583327, 2.4120226591666, 0.0, 0.0, -1.07868932583326, -2.4120226591666, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}}; static const double FE1_C1_D010[24][30] = \ {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.141588514963394, 0.0, -0.141588514963396, 0.0, 0.858411485036608, 0.0, 1.42476554489019, -0.858411485036607, 0.0, -1.42476554489018, 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.424765544890179, 0.0, -0.141588514963397, 0.0, 0.858411485036608, 0.0, 0.858411485036612, -0.858411485036608, 0.566354059853573, -0.858411485036608, 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.141588514963394, 0.0, -0.141588514963396, 0.0, 1.42476554489018, 0.0, 0.858411485036612, -1.42476554489018, 0.0, -0.858411485036607, 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.141588514963394, 0.0, 0.424765544890176, 0.0, 0.858411485036608, 0.0, 0.858411485036613, -0.858411485036607, -0.566354059853573, -0.858411485036608, 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.837304165861558, 0.0, -0.837304165861557, 0.0, 0.162695834138445, 0.0, 3.51191249758467, -0.162695834138445, 0.0, -3.51191249758466, 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, -2.51191249758466, 0.0, -0.837304165861557, 0.0, 0.162695834138446, 0.0, 0.162695834138449, -0.162695834138446, 3.34921666344622, -0.162695834138444, 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.837304165861558, 0.0, -0.837304165861556, 0.0, 3.51191249758467, 0.0, 0.162695834138447, -3.51191249758467, 0.0, -0.162695834138445, 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.837304165861557, 0.0, 2.51191249758466, 0.0, 0.162695834138446, 0.0, 0.162695834138453, -0.162695834138446, -3.34921666344622, -0.162695834138447, 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.289351560569101, 0.0, 0.289351560569099, 0.0, 1.2893515605691, 0.0, 0.131945318292698, -1.2893515605691, 0.0, -0.131945318292693, 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.868054681707309, 0.0, 0.2893515605691, 0.0, 1.2893515605691, 0.0, 1.28935156056911, -1.2893515605691, -1.15740624227641, -1.2893515605691, 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.2893515605691, 0.0, 0.289351560569099, 0.0, 0.131945318292693, 0.0, 1.28935156056911, -0.131945318292693, 0.0, -1.2893515605691, 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.2893515605691, 0.0, -0.86805468170731, 0.0, 1.2893515605691, 0.0, 1.28935156056911, -1.2893515605691, 1.15740624227641, -1.2893515605691, 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, -1.4120226591666, 0.0, -0.745355992499933, 0.0, 0.254644007500071, 0.0, 1.07868932583327, -0.25464400750007, 2.15737865166653, -1.07868932583326, 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, -1.4120226591666, 0.0, 0.0786893258332597, 0.0, 0.254644007500071, 0.0, 0.254644007500077, -0.254644007500071, 1.33333333333333, -0.254644007500071, 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, -1.4120226591666, 0.0, -0.745355992499932, 0.0, 1.07868932583327, 0.0, 0.254644007500073, -1.07868932583326, 2.15737865166653, -0.254644007500071, 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.0786893258332615, 0.0, -0.745355992499933, 0.0, 0.25464400750007, 0.0, 2.4120226591666, -0.25464400750007, 0.824045318333192, -2.4120226591666, 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.078689325833262, 0.0, 1.41202265916659, 0.0, 0.254644007500071, 0.0, 0.254644007500078, -0.254644007500071, -1.33333333333333, -0.254644007500072, 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.0786893258332616, 0.0, -0.745355992499932, 0.0, 2.4120226591666, 0.0, 0.254644007500073, -2.4120226591666, 0.824045318333193, -0.25464400750007, 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.745355992499932, 0.0, 0.0786893258332607, 0.0, 2.4120226591666, 0.0, 0.254644007500074, -2.4120226591666, -0.824045318333194, -0.254644007500069, 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.745355992499931, 0.0, 1.41202265916659, 0.0, 0.254644007500071, 0.0, 1.07868932583327, -0.25464400750007, -2.15737865166653, -1.07868932583326, 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.745355992499931, 0.0, -0.745355992499932, 0.0, 1.07868932583327, 0.0, 2.4120226591666, -1.07868932583326, 0.0, -2.4120226591666, 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.745355992499931, 0.0, 1.41202265916659, 0.0, 1.07868932583326, 0.0, 0.254644007500076, -1.07868932583326, -2.15737865166653, -0.25464400750007, 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.745355992499932, 0.0, -0.745355992499932, 0.0, 2.4120226591666, 0.0, 1.07868932583327, -2.4120226591666, 0.0, -1.07868932583326, 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.745355992499932, 0.0, 0.0786893258332603, 0.0, 0.25464400750007, 0.0, 2.4120226591666, -0.25464400750007, -0.824045318333195, -2.4120226591666, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}}; static const double FE1_C1_D100[24][30] = \ {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.141588514963394, 0.424765544890178, 0.0, 0.0, 0.0, 0.858411485036607, 0.858411485036607, -0.858411485036607, -0.858411485036607, -0.566354059853573, 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.424765544890179, -0.141588514963394, 0.0, 0.0, 0.0, 0.858411485036607, 0.858411485036607, -0.858411485036607, -0.858411485036607, 0.566354059853573, 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.141588514963394, -0.141588514963394, 0.0, 0.0, 0.0, 1.42476554489018, 0.858411485036607, -1.42476554489018, -0.858411485036607, 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.141588514963394, -0.141588514963395, 0.0, 0.0, 0.0, 0.858411485036607, 1.42476554489018, -0.858411485036607, -1.42476554489018, 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.837304165861558, 2.51191249758467, 0.0, 0.0, 0.0, 0.162695834138445, 0.162695834138445, -0.162695834138445, -0.162695834138445, -3.34921666344622, 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, -2.51191249758466, -0.837304165861554, 0.0, 0.0, 0.0, 0.162695834138445, 0.162695834138445, -0.162695834138445, -0.162695834138445, 3.34921666344622, 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.837304165861558, -0.837304165861555, 0.0, 0.0, 0.0, 3.51191249758467, 0.162695834138443, -3.51191249758467, -0.162695834138443, 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.837304165861556, -0.837304165861559, 0.0, 0.0, 0.0, 0.162695834138446, 3.51191249758467, -0.162695834138446, -3.51191249758467, 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.2893515605691, -0.868054681707308, 0.0, 0.0, 0.0, 1.2893515605691, 1.2893515605691, -1.2893515605691, -1.2893515605691, 1.15740624227641, 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.86805468170731, 0.289351560569102, 0.0, 0.0, 0.0, 1.2893515605691, 1.2893515605691, -1.2893515605691, -1.2893515605691, -1.15740624227641, 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.289351560569101, 0.289351560569102, 0.0, 0.0, 0.0, 0.131945318292692, 1.2893515605691, -0.131945318292692, -1.2893515605691, 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.289351560569102, 0.289351560569101, 0.0, 0.0, 0.0, 1.2893515605691, 0.131945318292693, -1.2893515605691, -0.131945318292693, 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, -1.4120226591666, 0.0786893258332631, 0.0, 0.0, 0.0, 0.25464400750007, 0.25464400750007, -0.25464400750007, -0.25464400750007, 1.33333333333333, 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, -1.41202265916659, -0.74535599249993, 0.0, 0.0, 0.0, 0.25464400750007, 1.07868932583326, -0.25464400750007, -1.07868932583326, 2.15737865166653, 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, -1.4120226591666, -0.74535599249993, 0.0, 0.0, 0.0, 1.07868932583326, 0.254644007500071, -1.07868932583326, -0.254644007500071, 2.15737865166653, 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.0786893258332627, 1.4120226591666, 0.0, 0.0, 0.0, 0.25464400750007, 0.25464400750007, -0.25464400750007, -0.25464400750007, -1.33333333333333, 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.0786893258332623, -0.745355992499933, 0.0, 0.0, 0.0, 0.25464400750007, 2.4120226591666, -0.25464400750007, -2.4120226591666, 0.824045318333195, 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.0786893258332616, -0.745355992499931, 0.0, 0.0, 0.0, 2.4120226591666, 0.25464400750007, -2.4120226591666, -0.25464400750007, 0.824045318333192, 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.745355992499932, -0.74535599249993, 0.0, 0.0, 0.0, 2.4120226591666, 1.07868932583326, -2.4120226591666, -1.07868932583326, 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.745355992499932, 0.078689325833261, 0.0, 0.0, 0.0, 0.25464400750007, 2.4120226591666, -0.25464400750007, -2.4120226591666, -0.824045318333193, 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.74535599249993, 1.41202265916659, 0.0, 0.0, 0.0, 1.07868932583326, 0.25464400750007, -1.07868932583326, -0.25464400750007, -2.15737865166653, 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.745355992499931, -0.745355992499932, 0.0, 0.0, 0.0, 1.07868932583326, 2.4120226591666, -1.07868932583326, -2.4120226591666, 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.745355992499931, 0.0786893258332616, 0.0, 0.0, 0.0, 2.4120226591666, 0.25464400750007, -2.4120226591666, -0.25464400750007, -0.824045318333192, 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.745355992499932, 1.4120226591666, 0.0, 0.0, 0.0, 0.25464400750007, 1.07868932583326, -0.25464400750007, -1.07868932583326, -2.15737865166653, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}}; static const double FE1_C2[24][30] = \ {{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.122494086553808, -0.102446778984269, -0.122494086553808, -0.122494086553808, 0.184217569410688, 0.305758776804542, 0.305758776804542, 0.184217569410688, 0.184217569410688, 0.305758776804542}, {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.102446778984269, -0.122494086553808, -0.122494086553808, -0.122494086553808, 0.184217569410688, 0.184217569410688, 0.184217569410688, 0.305758776804542, 0.305758776804542, 0.305758776804542}, {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.122494086553808, -0.122494086553808, -0.122494086553808, -0.102446778984269, 0.305758776804542, 0.305758776804542, 0.184217569410688, 0.305758776804542, 0.184217569410688, 0.184217569410688}, {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.122494086553808, -0.122494086553808, -0.102446778984269, -0.122494086553808, 0.305758776804542, 0.184217569410688, 0.305758776804542, 0.184217569410688, 0.305758776804542, 0.184217569410688}, {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.0373652167288608, 0.663713049440253, -0.0373652167288607, -0.0373652167288607, 0.00661748361150104, 0.142843383303942, 0.142843383303942, 0.00661748361150104, 0.00661748361150125, 0.142843383303942}, {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.663713049440253, -0.0373652167288607, -0.0373652167288607, -0.0373652167288607, 0.00661748361150104, 0.00661748361150113, 0.00661748361150104, 0.142843383303942, 0.142843383303942, 0.142843383303942}, {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.0373652167288608, -0.0373652167288607, -0.0373652167288607, 0.663713049440253, 0.142843383303942, 0.142843383303942, 0.00661748361150118, 0.142843383303942, 0.00661748361150114, 0.00661748361150118}, {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.0373652167288609, -0.0373652167288608, 0.663713049440253, -0.0373652167288607, 0.142843383303942, 0.00661748361150115, 0.142843383303942, 0.00661748361150096, 0.142843383303942, 0.00661748361150115}, {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.114534459299528, -0.0308101336957531, -0.114534459299528, -0.114534459299528, 0.415606861685495, 0.0425309755126176, 0.0425309755126175, 0.415606861685495, 0.415606861685495, 0.0425309755126175}, {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.0308101336957529, -0.114534459299528, -0.114534459299528, -0.114534459299528, 0.415606861685495, 0.415606861685495, 0.415606861685495, 0.0425309755126171, 0.0425309755126172, 0.0425309755126172}, {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.114534459299528, -0.114534459299528, -0.114534459299528, -0.0308101336957531, 0.0425309755126174, 0.0425309755126175, 0.415606861685495, 0.0425309755126174, 0.415606861685495, 0.415606861685495}, {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.114534459299528, -0.114534459299528, -0.0308101336957531, -0.114534459299528, 0.0425309755126173, 0.415606861685495, 0.0425309755126174, 0.415606861685495, 0.0425309755126175, 0.415606861685495}, {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.124225998749988, -0.124225998749988, -0.0555555555555555, -0.0555555555555555, 0.0162108926389238, 0.0686704431944328, 0.0686704431944327, 0.153551779027789, 0.153551779027789, 0.650455774027743}, {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.124225998749988, -0.0555555555555555, -0.124225998749988, -0.0555555555555555, 0.0686704431944327, 0.0162108926389239, 0.0686704431944327, 0.153551779027789, 0.650455774027743, 0.153551779027789}, {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.124225998749988, -0.0555555555555555, -0.0555555555555555, -0.124225998749988, 0.0686704431944326, 0.0686704431944328, 0.0162108926389239, 0.650455774027743, 0.153551779027789, 0.153551779027789}, {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.124225998749988, 0.124225998749988, -0.0555555555555555, -0.0555555555555555, 0.0162108926389238, 0.153551779027789, 0.153551779027789, 0.0686704431944327, 0.0686704431944328, 0.650455774027743}, {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.124225998749988, -0.0555555555555555, 0.124225998749988, -0.0555555555555555, 0.153551779027789, 0.016210892638924, 0.153551779027789, 0.0686704431944327, 0.650455774027743, 0.0686704431944328}, {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.124225998749988, -0.0555555555555555, -0.0555555555555555, 0.124225998749988, 0.153551779027789, 0.153551779027789, 0.0162108926389239, 0.650455774027743, 0.0686704431944328, 0.0686704431944328}, {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.0555555555555555, -0.0555555555555555, -0.124225998749988, 0.124225998749988, 0.650455774027743, 0.153551779027789, 0.0686704431944327, 0.153551779027789, 0.0686704431944328, 0.016210892638924}, {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.0555555555555556, -0.124225998749988, 0.124225998749988, -0.0555555555555555, 0.153551779027789, 0.0686704431944328, 0.650455774027743, 0.0162108926389238, 0.15355177902779, 0.0686704431944328}, {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.0555555555555556, 0.124225998749988, -0.0555555555555555, -0.124225998749988, 0.0686704431944325, 0.650455774027743, 0.153551779027789, 0.0686704431944328, 0.016210892638924, 0.15355177902779}, {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.0555555555555556, -0.0555555555555556, 0.124225998749988, -0.124225998749988, 0.650455774027743, 0.0686704431944328, 0.153551779027789, 0.0686704431944327, 0.15355177902779, 0.016210892638924}, {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.0555555555555555, -0.124225998749988, -0.0555555555555555, 0.124225998749988, 0.153551779027789, 0.650455774027743, 0.0686704431944327, 0.153551779027789, 0.0162108926389239, 0.0686704431944328}, {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.0555555555555556, 0.124225998749988, -0.124225998749988, -0.0555555555555555, 0.0686704431944326, 0.153551779027789, 0.650455774027743, 0.0162108926389239, 0.0686704431944329, 0.15355177902779}}; static const double FE1_C2_D001[24][30] = \ {{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.141588514963394, 0.0, 0.0, -0.141588514963397, 0.858411485036608, 1.42476554489019, 0.0, 0.0, -0.858411485036606, -1.42476554489018}, {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.424765544890179, 0.0, 0.0, -0.141588514963397, 0.858411485036608, 0.858411485036613, 0.0, 0.566354059853573, -0.858411485036607, -0.858411485036607}, {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.141588514963394, 0.0, 0.0, 0.424765544890176, 0.858411485036607, 0.858411485036613, 0.0, -0.566354059853573, -0.858411485036606, -0.858411485036607}, {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.141588514963394, 0.0, 0.0, -0.141588514963397, 1.42476554489018, 0.858411485036613, 0.0, 0.0, -1.42476554489018, -0.858411485036607}, {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.837304165861558, 0.0, 0.0, -0.837304165861558, 0.162695834138448, 3.51191249758467, 0.0, 0.0, -0.162695834138445, -3.51191249758466}, {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, -2.51191249758467, 0.0, 0.0, -0.837304165861559, 0.162695834138448, 0.162695834138448, 0.0, 3.34921666344622, -0.162695834138446, -0.162695834138444}, {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.837304165861556, 0.0, 0.0, 2.51191249758466, 0.162695834138441, 0.162695834138453, 0.0, -3.34921666344622, -0.162695834138443, -0.162695834138447}, {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.837304165861555, 0.0, 0.0, -0.837304165861559, 3.51191249758467, 0.162695834138448, 0.0, 0.0, -3.51191249758467, -0.162695834138446}, {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.289351560569101, 0.0, 0.0, 0.289351560569099, 1.2893515605691, 0.1319453182927, 0.0, 0.0, -1.2893515605691, -0.131945318292693}, {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.868054681707309, 0.0, 0.0, 0.289351560569099, 1.2893515605691, 1.28935156056911, 0.0, -1.15740624227641, -1.2893515605691, -1.2893515605691}, {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.289351560569101, 0.0, 0.0, -0.868054681707312, 1.28935156056911, 1.28935156056911, 0.0, 1.15740624227641, -1.2893515605691, -1.2893515605691}, {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.289351560569102, 0.0, 0.0, 0.289351560569099, 0.131945318292692, 1.28935156056911, 0.0, 0.0, -0.131945318292692, -1.2893515605691}, {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, -1.4120226591666, 0.0, 0.0, -0.745355992499934, 0.254644007500072, 1.07868932583327, 0.0, 2.15737865166653, -0.25464400750007, -1.07868932583326}, {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, -1.4120226591666, 0.0, 0.0, -0.745355992499935, 1.07868932583327, 0.254644007500076, 0.0, 2.15737865166653, -1.07868932583326, -0.25464400750007}, {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, -1.4120226591666, 0.0, 0.0, 0.0786893258332599, 0.25464400750007, 0.254644007500076, 0.0, 1.33333333333333, -0.25464400750007, -0.254644007500071}, {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.0786893258332623, 0.0, 0.0, -0.745355992499934, 0.254644007500072, 2.4120226591666, 0.0, 0.824045318333192, -0.25464400750007, -2.4120226591666}, {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.0786893258332624, 0.0, 0.0, -0.745355992499935, 2.4120226591666, 0.254644007500076, 0.0, 0.824045318333193, -2.4120226591666, -0.25464400750007}, {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.0786893258332625, 0.0, 0.0, 1.41202265916659, 0.254644007500067, 0.254644007500078, 0.0, -1.33333333333333, -0.254644007500068, -0.254644007500072}, {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.745355992499931, 0.0, 0.0, 1.41202265916659, 1.07868932583326, 0.254644007500077, 0.0, -2.15737865166653, -1.07868932583326, -0.25464400750007}, {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.74535599249993, 0.0, 0.0, -0.745355992499934, 2.4120226591666, 1.07868932583327, 0.0, 0.0, -2.4120226591666, -1.07868932583326}, {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.745355992499931, 0.0, 0.0, 0.0786893258332599, 0.25464400750007, 2.41202265916661, 0.0, -0.824045318333195, -0.254644007500069, -2.4120226591666}, {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.745355992499931, 0.0, 0.0, 0.07868932583326, 2.4120226591666, 0.254644007500075, 0.0, -0.824045318333194, -2.4120226591666, -0.254644007500069}, {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.74535599249993, 0.0, 0.0, 1.41202265916659, 0.254644007500068, 1.07868932583327, 0.0, -2.15737865166653, -0.254644007500069, -1.07868932583327}, {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.745355992499931, 0.0, 0.0, -0.745355992499934, 1.07868932583327, 2.4120226591666, 0.0, 0.0, -1.07868932583326, -2.4120226591666}}; static const double FE1_C2_D010[24][30] = \ {{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.141588514963394, 0.0, -0.141588514963396, 0.0, 0.858411485036608, 0.0, 1.42476554489019, -0.858411485036607, 0.0, -1.42476554489018}, {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.424765544890179, 0.0, -0.141588514963397, 0.0, 0.858411485036608, 0.0, 0.858411485036612, -0.858411485036608, 0.566354059853573, -0.858411485036608}, {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.141588514963394, 0.0, -0.141588514963396, 0.0, 1.42476554489018, 0.0, 0.858411485036612, -1.42476554489018, 0.0, -0.858411485036607}, {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.141588514963394, 0.0, 0.424765544890176, 0.0, 0.858411485036608, 0.0, 0.858411485036613, -0.858411485036607, -0.566354059853573, -0.858411485036608}, {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.837304165861558, 0.0, -0.837304165861557, 0.0, 0.162695834138445, 0.0, 3.51191249758467, -0.162695834138445, 0.0, -3.51191249758466}, {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, -2.51191249758466, 0.0, -0.837304165861557, 0.0, 0.162695834138446, 0.0, 0.162695834138449, -0.162695834138446, 3.34921666344622, -0.162695834138444}, {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.837304165861558, 0.0, -0.837304165861556, 0.0, 3.51191249758467, 0.0, 0.162695834138447, -3.51191249758467, 0.0, -0.162695834138445}, {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.837304165861557, 0.0, 2.51191249758466, 0.0, 0.162695834138446, 0.0, 0.162695834138453, -0.162695834138446, -3.34921666344622, -0.162695834138447}, {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.289351560569101, 0.0, 0.289351560569099, 0.0, 1.2893515605691, 0.0, 0.131945318292698, -1.2893515605691, 0.0, -0.131945318292693}, {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.868054681707309, 0.0, 0.2893515605691, 0.0, 1.2893515605691, 0.0, 1.28935156056911, -1.2893515605691, -1.15740624227641, -1.2893515605691}, {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.2893515605691, 0.0, 0.289351560569099, 0.0, 0.131945318292693, 0.0, 1.28935156056911, -0.131945318292693, 0.0, -1.2893515605691}, {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.2893515605691, 0.0, -0.86805468170731, 0.0, 1.2893515605691, 0.0, 1.28935156056911, -1.2893515605691, 1.15740624227641, -1.2893515605691}, {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, -1.4120226591666, 0.0, -0.745355992499933, 0.0, 0.254644007500071, 0.0, 1.07868932583327, -0.25464400750007, 2.15737865166653, -1.07868932583326}, {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, -1.4120226591666, 0.0, 0.0786893258332597, 0.0, 0.254644007500071, 0.0, 0.254644007500077, -0.254644007500071, 1.33333333333333, -0.254644007500071}, {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, -1.4120226591666, 0.0, -0.745355992499932, 0.0, 1.07868932583327, 0.0, 0.254644007500073, -1.07868932583326, 2.15737865166653, -0.254644007500071}, {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.0786893258332615, 0.0, -0.745355992499933, 0.0, 0.25464400750007, 0.0, 2.4120226591666, -0.25464400750007, 0.824045318333192, -2.4120226591666}, {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.078689325833262, 0.0, 1.41202265916659, 0.0, 0.254644007500071, 0.0, 0.254644007500078, -0.254644007500071, -1.33333333333333, -0.254644007500072}, {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.0786893258332616, 0.0, -0.745355992499932, 0.0, 2.4120226591666, 0.0, 0.254644007500073, -2.4120226591666, 0.824045318333193, -0.25464400750007}, {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.745355992499932, 0.0, 0.0786893258332607, 0.0, 2.4120226591666, 0.0, 0.254644007500074, -2.4120226591666, -0.824045318333194, -0.254644007500069}, {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.745355992499931, 0.0, 1.41202265916659, 0.0, 0.254644007500071, 0.0, 1.07868932583327, -0.25464400750007, -2.15737865166653, -1.07868932583326}, {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.745355992499931, 0.0, -0.745355992499932, 0.0, 1.07868932583327, 0.0, 2.4120226591666, -1.07868932583326, 0.0, -2.4120226591666}, {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.745355992499931, 0.0, 1.41202265916659, 0.0, 1.07868932583326, 0.0, 0.254644007500076, -1.07868932583326, -2.15737865166653, -0.25464400750007}, {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.745355992499932, 0.0, -0.745355992499932, 0.0, 2.4120226591666, 0.0, 1.07868932583327, -2.4120226591666, 0.0, -1.07868932583326}, {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.745355992499932, 0.0, 0.0786893258332603, 0.0, 0.25464400750007, 0.0, 2.4120226591666, -0.25464400750007, -0.824045318333195, -2.4120226591666}}; static const double FE1_C2_D100[24][30] = \ {{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.141588514963394, 0.424765544890178, 0.0, 0.0, 0.0, 0.858411485036607, 0.858411485036607, -0.858411485036607, -0.858411485036607, -0.566354059853573}, {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.424765544890179, -0.141588514963394, 0.0, 0.0, 0.0, 0.858411485036607, 0.858411485036607, -0.858411485036607, -0.858411485036607, 0.566354059853573}, {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.141588514963394, -0.141588514963394, 0.0, 0.0, 0.0, 1.42476554489018, 0.858411485036607, -1.42476554489018, -0.858411485036607, 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.141588514963394, -0.141588514963395, 0.0, 0.0, 0.0, 0.858411485036607, 1.42476554489018, -0.858411485036607, -1.42476554489018, 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.837304165861558, 2.51191249758467, 0.0, 0.0, 0.0, 0.162695834138445, 0.162695834138445, -0.162695834138445, -0.162695834138445, -3.34921666344622}, {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, -2.51191249758466, -0.837304165861554, 0.0, 0.0, 0.0, 0.162695834138445, 0.162695834138445, -0.162695834138445, -0.162695834138445, 3.34921666344622}, {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.837304165861558, -0.837304165861555, 0.0, 0.0, 0.0, 3.51191249758467, 0.162695834138443, -3.51191249758467, -0.162695834138443, 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.837304165861556, -0.837304165861559, 0.0, 0.0, 0.0, 0.162695834138446, 3.51191249758467, -0.162695834138446, -3.51191249758467, 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.2893515605691, -0.868054681707308, 0.0, 0.0, 0.0, 1.2893515605691, 1.2893515605691, -1.2893515605691, -1.2893515605691, 1.15740624227641}, {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.86805468170731, 0.289351560569102, 0.0, 0.0, 0.0, 1.2893515605691, 1.2893515605691, -1.2893515605691, -1.2893515605691, -1.15740624227641}, {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.289351560569101, 0.289351560569102, 0.0, 0.0, 0.0, 0.131945318292692, 1.2893515605691, -0.131945318292692, -1.2893515605691, 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.289351560569102, 0.289351560569101, 0.0, 0.0, 0.0, 1.2893515605691, 0.131945318292693, -1.2893515605691, -0.131945318292693, 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, -1.4120226591666, 0.0786893258332631, 0.0, 0.0, 0.0, 0.25464400750007, 0.25464400750007, -0.25464400750007, -0.25464400750007, 1.33333333333333}, {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, -1.41202265916659, -0.74535599249993, 0.0, 0.0, 0.0, 0.25464400750007, 1.07868932583326, -0.25464400750007, -1.07868932583326, 2.15737865166653}, {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, -1.4120226591666, -0.74535599249993, 0.0, 0.0, 0.0, 1.07868932583326, 0.254644007500071, -1.07868932583326, -0.254644007500071, 2.15737865166653}, {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.0786893258332627, 1.4120226591666, 0.0, 0.0, 0.0, 0.25464400750007, 0.25464400750007, -0.25464400750007, -0.25464400750007, -1.33333333333333}, {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.0786893258332623, -0.745355992499933, 0.0, 0.0, 0.0, 0.25464400750007, 2.4120226591666, -0.25464400750007, -2.4120226591666, 0.824045318333195}, {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.0786893258332616, -0.745355992499931, 0.0, 0.0, 0.0, 2.4120226591666, 0.25464400750007, -2.4120226591666, -0.25464400750007, 0.824045318333192}, {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.745355992499932, -0.74535599249993, 0.0, 0.0, 0.0, 2.4120226591666, 1.07868932583326, -2.4120226591666, -1.07868932583326, 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.745355992499932, 0.078689325833261, 0.0, 0.0, 0.0, 0.25464400750007, 2.4120226591666, -0.25464400750007, -2.4120226591666, -0.824045318333193}, {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.74535599249993, 1.41202265916659, 0.0, 0.0, 0.0, 1.07868932583326, 0.25464400750007, -1.07868932583326, -0.25464400750007, -2.15737865166653}, {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.745355992499931, -0.745355992499932, 0.0, 0.0, 0.0, 1.07868932583326, 2.4120226591666, -1.07868932583326, -2.4120226591666, 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.745355992499931, 0.0786893258332616, 0.0, 0.0, 0.0, 2.4120226591666, 0.25464400750007, -2.4120226591666, -0.25464400750007, -0.824045318333192}, {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.745355992499932, 1.4120226591666, 0.0, 0.0, 0.0, 0.25464400750007, 1.07868932583326, -0.25464400750007, -1.07868932583326, -2.15737865166653}}; static const double FE2_C0[24][6] = \ {{0.0, -0.214602871259152, -0.214602871259152, 0.214602871259152, 0.214602871259152, 0.570794257481697}, {0.0, -0.214602871259152, -0.214602871259152, 0.214602871259151, 0.214602871259152, 0.570794257481697}, {0.0, -0.356191386222545, -0.214602871259152, 0.356191386222545, 0.214602871259152, 0.429205742518304}, {0.0, -0.214602871259152, -0.356191386222545, 0.214602871259151, 0.356191386222545, 0.429205742518304}, {0.0, -0.0406739585346115, -0.0406739585346115, 0.0406739585346114, 0.0406739585346116, 0.918652082930777}, {0.0, -0.0406739585346111, -0.0406739585346111, 0.0406739585346111, 0.0406739585346112, 0.918652082930778}, {0.0, -0.877978124396166, -0.0406739585346111, 0.877978124396165, 0.0406739585346115, 0.0813479170692234}, {0.0, -0.040673958534611, -0.877978124396166, 0.0406739585346113, 0.877978124396165, 0.0813479170692234}, {0.0, -0.322337890142275, -0.322337890142275, 0.322337890142275, 0.322337890142275, 0.355324219715449}, {0.0, -0.322337890142276, -0.322337890142276, 0.322337890142275, 0.322337890142276, 0.355324219715449}, {0.0, -0.032986329573173, -0.322337890142276, 0.0329863295731731, 0.322337890142276, 0.644675780284552}, {0.0, -0.322337890142276, -0.032986329573173, 0.322337890142275, 0.0329863295731731, 0.644675780284552}, {0.0, -0.0636610018750174, -0.0636610018750174, 0.0636610018750174, 0.0636610018750174, 0.872677996249965}, {0.0, -0.0636610018750173, -0.269672331458316, 0.0636610018750173, 0.269672331458316, 0.666666666666667}, {0.0, -0.269672331458316, -0.0636610018750173, 0.269672331458316, 0.0636610018750174, 0.666666666666667}, {0.0, -0.0636610018750175, -0.0636610018750175, 0.0636610018750175, 0.0636610018750176, 0.872677996249965}, {0.0, -0.0636610018750173, -0.603005664791649, 0.0636610018750174, 0.603005664791649, 0.333333333333334}, {0.0, -0.603005664791649, -0.0636610018750173, 0.603005664791649, 0.0636610018750175, 0.333333333333334}, {0.0, -0.603005664791649, -0.269672331458316, 0.603005664791649, 0.269672331458316, 0.127322003750036}, {0.0, -0.0636610018750173, -0.603005664791649, 0.0636610018750175, 0.603005664791649, 0.333333333333334}, {0.0, -0.269672331458316, -0.0636610018750176, 0.269672331458316, 0.0636610018750177, 0.666666666666667}, {0.0, -0.269672331458316, -0.603005664791649, 0.269672331458316, 0.603005664791649, 0.127322003750036}, {0.0, -0.603005664791649, -0.0636610018750174, 0.603005664791649, 0.0636610018750177, 0.333333333333334}, {0.0, -0.0636610018750175, -0.269672331458316, 0.0636610018750176, 0.269672331458316, 0.666666666666667}}; static const double FE2_C1[24][6] = \ {{-0.214602871259152, 0.0, 0.356191386222545, 0.214602871259152, 0.429205742518304, 0.356191386222545}, {-0.214602871259152, 0.0, 0.214602871259152, 0.214602871259152, 0.570794257481697, 0.214602871259152}, {-0.356191386222545, 0.0, 0.214602871259152, 0.356191386222545, 0.429205742518304, 0.214602871259152}, {-0.214602871259152, 0.0, 0.214602871259152, 0.214602871259152, 0.570794257481697, 0.214602871259152}, {-0.0406739585346113, 0.0, 0.877978124396166, 0.0406739585346114, 0.0813479170692229, 0.877978124396166}, {-0.0406739585346113, 0.0, 0.040673958534611, 0.0406739585346112, 0.918652082930778, 0.0406739585346113}, {-0.877978124396166, 0.0, 0.0406739585346112, 0.877978124396165, 0.0813479170692232, 0.0406739585346118}, {-0.0406739585346115, 0.0, 0.0406739585346116, 0.0406739585346114, 0.918652082930777, 0.0406739585346118}, {-0.322337890142276, 0.0, 0.0329863295731731, 0.322337890142275, 0.644675780284551, 0.0329863295731735}, {-0.322337890142276, 0.0, 0.322337890142276, 0.322337890142276, 0.355324219715449, 0.322337890142276}, {-0.0329863295731732, 0.0, 0.322337890142276, 0.0329863295731731, 0.644675780284551, 0.322337890142276}, {-0.322337890142276, 0.0, 0.322337890142276, 0.322337890142275, 0.355324219715449, 0.322337890142276}, {-0.0636610018750175, 0.0, 0.269672331458316, 0.0636610018750174, 0.666666666666667, 0.269672331458316}, {-0.0636610018750176, 0.0, 0.0636610018750174, 0.0636610018750174, 0.872677996249965, 0.0636610018750177}, {-0.269672331458316, 0.0, 0.0636610018750174, 0.269672331458316, 0.666666666666667, 0.0636610018750177}, {-0.0636610018750175, 0.0, 0.603005664791649, 0.0636610018750175, 0.333333333333334, 0.603005664791649}, {-0.0636610018750176, 0.0, 0.0636610018750176, 0.0636610018750175, 0.872677996249965, 0.0636610018750179}, {-0.603005664791649, 0.0, 0.0636610018750174, 0.603005664791649, 0.333333333333334, 0.0636610018750178}, {-0.603005664791649, 0.0, 0.0636610018750175, 0.603005664791649, 0.333333333333334, 0.063661001875018}, {-0.0636610018750176, 0.0, 0.269672331458316, 0.0636610018750176, 0.666666666666667, 0.269672331458316}, {-0.269672331458316, 0.0, 0.603005664791649, 0.269672331458316, 0.127322003750035, 0.603005664791649}, {-0.269672331458316, 0.0, 0.0636610018750177, 0.269672331458316, 0.666666666666666, 0.063661001875018}, {-0.603005664791649, 0.0, 0.269672331458316, 0.603005664791649, 0.127322003750035, 0.269672331458316}, {-0.0636610018750175, 0.0, 0.603005664791649, 0.0636610018750176, 0.333333333333333, 0.603005664791649}}; static const double FE2_C2[24][6] = \ {{0.214602871259152, 0.356191386222545, 0.0, 0.429205742518303, 0.214602871259152, 0.356191386222545}, {0.214602871259152, 0.214602871259152, 0.0, 0.570794257481697, 0.214602871259152, 0.214602871259152}, {0.214602871259152, 0.214602871259152, 0.0, 0.570794257481696, 0.214602871259152, 0.214602871259152}, {0.356191386222545, 0.214602871259152, 0.0, 0.429205742518303, 0.356191386222545, 0.214602871259152}, {0.0406739585346115, 0.877978124396166, 0.0, 0.0813479170692225, 0.0406739585346115, 0.877978124396166}, {0.0406739585346112, 0.040673958534611, 0.0, 0.918652082930777, 0.0406739585346112, 0.0406739585346112}, {0.0406739585346115, 0.0406739585346114, 0.0, 0.918652082930777, 0.0406739585346116, 0.0406739585346117}, {0.877978124396166, 0.0406739585346116, 0.0, 0.0813479170692224, 0.877978124396166, 0.0406739585346118}, {0.322337890142276, 0.0329863295731731, 0.0, 0.644675780284551, 0.322337890142276, 0.0329863295731734}, {0.322337890142276, 0.322337890142276, 0.0, 0.355324219715448, 0.322337890142276, 0.322337890142276}, {0.322337890142276, 0.322337890142276, 0.0, 0.355324219715448, 0.322337890142276, 0.322337890142276}, {0.0329863295731731, 0.322337890142276, 0.0, 0.644675780284551, 0.0329863295731732, 0.322337890142276}, {0.0636610018750174, 0.269672331458316, 0.0, 0.666666666666667, 0.0636610018750175, 0.269672331458316}, {0.269672331458316, 0.0636610018750174, 0.0, 0.666666666666667, 0.269672331458316, 0.0636610018750177}, {0.0636610018750174, 0.0636610018750174, 0.0, 0.872677996249965, 0.0636610018750175, 0.0636610018750176}, {0.0636610018750175, 0.603005664791649, 0.0, 0.333333333333333, 0.0636610018750176, 0.603005664791649}, {0.603005664791649, 0.0636610018750176, 0.0, 0.333333333333333, 0.603005664791649, 0.0636610018750178}, {0.0636610018750176, 0.0636610018750175, 0.0, 0.872677996249965, 0.0636610018750176, 0.0636610018750178}, {0.269672331458316, 0.0636610018750176, 0.0, 0.666666666666666, 0.269672331458316, 0.0636610018750179}, {0.603005664791649, 0.269672331458316, 0.0, 0.127322003750035, 0.603005664791649, 0.269672331458316}, {0.0636610018750176, 0.603005664791649, 0.0, 0.333333333333333, 0.0636610018750177, 0.603005664791649}, {0.603005664791649, 0.0636610018750176, 0.0, 0.333333333333333, 0.603005664791649, 0.0636610018750179}, {0.0636610018750177, 0.269672331458316, 0.0, 0.666666666666666, 0.0636610018750177, 0.269672331458316}, {0.269672331458316, 0.603005664791649, 0.0, 0.127322003750035, 0.269672331458316, 0.603005664791649}}; // Reset values in the element tensor. for (unsigned int r = 0; r < 900; r++) { A[r] = 0.0; } // end loop over 'r' // Compute element tensor using UFL quadrature representation // Optimisations: ('eliminate zeros', False), ('ignore ones', False), ('ignore zero tables', False), ('optimisation', False), ('remove zero terms', False) // Loop quadrature points for integral. // Number of operations to compute element tensor for following IP loop = 7642944 for (unsigned int ip = 0; ip < 24; ip++) { // Coefficient declarations. double F0 = 0.0; double F1 = 0.0; double F2 = 0.0; double F3 = 0.0; double F4 = 0.0; double F5 = 0.0; double F6 = 0.0; double F7 = 0.0; double F8 = 0.0; double F9 = 0.0; double F10 = 0.0; double F11 = 0.0; double F12 = 0.0; double F13 = 0.0; double F14 = 0.0; // Total number of operations to compute function values = 36 for (unsigned int r = 0; r < 6; r++) { F0 += FE2_C0[ip][r]*w[1][r]; F1 += FE2_C1[ip][r]*w[1][r]; F2 += FE2_C2[ip][r]*w[1][r]; } // end loop over 'r' // Total number of operations to compute function values = 720 for (unsigned int r = 0; r < 30; r++) { F3 += FE1_C0_D100[ip][r]*w[0][r]; F4 += FE1_C0_D010[ip][r]*w[0][r]; F5 += FE1_C0_D001[ip][r]*w[0][r]; F6 += FE1_C1_D100[ip][r]*w[0][r]; F7 += FE1_C1_D010[ip][r]*w[0][r]; F8 += FE1_C1_D001[ip][r]*w[0][r]; F9 += FE1_C2_D100[ip][r]*w[0][r]; F10 += FE1_C2_D010[ip][r]*w[0][r]; F11 += FE1_C2_D001[ip][r]*w[0][r]; F12 += FE1_C0[ip][r]*w[0][r]; F13 += FE1_C1[ip][r]*w[0][r]; F14 += FE1_C2[ip][r]*w[0][r]; } // end loop over 'r' // Number of operations for primary indices: 317700 for (unsigned int j = 0; j < 30; j++) { for (unsigned int k = 0; k < 30; k++) { // Number of operations to compute entry: 353 A[j*30 + k] += (((((((FE1_C0[ip][k]*((((K[2]*F0 + K[5]*F1 + K[8]*F2))*((K[2]*F0 + K[5]*F1 + K[8]*F2)) + nan)) + FE1_C1[ip][k]*(((K[0]*F0 + K[3]*F1 + K[6]*F2))*((-1.0)*((K[1]*F0 + K[4]*F1 + K[7]*F2)))) + FE1_C2[ip][k]*(((K[2]*F0 + K[5]*F1 + K[8]*F2))*((-1.0)*((K[0]*F0 + K[3]*F1 + K[6]*F2))))))*FE1_C0[ip][j] + ((FE1_C0[ip][k]*(((K[0]*F0 + K[3]*F1 + K[6]*F2))*((-1.0)*((K[1]*F0 + K[4]*F1 + K[7]*F2)))) + FE1_C1[ip][k]*((((K[0]*F0 + K[3]*F1 + K[6]*F2))*((K[0]*F0 + K[3]*F1 + K[6]*F2)) + ((K[2]*F0 + K[5]*F1 + K[8]*F2))*((K[2]*F0 + K[5]*F1 + K[8]*F2)))) + FE1_C2[ip][k]*(((K[1]*F0 + K[4]*F1 + K[7]*F2))*((-1.0)*((K[2]*F0 + K[5]*F1 + K[8]*F2))))))*FE1_C1[ip][j] + ((FE1_C0[ip][k]*(((K[2]*F0 + K[5]*F1 + K[8]*F2))*((-1.0)*((K[0]*F0 + K[3]*F1 + K[6]*F2)))) + FE1_C1[ip][k]*(((K[2]*F0 + K[5]*F1 + K[8]*F2))*((-1.0)*((K[1]*F0 + K[4]*F1 + K[7]*F2)))) + FE1_C2[ip][k]*((((K[0]*F0 + K[3]*F1 + K[6]*F2))*((K[0]*F0 + K[3]*F1 + K[6]*F2)) + ((K[1]*F0 + K[4]*F1 + K[7]*F2))*((K[1]*F0 + K[4]*F1 + K[7]*F2))))))*FE1_C2[ip][j]))*0.1 + ((FE1_C0[ip][j]*FE1_C0[ip][k] + FE1_C1[ip][j]*FE1_C1[ip][k] + FE1_C2[ip][j]*FE1_C2[ip][k]))*(0.5*(((K[0]*F3 + K[3]*F4 + K[6]*F5) + (K[1]*F6 + K[4]*F7 + K[7]*F8) + (K[2]*F9 + K[5]*F10 + K[8]*F11))))) + (((((K[0]*FE1_C0_D100[ip][k] + K[3]*FE1_C0_D010[ip][k] + K[6]*FE1_C0_D001[ip][k]))*F12 + ((K[1]*FE1_C0_D100[ip][k] + K[4]*FE1_C0_D010[ip][k] + K[7]*FE1_C0_D001[ip][k]))*F13 + ((K[2]*FE1_C0_D100[ip][k] + K[5]*FE1_C0_D010[ip][k] + K[8]*FE1_C0_D001[ip][k]))*F14))*FE1_C0[ip][j] + ((((K[0]*FE1_C1_D100[ip][k] + K[3]*FE1_C1_D010[ip][k] + K[6]*FE1_C1_D001[ip][k]))*F12 + ((K[1]*FE1_C1_D100[ip][k] + K[4]*FE1_C1_D010[ip][k] + K[7]*FE1_C1_D001[ip][k]))*F13 + ((K[2]*FE1_C1_D100[ip][k] + K[5]*FE1_C1_D010[ip][k] + K[8]*FE1_C1_D001[ip][k]))*F14))*FE1_C1[ip][j] + ((((K[0]*FE1_C2_D100[ip][k] + K[3]*FE1_C2_D010[ip][k] + K[6]*FE1_C2_D001[ip][k]))*F12 + ((K[1]*FE1_C2_D100[ip][k] + K[4]*FE1_C2_D010[ip][k] + K[7]*FE1_C2_D001[ip][k]))*F13 + ((K[2]*FE1_C2_D100[ip][k] + K[5]*FE1_C2_D010[ip][k] + K[8]*FE1_C2_D001[ip][k]))*F14))*FE1_C2[ip][j])) + ((((K[0]*FE1_C0_D100[ip][j] + K[3]*FE1_C0_D010[ip][j] + K[6]*FE1_C0_D001[ip][j]))*((K[0]*FE1_C0_D100[ip][k] + K[3]*FE1_C0_D010[ip][k] + K[6]*FE1_C0_D001[ip][k])) + ((K[0]*FE1_C1_D100[ip][j] + K[3]*FE1_C1_D010[ip][j] + K[6]*FE1_C1_D001[ip][j]))*((K[0]*FE1_C1_D100[ip][k] + K[3]*FE1_C1_D010[ip][k] + K[6]*FE1_C1_D001[ip][k])) + ((K[0]*FE1_C2_D100[ip][j] + K[3]*FE1_C2_D010[ip][j] + K[6]*FE1_C2_D001[ip][j]))*((K[0]*FE1_C2_D100[ip][k] + K[3]*FE1_C2_D010[ip][k] + K[6]*FE1_C2_D001[ip][k]))) + (((K[1]*FE1_C0_D100[ip][j] + K[4]*FE1_C0_D010[ip][j] + K[7]*FE1_C0_D001[ip][j]))*((K[1]*FE1_C0_D100[ip][k] + K[4]*FE1_C0_D010[ip][k] + K[7]*FE1_C0_D001[ip][k])) + ((K[1]*FE1_C1_D100[ip][j] + K[4]*FE1_C1_D010[ip][j] + K[7]*FE1_C1_D001[ip][j]))*((K[1]*FE1_C1_D100[ip][k] + K[4]*FE1_C1_D010[ip][k] + K[7]*FE1_C1_D001[ip][k])) + ((K[1]*FE1_C2_D100[ip][j] + K[4]*FE1_C2_D010[ip][j] + K[7]*FE1_C2_D001[ip][j]))*((K[1]*FE1_C2_D100[ip][k] + K[4]*FE1_C2_D010[ip][k] + K[7]*FE1_C2_D001[ip][k]))) + (((K[2]*FE1_C0_D100[ip][j] + K[5]*FE1_C0_D010[ip][j] + K[8]*FE1_C0_D001[ip][j]))*((K[2]*FE1_C0_D100[ip][k] + K[5]*FE1_C0_D010[ip][k] + K[8]*FE1_C0_D001[ip][k])) + ((K[2]*FE1_C1_D100[ip][j] + K[5]*FE1_C1_D010[ip][j] + K[8]*FE1_C1_D001[ip][j]))*((K[2]*FE1_C1_D100[ip][k] + K[5]*FE1_C1_D010[ip][k] + K[8]*FE1_C1_D001[ip][k])) + ((K[2]*FE1_C2_D100[ip][j] + K[5]*FE1_C2_D010[ip][j] + K[8]*FE1_C2_D001[ip][j]))*((K[2]*FE1_C2_D100[ip][k] + K[5]*FE1_C2_D010[ip][k] + K[8]*FE1_C2_D001[ip][k])))))*W24[ip]*det; } // end loop over 'k' } // end loop over 'j' } // end loop over 'ip' } }; /// This class defines the interface for the tabulation of the /// exterior facet tensor corresponding to the local contribution to /// a form from the integral over an exterior facet. class ffc_form_eca19265a2ab59013b3209e1c7e9bf6a8033d711_exterior_facet_integral_0_otherwise: public ufc::exterior_facet_integral { public: /// Constructor ffc_form_eca19265a2ab59013b3209e1c7e9bf6a8033d711_exterior_facet_integral_0_otherwise() : ufc::exterior_facet_integral() { // Do nothing } /// Destructor virtual ~ffc_form_eca19265a2ab59013b3209e1c7e9bf6a8033d711_exterior_facet_integral_0_otherwise() { // Do nothing } /// Tabulate which form coefficients are used by this integral virtual const std::vector<bool> & enabled_coefficients() const { static const std::vector<bool> enabled({true, false}); return enabled; } /// Tabulate the tensor for the contribution from a local exterior facet virtual void tabulate_tensor(double* A, const double * const * w, const double* vertex_coordinates, std::size_t facet, int cell_orientation) const { // Compute Jacobian double J[9]; compute_jacobian_tetrahedron_3d(J, vertex_coordinates); // Compute Jacobian inverse and determinant double K[9]; double detJ; compute_jacobian_inverse_tetrahedron_3d(K, detJ, J); // Get vertices on face static unsigned int face_vertices[4][3] = {{1, 2, 3}, {0, 2, 3}, {0, 1, 3}, {0, 1, 2}}; const unsigned int v0 = face_vertices[facet][0]; const unsigned int v1 = face_vertices[facet][1]; const unsigned int v2 = face_vertices[facet][2]; // Compute scale factor (area of face scaled by area of reference triangle) const double a0 = (vertex_coordinates[3*v0 + 1]*vertex_coordinates[3*v1 + 2] + vertex_coordinates[3*v0 + 2]*vertex_coordinates[3*v2 + 1] + vertex_coordinates[3*v1 + 1]*vertex_coordinates[3*v2 + 2]) - (vertex_coordinates[3*v2 + 1]*vertex_coordinates[3*v1 + 2] + vertex_coordinates[3*v2 + 2]*vertex_coordinates[3*v0 + 1] + vertex_coordinates[3*v1 + 1]*vertex_coordinates[3*v0 + 2]); const double a1 = (vertex_coordinates[3*v0 + 2]*vertex_coordinates[3*v1 + 0] + vertex_coordinates[3*v0 + 0]*vertex_coordinates[3*v2 + 2] + vertex_coordinates[3*v1 + 2]*vertex_coordinates[3*v2 + 0]) - (vertex_coordinates[3*v2 + 2]*vertex_coordinates[3*v1 + 0] + vertex_coordinates[3*v2 + 0]*vertex_coordinates[3*v0 + 2] + vertex_coordinates[3*v1 + 2]*vertex_coordinates[3*v0 + 0]); const double a2 = (vertex_coordinates[3*v0 + 0]*vertex_coordinates[3*v1 + 1] + vertex_coordinates[3*v0 + 1]*vertex_coordinates[3*v2 + 0] + vertex_coordinates[3*v1 + 0]*vertex_coordinates[3*v2 + 1]) - (vertex_coordinates[3*v2 + 0]*vertex_coordinates[3*v1 + 1] + vertex_coordinates[3*v2 + 1]*vertex_coordinates[3*v0 + 0] + vertex_coordinates[3*v1 + 0]*vertex_coordinates[3*v0 + 1]); const double det = std::sqrt(a0*a0 + a1*a1 + a2*a2); const bool direction = a0*(vertex_coordinates[3*facet] - vertex_coordinates[3*v0]) + a1*(vertex_coordinates[3*facet + 1] - vertex_coordinates[3*v0 + 1]) + a2*(vertex_coordinates[3*facet + 2] - vertex_coordinates[3*v0 + 2]) < 0; const double n0 = direction ? a0 / det : -a0 / det; const double n1 = direction ? a1 / det : -a1 / det; const double n2 = direction ? a2 / det : -a2 / det; // Facet area (divide by two because 'det' is scaled by area of reference triangle) // Min edge length of facet double min_facet_edge_length; compute_min_facet_edge_length_tetrahedron_3d(min_facet_edge_length, facet, vertex_coordinates); // Max edge length of facet double max_facet_edge_length; compute_max_facet_edge_length_tetrahedron_3d(max_facet_edge_length, facet, vertex_coordinates); // Compute cell volume // Compute circumradius // Array of quadrature weights. static const double W12[12] = {0.0254224531851035, 0.0254224531851035, 0.0254224531851035, 0.0583931378631895, 0.0583931378631895, 0.0583931378631895, 0.041425537809187, 0.041425537809187, 0.041425537809187, 0.041425537809187, 0.041425537809187, 0.041425537809187}; // Quadrature points on the UFC reference element: (0.873821971016996, 0.063089014491502), (0.063089014491502, 0.873821971016996), (0.063089014491502, 0.063089014491502), (0.501426509658179, 0.24928674517091), (0.24928674517091, 0.501426509658179), (0.24928674517091, 0.24928674517091), (0.636502499121399, 0.310352451033785), (0.636502499121399, 0.053145049844816), (0.310352451033785, 0.636502499121399), (0.310352451033785, 0.053145049844816), (0.053145049844816, 0.636502499121399), (0.053145049844816, 0.310352451033785) // Values of basis functions at quadrature points. static const double FE1_f0_C0[12][30] = \ {{0.0, -0.0551285669924841, 0.653307703047059, -0.0551285669924841, 0.220514267969936, 0.0159208949980359, 0.220514267969936, 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.055128566992484, -0.0551285669924841, 0.65330770304706, 0.220514267969936, 0.220514267969936, 0.0159208949980358, 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.653307703047059, -0.0551285669924841, -0.0551285669924841, 0.0159208949980357, 0.220514267969936, 0.220514267969936, 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.124998982535098, 0.00143057951778883, -0.124998982535098, 0.499995930140389, 0.248575525271626, 0.499995930140391, 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.124998982535098, -0.124998982535098, 0.00143057951778883, 0.499995930140389, 0.499995930140391, 0.248575525271626, 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.00143057951778981, -0.124998982535097, -0.124998982535098, 0.248575525271625, 0.49999593014039, 0.49999593014039, 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.0474962571988001, 0.173768363654174, -0.117715163308429, 0.790160442765823, 0.0659747859186054, 0.135307828168627, 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.117715163308429, 0.173768363654174, -0.0474962571988, 0.135307828168627, 0.0659747859186053, 0.790160442765823, 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.0474962571988001, -0.117715163308429, 0.173768363654174, 0.790160442765823, 0.135307828168627, 0.0659747859186054, 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.173768363654174, -0.117715163308429, -0.0474962571988, 0.0659747859186052, 0.135307828168627, 0.790160442765823, 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.117715163308429, -0.0474962571988, 0.173768363654174, 0.135307828168626, 0.790160442765823, 0.0659747859186052, 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.173768363654174, -0.0474962571988, -0.117715163308429, 0.065974785918605, 0.790160442765823, 0.135307828168627, 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}}; static const double FE1_f0_C1[12][30] = \ {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -0.0551285669924841, 0.653307703047059, -0.0551285669924841, 0.220514267969936, 0.0159208949980359, 0.220514267969936, 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.055128566992484, -0.0551285669924841, 0.65330770304706, 0.220514267969936, 0.220514267969936, 0.0159208949980358, 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.653307703047059, -0.0551285669924841, -0.0551285669924841, 0.0159208949980357, 0.220514267969936, 0.220514267969936, 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.124998982535098, 0.00143057951778883, -0.124998982535098, 0.499995930140389, 0.248575525271626, 0.499995930140391, 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.124998982535098, -0.124998982535098, 0.00143057951778883, 0.499995930140389, 0.499995930140391, 0.248575525271626, 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.00143057951778981, -0.124998982535097, -0.124998982535098, 0.248575525271625, 0.49999593014039, 0.49999593014039, 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.0474962571988001, 0.173768363654174, -0.117715163308429, 0.790160442765823, 0.0659747859186054, 0.135307828168627, 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.117715163308429, 0.173768363654174, -0.0474962571988, 0.135307828168627, 0.0659747859186053, 0.790160442765823, 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.0474962571988001, -0.117715163308429, 0.173768363654174, 0.790160442765823, 0.135307828168627, 0.0659747859186054, 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.173768363654174, -0.117715163308429, -0.0474962571988, 0.0659747859186052, 0.135307828168627, 0.790160442765823, 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.117715163308429, -0.0474962571988, 0.173768363654174, 0.135307828168626, 0.790160442765823, 0.0659747859186052, 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.173768363654174, -0.0474962571988, -0.117715163308429, 0.065974785918605, 0.790160442765823, 0.135307828168627, 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}}; static const double FE1_f0_C2[12][30] = \ {{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.0551285669924841, 0.653307703047059, -0.0551285669924841, 0.220514267969936, 0.0159208949980359, 0.220514267969936, 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.055128566992484, -0.0551285669924841, 0.65330770304706, 0.220514267969936, 0.220514267969936, 0.0159208949980358, 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.653307703047059, -0.0551285669924841, -0.0551285669924841, 0.0159208949980357, 0.220514267969936, 0.220514267969936, 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.124998982535098, 0.00143057951778883, -0.124998982535098, 0.499995930140389, 0.248575525271626, 0.499995930140391, 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.124998982535098, -0.124998982535098, 0.00143057951778883, 0.499995930140389, 0.499995930140391, 0.248575525271626, 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.00143057951778981, -0.124998982535097, -0.124998982535098, 0.248575525271625, 0.49999593014039, 0.49999593014039, 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.0474962571988001, 0.173768363654174, -0.117715163308429, 0.790160442765823, 0.0659747859186054, 0.135307828168627, 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.117715163308429, 0.173768363654174, -0.0474962571988, 0.135307828168627, 0.0659747859186053, 0.790160442765823, 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.0474962571988001, -0.117715163308429, 0.173768363654174, 0.790160442765823, 0.135307828168627, 0.0659747859186054, 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.173768363654174, -0.117715163308429, -0.0474962571988, 0.0659747859186052, 0.135307828168627, 0.790160442765823, 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.117715163308429, -0.0474962571988, 0.173768363654174, 0.135307828168626, 0.790160442765823, 0.0659747859186052, 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.173768363654174, -0.0474962571988, -0.117715163308429, 0.065974785918605, 0.790160442765823, 0.135307828168627, 0.0, 0.0, 0.0}}; static const double FE1_f1_C0[12][30] = \ {{-0.0551285669924842, 0.0, 0.653307703047059, -0.0551285669924841, 0.220514267969936, 0.0, 0.0, 0.0159208949980357, 0.220514267969937, 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.055128566992484, 0.0, -0.0551285669924841, 0.65330770304706, 0.220514267969936, 0.0, 0.0, 0.220514267969936, 0.0159208949980358, 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.65330770304706, 0.0, -0.0551285669924841, -0.0551285669924841, 0.0159208949980357, 0.0, 0.0, 0.220514267969936, 0.220514267969937, 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.124998982535098, 0.0, 0.00143057951778878, -0.124998982535098, 0.499995930140389, 0.0, 0.0, 0.248575525271626, 0.499995930140391, 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.124998982535098, 0.0, -0.124998982535098, 0.00143057951778877, 0.499995930140389, 0.0, 0.0, 0.499995930140391, 0.248575525271626, 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.00143057951778984, 0.0, -0.124998982535098, -0.124998982535098, 0.248575525271625, 0.0, 0.0, 0.49999593014039, 0.49999593014039, 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.0474962571988, 0.0, 0.173768363654174, -0.117715163308429, 0.790160442765823, 0.0, 0.0, 0.0659747859186052, 0.135307828168627, 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.117715163308429, 0.0, 0.173768363654174, -0.0474962571988, 0.135307828168627, 0.0, 0.0, 0.0659747859186051, 0.790160442765823, 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.0474962571988, 0.0, -0.117715163308429, 0.173768363654174, 0.790160442765823, 0.0, 0.0, 0.135307828168627, 0.0659747859186053, 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.173768363654174, 0.0, -0.117715163308429, -0.0474962571988, 0.0659747859186052, 0.0, 0.0, 0.135307828168627, 0.790160442765823, 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.117715163308429, 0.0, -0.0474962571988, 0.173768363654174, 0.135307828168627, 0.0, 0.0, 0.790160442765823, 0.0659747859186053, 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.173768363654174, 0.0, -0.0474962571988, -0.117715163308429, 0.0659747859186051, 0.0, 0.0, 0.790160442765823, 0.135307828168627, 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}}; static const double FE1_f1_C1[12][30] = \ {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -0.0551285669924842, 0.0, 0.653307703047059, -0.0551285669924841, 0.220514267969936, 0.0, 0.0, 0.0159208949980357, 0.220514267969937, 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.055128566992484, 0.0, -0.0551285669924841, 0.65330770304706, 0.220514267969936, 0.0, 0.0, 0.220514267969936, 0.0159208949980358, 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.65330770304706, 0.0, -0.0551285669924841, -0.0551285669924841, 0.0159208949980357, 0.0, 0.0, 0.220514267969936, 0.220514267969937, 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.124998982535098, 0.0, 0.00143057951778878, -0.124998982535098, 0.499995930140389, 0.0, 0.0, 0.248575525271626, 0.499995930140391, 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.124998982535098, 0.0, -0.124998982535098, 0.00143057951778877, 0.499995930140389, 0.0, 0.0, 0.499995930140391, 0.248575525271626, 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.00143057951778984, 0.0, -0.124998982535098, -0.124998982535098, 0.248575525271625, 0.0, 0.0, 0.49999593014039, 0.49999593014039, 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.0474962571988, 0.0, 0.173768363654174, -0.117715163308429, 0.790160442765823, 0.0, 0.0, 0.0659747859186052, 0.135307828168627, 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.117715163308429, 0.0, 0.173768363654174, -0.0474962571988, 0.135307828168627, 0.0, 0.0, 0.0659747859186051, 0.790160442765823, 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.0474962571988, 0.0, -0.117715163308429, 0.173768363654174, 0.790160442765823, 0.0, 0.0, 0.135307828168627, 0.0659747859186053, 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.173768363654174, 0.0, -0.117715163308429, -0.0474962571988, 0.0659747859186052, 0.0, 0.0, 0.135307828168627, 0.790160442765823, 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.117715163308429, 0.0, -0.0474962571988, 0.173768363654174, 0.135307828168627, 0.0, 0.0, 0.790160442765823, 0.0659747859186053, 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.173768363654174, 0.0, -0.0474962571988, -0.117715163308429, 0.0659747859186051, 0.0, 0.0, 0.790160442765823, 0.135307828168627, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}}; static const double FE1_f1_C2[12][30] = \ {{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.0551285669924842, 0.0, 0.653307703047059, -0.0551285669924841, 0.220514267969936, 0.0, 0.0, 0.0159208949980357, 0.220514267969937, 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.055128566992484, 0.0, -0.0551285669924841, 0.65330770304706, 0.220514267969936, 0.0, 0.0, 0.220514267969936, 0.0159208949980358, 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.65330770304706, 0.0, -0.0551285669924841, -0.0551285669924841, 0.0159208949980357, 0.0, 0.0, 0.220514267969936, 0.220514267969937, 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.124998982535098, 0.0, 0.00143057951778878, -0.124998982535098, 0.499995930140389, 0.0, 0.0, 0.248575525271626, 0.499995930140391, 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.124998982535098, 0.0, -0.124998982535098, 0.00143057951778877, 0.499995930140389, 0.0, 0.0, 0.499995930140391, 0.248575525271626, 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.00143057951778984, 0.0, -0.124998982535098, -0.124998982535098, 0.248575525271625, 0.0, 0.0, 0.49999593014039, 0.49999593014039, 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.0474962571988, 0.0, 0.173768363654174, -0.117715163308429, 0.790160442765823, 0.0, 0.0, 0.0659747859186052, 0.135307828168627, 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.117715163308429, 0.0, 0.173768363654174, -0.0474962571988, 0.135307828168627, 0.0, 0.0, 0.0659747859186051, 0.790160442765823, 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.0474962571988, 0.0, -0.117715163308429, 0.173768363654174, 0.790160442765823, 0.0, 0.0, 0.135307828168627, 0.0659747859186053, 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.173768363654174, 0.0, -0.117715163308429, -0.0474962571988, 0.0659747859186052, 0.0, 0.0, 0.135307828168627, 0.790160442765823, 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.117715163308429, 0.0, -0.0474962571988, 0.173768363654174, 0.135307828168627, 0.0, 0.0, 0.790160442765823, 0.0659747859186053, 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.173768363654174, 0.0, -0.0474962571988, -0.117715163308429, 0.0659747859186051, 0.0, 0.0, 0.790160442765823, 0.135307828168627, 0.0}}; static const double FE1_f2_C0[12][30] = \ {{-0.0551285669924841, 0.653307703047059, 0.0, -0.0551285669924841, 0.0, 0.220514267969936, 0.0, 0.0159208949980358, 0.0, 0.220514267969937, 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.0551285669924841, -0.0551285669924841, 0.0, 0.65330770304706, 0.0, 0.220514267969937, 0.0, 0.220514267969936, 0.0, 0.0159208949980359, 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.653307703047059, -0.0551285669924841, 0.0, -0.0551285669924841, 0.0, 0.0159208949980358, 0.0, 0.220514267969936, 0.0, 0.220514267969937, 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.124998982535098, 0.00143057951778886, 0.0, -0.124998982535098, 0.0, 0.499995930140389, 0.0, 0.248575525271626, 0.0, 0.499995930140391, 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.124998982535098, -0.124998982535098, 0.0, 0.00143057951778885, 0.0, 0.499995930140389, 0.0, 0.499995930140391, 0.0, 0.248575525271626, 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.0014305795177898, -0.124998982535097, 0.0, -0.124998982535098, 0.0, 0.248575525271625, 0.0, 0.49999593014039, 0.0, 0.49999593014039, 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.0474962571988001, 0.173768363654174, 0.0, -0.117715163308429, 0.0, 0.790160442765823, 0.0, 0.0659747859186052, 0.0, 0.135307828168627, 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.117715163308429, 0.173768363654174, 0.0, -0.0474962571988, 0.0, 0.135307828168627, 0.0, 0.0659747859186052, 0.0, 0.790160442765823, 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.0474962571988, -0.117715163308429, 0.0, 0.173768363654174, 0.0, 0.790160442765823, 0.0, 0.135307828168627, 0.0, 0.0659747859186053, 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.173768363654174, -0.117715163308429, 0.0, -0.0474962571988, 0.0, 0.0659747859186053, 0.0, 0.135307828168627, 0.0, 0.790160442765823, 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.117715163308429, -0.0474962571988, 0.0, 0.173768363654174, 0.0, 0.135307828168627, 0.0, 0.790160442765823, 0.0, 0.0659747859186053, 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.173768363654174, -0.0474962571988001, 0.0, -0.117715163308429, 0.0, 0.0659747859186054, 0.0, 0.790160442765823, 0.0, 0.135307828168627, 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}}; static const double FE1_f2_C1[12][30] = \ {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -0.0551285669924841, 0.653307703047059, 0.0, -0.0551285669924841, 0.0, 0.220514267969936, 0.0, 0.0159208949980358, 0.0, 0.220514267969937, 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.0551285669924841, -0.0551285669924841, 0.0, 0.65330770304706, 0.0, 0.220514267969937, 0.0, 0.220514267969936, 0.0, 0.0159208949980359, 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.653307703047059, -0.0551285669924841, 0.0, -0.0551285669924841, 0.0, 0.0159208949980358, 0.0, 0.220514267969936, 0.0, 0.220514267969937, 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.124998982535098, 0.00143057951778886, 0.0, -0.124998982535098, 0.0, 0.499995930140389, 0.0, 0.248575525271626, 0.0, 0.499995930140391, 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.124998982535098, -0.124998982535098, 0.0, 0.00143057951778885, 0.0, 0.499995930140389, 0.0, 0.499995930140391, 0.0, 0.248575525271626, 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.0014305795177898, -0.124998982535097, 0.0, -0.124998982535098, 0.0, 0.248575525271625, 0.0, 0.49999593014039, 0.0, 0.49999593014039, 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.0474962571988001, 0.173768363654174, 0.0, -0.117715163308429, 0.0, 0.790160442765823, 0.0, 0.0659747859186052, 0.0, 0.135307828168627, 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.117715163308429, 0.173768363654174, 0.0, -0.0474962571988, 0.0, 0.135307828168627, 0.0, 0.0659747859186052, 0.0, 0.790160442765823, 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.0474962571988, -0.117715163308429, 0.0, 0.173768363654174, 0.0, 0.790160442765823, 0.0, 0.135307828168627, 0.0, 0.0659747859186053, 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.173768363654174, -0.117715163308429, 0.0, -0.0474962571988, 0.0, 0.0659747859186053, 0.0, 0.135307828168627, 0.0, 0.790160442765823, 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.117715163308429, -0.0474962571988, 0.0, 0.173768363654174, 0.0, 0.135307828168627, 0.0, 0.790160442765823, 0.0, 0.0659747859186053, 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.173768363654174, -0.0474962571988001, 0.0, -0.117715163308429, 0.0, 0.0659747859186054, 0.0, 0.790160442765823, 0.0, 0.135307828168627, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}}; static const double FE1_f2_C2[12][30] = \ {{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.0551285669924841, 0.653307703047059, 0.0, -0.0551285669924841, 0.0, 0.220514267969936, 0.0, 0.0159208949980358, 0.0, 0.220514267969937}, {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.0551285669924841, -0.0551285669924841, 0.0, 0.65330770304706, 0.0, 0.220514267969937, 0.0, 0.220514267969936, 0.0, 0.0159208949980359}, {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.653307703047059, -0.0551285669924841, 0.0, -0.0551285669924841, 0.0, 0.0159208949980358, 0.0, 0.220514267969936, 0.0, 0.220514267969937}, {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.124998982535098, 0.00143057951778886, 0.0, -0.124998982535098, 0.0, 0.499995930140389, 0.0, 0.248575525271626, 0.0, 0.499995930140391}, {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.124998982535098, -0.124998982535098, 0.0, 0.00143057951778885, 0.0, 0.499995930140389, 0.0, 0.499995930140391, 0.0, 0.248575525271626}, {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.0014305795177898, -0.124998982535097, 0.0, -0.124998982535098, 0.0, 0.248575525271625, 0.0, 0.49999593014039, 0.0, 0.49999593014039}, {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.0474962571988001, 0.173768363654174, 0.0, -0.117715163308429, 0.0, 0.790160442765823, 0.0, 0.0659747859186052, 0.0, 0.135307828168627}, {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.117715163308429, 0.173768363654174, 0.0, -0.0474962571988, 0.0, 0.135307828168627, 0.0, 0.0659747859186052, 0.0, 0.790160442765823}, {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.0474962571988, -0.117715163308429, 0.0, 0.173768363654174, 0.0, 0.790160442765823, 0.0, 0.135307828168627, 0.0, 0.0659747859186053}, {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.173768363654174, -0.117715163308429, 0.0, -0.0474962571988, 0.0, 0.0659747859186053, 0.0, 0.135307828168627, 0.0, 0.790160442765823}, {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.117715163308429, -0.0474962571988, 0.0, 0.173768363654174, 0.0, 0.135307828168627, 0.0, 0.790160442765823, 0.0, 0.0659747859186053}, {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.173768363654174, -0.0474962571988001, 0.0, -0.117715163308429, 0.0, 0.0659747859186054, 0.0, 0.790160442765823, 0.0, 0.135307828168627}}; static const double FE1_f3_C0[12][30] = \ {{-0.0551285669924842, 0.653307703047059, -0.0551285669924841, 0.0, 0.0, 0.0, 0.220514267969936, 0.0, 0.0159208949980359, 0.220514267969937, 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.0551285669924841, -0.0551285669924841, 0.653307703047059, 0.0, 0.0, 0.0, 0.220514267969936, 0.0, 0.220514267969936, 0.0159208949980359, 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.653307703047059, -0.0551285669924842, -0.0551285669924841, 0.0, 0.0, 0.0, 0.0159208949980358, 0.0, 0.220514267969937, 0.220514267969937, 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.124998982535098, 0.00143057951778884, -0.124998982535097, 0.0, 0.0, 0.0, 0.499995930140389, 0.0, 0.248575525271626, 0.499995930140391, 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.124998982535098, -0.124998982535097, 0.00143057951778879, 0.0, 0.0, 0.0, 0.499995930140389, 0.0, 0.499995930140391, 0.248575525271626, 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.00143057951778983, -0.124998982535097, -0.124998982535098, 0.0, 0.0, 0.0, 0.248575525271625, 0.0, 0.49999593014039, 0.49999593014039, 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.0474962571988, 0.173768363654174, -0.117715163308429, 0.0, 0.0, 0.0, 0.790160442765823, 0.0, 0.0659747859186053, 0.135307828168627, 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.117715163308429, 0.173768363654174, -0.0474962571988, 0.0, 0.0, 0.0, 0.135307828168627, 0.0, 0.0659747859186053, 0.790160442765823, 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.0474962571988, -0.117715163308429, 0.173768363654174, 0.0, 0.0, 0.0, 0.790160442765823, 0.0, 0.135307828168627, 0.0659747859186052, 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.173768363654174, -0.117715163308429, -0.0474962571988, 0.0, 0.0, 0.0, 0.0659747859186052, 0.0, 0.135307828168627, 0.790160442765823, 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.117715163308429, -0.0474962571988, 0.173768363654174, 0.0, 0.0, 0.0, 0.135307828168627, 0.0, 0.790160442765823, 0.0659747859186053, 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.173768363654174, -0.0474962571988, -0.117715163308429, 0.0, 0.0, 0.0, 0.0659747859186053, 0.0, 0.790160442765823, 0.135307828168627, 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}}; static const double FE1_f3_C1[12][30] = \ {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -0.0551285669924842, 0.653307703047059, -0.0551285669924841, 0.0, 0.0, 0.0, 0.220514267969936, 0.0, 0.0159208949980359, 0.220514267969937, 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.0551285669924841, -0.0551285669924841, 0.653307703047059, 0.0, 0.0, 0.0, 0.220514267969936, 0.0, 0.220514267969936, 0.0159208949980359, 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.653307703047059, -0.0551285669924842, -0.0551285669924841, 0.0, 0.0, 0.0, 0.0159208949980358, 0.0, 0.220514267969937, 0.220514267969937, 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.124998982535098, 0.00143057951778884, -0.124998982535097, 0.0, 0.0, 0.0, 0.499995930140389, 0.0, 0.248575525271626, 0.499995930140391, 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.124998982535098, -0.124998982535097, 0.00143057951778879, 0.0, 0.0, 0.0, 0.499995930140389, 0.0, 0.499995930140391, 0.248575525271626, 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.00143057951778983, -0.124998982535097, -0.124998982535098, 0.0, 0.0, 0.0, 0.248575525271625, 0.0, 0.49999593014039, 0.49999593014039, 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.0474962571988, 0.173768363654174, -0.117715163308429, 0.0, 0.0, 0.0, 0.790160442765823, 0.0, 0.0659747859186053, 0.135307828168627, 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.117715163308429, 0.173768363654174, -0.0474962571988, 0.0, 0.0, 0.0, 0.135307828168627, 0.0, 0.0659747859186053, 0.790160442765823, 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.0474962571988, -0.117715163308429, 0.173768363654174, 0.0, 0.0, 0.0, 0.790160442765823, 0.0, 0.135307828168627, 0.0659747859186052, 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.173768363654174, -0.117715163308429, -0.0474962571988, 0.0, 0.0, 0.0, 0.0659747859186052, 0.0, 0.135307828168627, 0.790160442765823, 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.117715163308429, -0.0474962571988, 0.173768363654174, 0.0, 0.0, 0.0, 0.135307828168627, 0.0, 0.790160442765823, 0.0659747859186053, 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.173768363654174, -0.0474962571988, -0.117715163308429, 0.0, 0.0, 0.0, 0.0659747859186053, 0.0, 0.790160442765823, 0.135307828168627, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}}; static const double FE1_f3_C2[12][30] = \ {{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.0551285669924842, 0.653307703047059, -0.0551285669924841, 0.0, 0.0, 0.0, 0.220514267969936, 0.0, 0.0159208949980359, 0.220514267969937}, {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.0551285669924841, -0.0551285669924841, 0.653307703047059, 0.0, 0.0, 0.0, 0.220514267969936, 0.0, 0.220514267969936, 0.0159208949980359}, {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.653307703047059, -0.0551285669924842, -0.0551285669924841, 0.0, 0.0, 0.0, 0.0159208949980358, 0.0, 0.220514267969937, 0.220514267969937}, {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.124998982535098, 0.00143057951778884, -0.124998982535097, 0.0, 0.0, 0.0, 0.499995930140389, 0.0, 0.248575525271626, 0.499995930140391}, {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.124998982535098, -0.124998982535097, 0.00143057951778879, 0.0, 0.0, 0.0, 0.499995930140389, 0.0, 0.499995930140391, 0.248575525271626}, {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.00143057951778983, -0.124998982535097, -0.124998982535098, 0.0, 0.0, 0.0, 0.248575525271625, 0.0, 0.49999593014039, 0.49999593014039}, {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.0474962571988, 0.173768363654174, -0.117715163308429, 0.0, 0.0, 0.0, 0.790160442765823, 0.0, 0.0659747859186053, 0.135307828168627}, {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.117715163308429, 0.173768363654174, -0.0474962571988, 0.0, 0.0, 0.0, 0.135307828168627, 0.0, 0.0659747859186053, 0.790160442765823}, {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.0474962571988, -0.117715163308429, 0.173768363654174, 0.0, 0.0, 0.0, 0.790160442765823, 0.0, 0.135307828168627, 0.0659747859186052}, {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.173768363654174, -0.117715163308429, -0.0474962571988, 0.0, 0.0, 0.0, 0.0659747859186052, 0.0, 0.135307828168627, 0.790160442765823}, {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.117715163308429, -0.0474962571988, 0.173768363654174, 0.0, 0.0, 0.0, 0.135307828168627, 0.0, 0.790160442765823, 0.0659747859186053}, {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.173768363654174, -0.0474962571988, -0.117715163308429, 0.0, 0.0, 0.0, 0.0659747859186053, 0.0, 0.790160442765823, 0.135307828168627}}; // Reset values in the element tensor. for (unsigned int r = 0; r < 900; r++) { A[r] = 0.0; } // end loop over 'r' // Compute element tensor using UFL quadrature representation // Optimisations: ('eliminate zeros', False), ('ignore ones', False), ('ignore zero tables', False), ('optimisation', False), ('remove zero terms', False) switch (facet) { case 0: { // Total number of operations to compute element tensor (from this point): 174960 // Loop quadrature points for integral. // Number of operations to compute element tensor for following IP loop = 174960 for (unsigned int ip = 0; ip < 12; ip++) { // Coefficient declarations. double F0 = 0.0; double F1 = 0.0; double F2 = 0.0; // Total number of operations to compute function values = 180 for (unsigned int r = 0; r < 30; r++) { F0 += FE1_f0_C0[ip][r]*w[0][r]; F1 += FE1_f0_C1[ip][r]*w[0][r]; F2 += FE1_f0_C2[ip][r]*w[0][r]; } // end loop over 'r' // Number of operations for primary indices: 14400 for (unsigned int j = 0; j < 30; j++) { for (unsigned int k = 0; k < 30; k++) { // Number of operations to compute entry: 16 A[j*30 + k] += (((FE1_f0_C0[ip][j]*FE1_f0_C0[ip][k] + FE1_f0_C1[ip][j]*FE1_f0_C1[ip][k] + FE1_f0_C2[ip][j]*FE1_f0_C2[ip][k]))*(0.5*((n0*F0 + n1*F1 + n2*F2))))*(-1.0)*W12[ip]*det; } // end loop over 'k' } // end loop over 'j' } // end loop over 'ip' break; } case 1: { // Total number of operations to compute element tensor (from this point): 174960 // Loop quadrature points for integral. // Number of operations to compute element tensor for following IP loop = 174960 for (unsigned int ip = 0; ip < 12; ip++) { // Coefficient declarations. double F0 = 0.0; double F1 = 0.0; double F2 = 0.0; // Total number of operations to compute function values = 180 for (unsigned int r = 0; r < 30; r++) { F0 += FE1_f1_C0[ip][r]*w[0][r]; F1 += FE1_f1_C1[ip][r]*w[0][r]; F2 += FE1_f1_C2[ip][r]*w[0][r]; } // end loop over 'r' // Number of operations for primary indices: 14400 for (unsigned int j = 0; j < 30; j++) { for (unsigned int k = 0; k < 30; k++) { // Number of operations to compute entry: 16 A[j*30 + k] += (((FE1_f1_C0[ip][j]*FE1_f1_C0[ip][k] + FE1_f1_C1[ip][j]*FE1_f1_C1[ip][k] + FE1_f1_C2[ip][j]*FE1_f1_C2[ip][k]))*(0.5*((n0*F0 + n1*F1 + n2*F2))))*(-1.0)*W12[ip]*det; } // end loop over 'k' } // end loop over 'j' } // end loop over 'ip' break; } case 2: { // Total number of operations to compute element tensor (from this point): 174960 // Loop quadrature points for integral. // Number of operations to compute element tensor for following IP loop = 174960 for (unsigned int ip = 0; ip < 12; ip++) { // Coefficient declarations. double F0 = 0.0; double F1 = 0.0; double F2 = 0.0; // Total number of operations to compute function values = 180 for (unsigned int r = 0; r < 30; r++) { F0 += FE1_f2_C0[ip][r]*w[0][r]; F1 += FE1_f2_C1[ip][r]*w[0][r]; F2 += FE1_f2_C2[ip][r]*w[0][r]; } // end loop over 'r' // Number of operations for primary indices: 14400 for (unsigned int j = 0; j < 30; j++) { for (unsigned int k = 0; k < 30; k++) { // Number of operations to compute entry: 16 A[j*30 + k] += (((FE1_f2_C0[ip][j]*FE1_f2_C0[ip][k] + FE1_f2_C1[ip][j]*FE1_f2_C1[ip][k] + FE1_f2_C2[ip][j]*FE1_f2_C2[ip][k]))*(0.5*((n0*F0 + n1*F1 + n2*F2))))*(-1.0)*W12[ip]*det; } // end loop over 'k' } // end loop over 'j' } // end loop over 'ip' break; } case 3: { // Total number of operations to compute element tensor (from this point): 174960 // Loop quadrature points for integral. // Number of operations to compute element tensor for following IP loop = 174960 for (unsigned int ip = 0; ip < 12; ip++) { // Coefficient declarations. double F0 = 0.0; double F1 = 0.0; double F2 = 0.0; // Total number of operations to compute function values = 180 for (unsigned int r = 0; r < 30; r++) { F0 += FE1_f3_C0[ip][r]*w[0][r]; F1 += FE1_f3_C1[ip][r]*w[0][r]; F2 += FE1_f3_C2[ip][r]*w[0][r]; } // end loop over 'r' // Number of operations for primary indices: 14400 for (unsigned int j = 0; j < 30; j++) { for (unsigned int k = 0; k < 30; k++) { // Number of operations to compute entry: 16 A[j*30 + k] += (((FE1_f3_C0[ip][j]*FE1_f3_C0[ip][k] + FE1_f3_C1[ip][j]*FE1_f3_C1[ip][k] + FE1_f3_C2[ip][j]*FE1_f3_C2[ip][k]))*(0.5*((n0*F0 + n1*F1 + n2*F2))))*(-1.0)*W12[ip]*det; } // end loop over 'k' } // end loop over 'j' } // end loop over 'ip' break; } } } }; /// This class defines the interface for the assembly of the global /// tensor corresponding to a form with r + n arguments, that is, a /// mapping /// /// a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R /// /// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r /// global tensor A is defined by /// /// A = a(V1, V2, ..., Vr, w1, w2, ..., wn), /// /// where each argument Vj represents the application to the /// sequence of basis functions of Vj and w1, w2, ..., wn are given /// fixed functions (coefficients). class ffc_form_eca19265a2ab59013b3209e1c7e9bf6a8033d711_form_0: public ufc::form { public: /// Constructor ffc_form_eca19265a2ab59013b3209e1c7e9bf6a8033d711_form_0() : ufc::form() { // Do nothing } /// Destructor virtual ~ffc_form_eca19265a2ab59013b3209e1c7e9bf6a8033d711_form_0() { // Do nothing } /// Return a string identifying the form virtual const char* signature() const { return "e5b1b31bab7cb23ea33650db0428bb4950c1c6ba82d93713eb322dab9f666f80633217433eaca36160362200f52f9e46e1dadaf04f014fed1b63c6ebcdc2274e"; } /// Return the rank of the global tensor (r) virtual std::size_t rank() const { return 2; } /// Return the number of coefficients (n) virtual std::size_t num_coefficients() const { return 2; } /// Return original coefficient position for each coefficient (0 <= i < n) virtual std::size_t original_coefficient_position(std::size_t i) const { static const std::vector<std::size_t> position({0, 1}); return position[i]; } /// Create a new finite element for argument function i virtual ufc::finite_element* create_finite_element(std::size_t i) const { switch (i) { case 0: { return new ffc_form_eca19265a2ab59013b3209e1c7e9bf6a8033d711_finite_element_2(); break; } case 1: { return new ffc_form_eca19265a2ab59013b3209e1c7e9bf6a8033d711_finite_element_2(); break; } case 2: { return new ffc_form_eca19265a2ab59013b3209e1c7e9bf6a8033d711_finite_element_2(); break; } case 3: { return new ffc_form_eca19265a2ab59013b3209e1c7e9bf6a8033d711_finite_element_0(); break; } } return 0; } /// Create a new dofmap for argument function i virtual ufc::dofmap* create_dofmap(std::size_t i) const { switch (i) { case 0: { return new ffc_form_eca19265a2ab59013b3209e1c7e9bf6a8033d711_dofmap_2(); break; } case 1: { return new ffc_form_eca19265a2ab59013b3209e1c7e9bf6a8033d711_dofmap_2(); break; } case 2: { return new ffc_form_eca19265a2ab59013b3209e1c7e9bf6a8033d711_dofmap_2(); break; } case 3: { return new ffc_form_eca19265a2ab59013b3209e1c7e9bf6a8033d711_dofmap_0(); break; } } return 0; } /// Return the number of cell domains virtual std::size_t max_cell_subdomain_id() const { return 0; } /// Return the number of exterior facet domains virtual std::size_t max_exterior_facet_subdomain_id() const { return 0; } /// Return the number of interior facet domains virtual std::size_t max_interior_facet_subdomain_id() const { return 0; } /// Return the number of vertex domains virtual std::size_t max_vertex_subdomain_id() const { return 0; } /// Return the number of custom domains virtual std::size_t max_custom_subdomain_id() const { return 0; } /// Return whether the form has any cell integrals virtual bool has_cell_integrals() const { return true; } /// Return whether the form has any exterior facet integrals virtual bool has_exterior_facet_integrals() const { return true; } /// Return whether the form has any interior facet integrals virtual bool has_interior_facet_integrals() const { return false; } /// Return whether the form has any vertex integrals virtual bool has_vertex_integrals() const { return false; } /// Return whether the form has any custom integrals virtual bool has_custom_integrals() const { return false; } /// Create a new cell integral on sub domain subdomain_id virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const { return 0; } /// Create a new exterior facet integral on sub domain subdomain_id virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const { return 0; } /// Create a new interior facet integral on sub domain subdomain_id virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const { return 0; } /// Create a new vertex integral on sub domain subdomain_id virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const { return 0; } /// Create a new custom integral on sub domain subdomain_id virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const { return 0; } /// Create a new cell integral on everywhere else virtual ufc::cell_integral* create_default_cell_integral() const { return new ffc_form_eca19265a2ab59013b3209e1c7e9bf6a8033d711_cell_integral_0_otherwise(); } /// Create a new exterior facet integral on everywhere else virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const { return new ffc_form_eca19265a2ab59013b3209e1c7e9bf6a8033d711_exterior_facet_integral_0_otherwise(); } /// Create a new interior facet integral on everywhere else virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const { return 0; } /// Create a new vertex integral on everywhere else virtual ufc::vertex_integral* create_default_vertex_integral() const { return 0; } /// Create a new custom integral on everywhere else virtual ufc::custom_integral* create_default_custom_integral() const { return 0; } }; #endif
52.607725
3,535
0.588889
[ "mesh", "shape", "vector", "transform" ]
7eb2e7d7251afe03078b9d23c8912c447132f11f
397
h
C
WalEngine/src/util/Util.h
QuincyKing/WalEngine
8f30c4ad200615641777f17c5b0b1dbd15ba6e03
[ "MIT" ]
1
2018-11-09T09:56:52.000Z
2018-11-09T09:56:52.000Z
WalEngine/src/util/Util.h
QuincyKing/WalnutEngine
8f30c4ad200615641777f17c5b0b1dbd15ba6e03
[ "MIT" ]
1
2019-04-13T15:46:33.000Z
2019-04-13T15:46:33.000Z
WalEngine/src/util/Util.h
QuincyKing/WalnutEngine
8f30c4ad200615641777f17c5b0b1dbd15ba6e03
[ "MIT" ]
null
null
null
#pragma once #define INVALID_VALUE 0xFFFFFFFF #define MATH_PI 3.1415926535897932384626433832795 #define TO_RADIANS(x) (float)(((x) * MATH_PI / 180.0f)) #define TO_DEGREES(x) (float)(((x) * 180.0f / MATH_PI)) #include <vector> namespace Util { std::vector<std::string> split(const std::string &s, char delim); std::string trim(const std::string& str, const std::string& whitespace = " \t"); };
28.357143
81
0.710327
[ "vector" ]
7ebd16667e5b23b5386dad83f26153d738c337f1
2,150
h
C
cpp/latmert/include/TuneSet.h
aurelienwaite/ucam-smt
92781cd777bb62c69e6e73fb29edcd80112e76c9
[ "ECL-2.0", "Apache-2.0" ]
9
2015-06-05T16:26:45.000Z
2021-04-09T06:41:19.000Z
cpp/latmert/include/TuneSet.h
aurelienwaite/ucam-smt
92781cd777bb62c69e6e73fb29edcd80112e76c9
[ "ECL-2.0", "Apache-2.0" ]
3
2015-02-18T13:29:05.000Z
2015-12-08T13:30:48.000Z
cpp/latmert/include/TuneSet.h
aurelienwaite/ucam-smt
92781cd777bb62c69e6e73fb29edcd80112e76c9
[ "ECL-2.0", "Apache-2.0" ]
3
2016-03-25T02:34:11.000Z
2019-10-20T15:32:22.000Z
//Copyright (c) 2012, University of Cambridge //All rights reserved. // //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 University of Cambridge 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 HOLDER 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 TUNESET_H_ #define TUNESET_H_ #include <vector> #include <map> #include <fst/fstlib.h> #include "MertCommon.h" using std::vector; using std::map; typedef map<Sid, TupleArcFst*> SidToVecArcFstMap; typedef vector<Sid> SentenceList; class TuneSet { public: TuneSet(); ~TuneSet(); void Initialize (const bool use_cache); TupleArcFst* GetVectorLattice (const Sid s, const bool use_cache) const; SentenceList ids; // List of sentence IDs to process private: std::string m_pattern; vector<TupleArcFst *> cachedLattices; TupleArcFst* LoadLattice (const Sid s) const; }; #endif /* TUNESET_H_ */
51.190476
757
0.781395
[ "vector" ]
7ed63bb0ba38f66c8380c714cf05b376ffe80338
3,597
h
C
include/ppddl/mini-gpt/queue.h
mejrpete/mdp-lib
8e8e0f1fbbacf9a0ff9e42a2934270676633de29
[ "MIT" ]
20
2015-02-25T22:38:29.000Z
2021-10-02T17:56:03.000Z
include/ppddl/mini-gpt/queue.h
mejrpete/mdp-lib
8e8e0f1fbbacf9a0ff9e42a2934270676633de29
[ "MIT" ]
2
2016-02-10T16:45:34.000Z
2018-09-25T03:48:10.000Z
include/ppddl/mini-gpt/queue.h
mejrpete/mdp-lib
8e8e0f1fbbacf9a0ff9e42a2934270676633de29
[ "MIT" ]
4
2016-02-26T22:05:41.000Z
2020-05-22T20:42:22.000Z
#ifndef QUEUE_H #define QUEUE_H #include <queue> #include <set> /******************************************************************************* * * priority queue * ******************************************************************************/ template<typename _type,typename _index> class priorityQueue_t { public: class entry_t { protected: _type content_; entry_t *prev_, *next_; public: entry_t( const _type &element ) : prev_(0), next_(0) { content_ = element; } const _type contents( void ) const { return( content_ ); } friend class priorityQueue_t; }; typedef typename priorityQueue_t<_type,_index>::entry_t entry_reference; typedef const typename priorityQueue_t<_type,_index>::entry_t const_entry_reference; private: size_t size_; size_t table_size_; entry_reference **table_; std::priority_queue<unsigned,std::vector<unsigned>,std::greater<unsigned> > pq_; _index index_; void resize( size_t index ) { size_t nsize = table_size_; for( ; nsize <= index; nsize = nsize << 1 ); table_ = (entry_reference**)realloc( table_, nsize * sizeof(entry_reference*) ); memset( &table_[table_size_], 0, (nsize - table_size_) * sizeof(entry_reference*) ); table_size_ = nsize; } public: priorityQueue_t( size_t table_size = 128 ) { size_ = 0; table_size_ = table_size; table_ = (entry_reference**)calloc( table_size_, sizeof(entry_reference*) ); } ~priorityQueue_t() { while( !empty() ) pop(); free( table_ ); } const_entry_reference* find( const _type &element, unsigned &bucket ) const { bucket = index_( element ); if( bucket >= table_size_ ) return( NULL ); for( const_entry_reference *ptr = table_[bucket]; ptr != NULL; ptr = ptr->next_ ) if( ptr->contents() == element ) return( ptr ); return( NULL ); } void remove( const _type &element ) { unsigned bucket; const_entry_reference *entry = find( element, bucket ); if( entry != NULL ) { if( entry->prev_ == NULL ) table_[bucket] = entry->next_; else entry->prev_->next_ = entry->next_; if( entry->next_ != NULL ) entry->next_->prev_ = entry->prev_; if( table_[bucket] == NULL ) { // remove bucket from pq_ std::set<unsigned> iset; for( ; !pq_.empty(); pq_.pop() ) if( pq_.top() != bucket ) iset.insert( pq_.top() ); std::set<unsigned>::const_iterator it; for( it = iset.begin() ; it != iset.end(); ++it ) pq_.push( *it ); } --size_; delete entry; } } bool empty( void ) const { return( pq_.empty() ); } size_t size( void ) const { return( size_ ); } const _type top( void ) const { return( table_[pq_.top()]->contents() ); } void pop( void ) { remove( top() ); } void push( const _type &element ) { unsigned bucket = index_( element ); entry_reference *entry = new entry_reference( element ); if( bucket >= table_size_ ) resize( bucket ); entry->next_ = table_[bucket]; if( table_[bucket] != NULL ) table_[bucket]->prev_ = entry; else pq_.push( bucket ); table_[bucket] = entry; ++size_; } void print_indices( std::ostream &os ) const { std::set<unsigned> iset; for( size_t i = 0; i < table_size_; ++i ) if( table_[i] != NULL ) iset.insert( i ); for( std::set<unsigned>::const_iterator it = iset.begin(); it != iset.end(); ) { os << *it; if( ++it != iset.end() ) os << " "; } } }; #endif // QUEUE_H
26.065217
90
0.573255
[ "vector" ]
7ed711179132397b6a73da05471ec1d5bae86e7a
4,675
h
C
include/third_party/blink/renderer/core/inspector/dev_tools_emulator.h
Cozdemir/spitfire
0d1713f5f7bd7d5803895a1cc48a97bf27bef9e1
[ "Apache-2.0" ]
null
null
null
include/third_party/blink/renderer/core/inspector/dev_tools_emulator.h
Cozdemir/spitfire
0d1713f5f7bd7d5803895a1cc48a97bf27bef9e1
[ "Apache-2.0" ]
null
null
null
include/third_party/blink/renderer/core/inspector/dev_tools_emulator.h
Cozdemir/spitfire
0d1713f5f7bd7d5803895a1cc48a97bf27bef9e1
[ "Apache-2.0" ]
null
null
null
// Copyright 2015 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. #ifndef THIRD_PARTY_BLINK_RENDERER_CORE_INSPECTOR_DEV_TOOLS_EMULATOR_H_ #define THIRD_PARTY_BLINK_RENDERER_CORE_INSPECTOR_DEV_TOOLS_EMULATOR_H_ #include <memory> #include "base/optional.h" #include "third_party/blink/public/platform/pointer_properties.h" #include "third_party/blink/public/platform/web_float_point.h" #include "third_party/blink/public/platform/web_viewport_style.h" #include "third_party/blink/public/web/web_device_emulation_params.h" #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/platform/heap/handle.h" #include "third_party/blink/renderer/platform/wtf/forward.h" namespace blink { class IntRect; class TransformationMatrix; class WebViewImpl; class CORE_EXPORT DevToolsEmulator final : public GarbageCollectedFinalized<DevToolsEmulator> { public: explicit DevToolsEmulator(WebViewImpl*); ~DevToolsEmulator(); void Trace(blink::Visitor*); // Settings overrides. void SetTextAutosizingEnabled(bool); void SetDeviceScaleAdjustment(float); void SetPreferCompositingToLCDTextEnabled(bool); void SetViewportStyle(WebViewportStyle); void SetPluginsEnabled(bool); void SetScriptEnabled(bool); void SetHideScrollbars(bool); void SetCookieEnabled(bool); void SetDoubleTapToZoomEnabled(bool); bool DoubleTapToZoomEnabled() const; void SetAvailablePointerTypes(int); void SetPrimaryPointerType(PointerType); void SetAvailableHoverTypes(int); void SetPrimaryHoverType(HoverType); void SetMainFrameResizesAreOrientationChanges(bool); // Emulation. void EnableDeviceEmulation(const WebDeviceEmulationParams&); void DisableDeviceEmulation(); // Position is given in CSS pixels, scale relative to a page scale of 1.0. void ForceViewport(const WebFloatPoint& position, float scale); void ResetViewport(); bool ResizeIsDeviceSizeChange(); void SetTouchEventEmulationEnabled(bool, int max_touch_points); void SetScriptExecutionDisabled(bool); void SetScrollbarsHidden(bool); void SetDocumentCookieDisabled(bool); // Notify the DevToolsEmulator about a scroll or scale change of the main // frame. Updates the transform for a viewport override. void MainFrameScrollOrScaleChanged(); // Rewrites the |visible_rect| to the area of the devtools custom viewport if // it is enabled. Otherwise, leaves |visible_rect| unchanged. Takes as input // the size of the viewport, which gives an upper bound on the size of the // area that is visible. The |viewport_size| is physical pixels if // UseZoomForDSF() is enabled, or DIP otherwise. void OverrideVisibleRect(const IntSize& viewport_size, IntRect* visible_rect) const; // Returns the scale used to convert incoming input events while emulating // device metics. float InputEventsScaleForEmulation(); private: void EnableMobileEmulation(); void DisableMobileEmulation(); // Returns the original device scale factor when overridden by DevTools, or // deviceScaleFactor() otherwise. float CompositorDeviceScaleFactor() const; void ApplyViewportOverride(TransformationMatrix*); void UpdateRootLayerTransform(); WebViewImpl* web_view_; bool device_metrics_enabled_; bool emulate_mobile_enabled_; WebDeviceEmulationParams emulation_params_; struct ViewportOverride { FloatPoint position; double scale; bool original_visual_viewport_masking; }; base::Optional<ViewportOverride> viewport_override_; bool is_overlay_scrollbars_enabled_; bool is_orientation_event_enabled_; bool is_mobile_layout_theme_enabled_; float original_default_minimum_page_scale_factor_; float original_default_maximum_page_scale_factor_; bool use_solid_color_scrollbar_; bool embedder_text_autosizing_enabled_; float embedder_device_scale_adjustment_; bool embedder_prefer_compositing_to_lcd_text_enabled_; WebViewportStyle embedder_viewport_style_; bool embedder_plugins_enabled_; int embedder_available_pointer_types_; PointerType embedder_primary_pointer_type_; int embedder_available_hover_types_; HoverType embedder_primary_hover_type_; bool embedder_main_frame_resizes_are_orientation_changes_; bool touch_event_emulation_enabled_; bool double_tap_to_zoom_enabled_; int original_max_touch_points_; bool embedder_script_enabled_; bool script_execution_disabled_; bool embedder_hide_scrollbars_; bool scrollbars_hidden_; bool embedder_cookie_enabled_; bool document_cookie_disabled_; }; } // namespace blink #endif
34.88806
79
0.807701
[ "transform" ]
7edbeca5b6464dee4b2692ecc0996fb0914750ae
405
h
C
simplefvm/src/MeshLoader/MeshContainer/CellsSizeDefiner.h
artvns/SimpleFvm
5a8eca332d6780e738c0bc6c8c2b787b47b5b20d
[ "MIT" ]
4
2022-01-03T08:45:55.000Z
2022-01-06T19:57:11.000Z
simplefvm/src/MeshLoader/MeshContainer/CellsSizeDefiner.h
artvns/SimpleFvm
5a8eca332d6780e738c0bc6c8c2b787b47b5b20d
[ "MIT" ]
null
null
null
simplefvm/src/MeshLoader/MeshContainer/CellsSizeDefiner.h
artvns/SimpleFvm
5a8eca332d6780e738c0bc6c8c2b787b47b5b20d
[ "MIT" ]
null
null
null
#ifndef SIMPLEFVM_MESHLOADER_MESHCONTAINER_CELLSSIZEDEFINER_H #define SIMPLEFVM_MESHLOADER_MESHCONTAINER_CELLSSIZEDEFINER_H #include <cstddef> #include "Mesh.h" namespace meshloader { class CellsSizeDefiner { public: CellsSizeDefiner(); void setCellsSize(Mesh& meshContainer, const double dx, const double dy); private: }; } #endif // SIMPLEFVM_MESHLOADER_MESHCONTAINER_CELLSSIZEDEFINER_H
18.409091
77
0.814815
[ "mesh" ]
7edcd02cca9733c9d9c619d8c268217a1e09280d
2,308
h
C
include/GestLaser.h
GuillaumeSmaha/rv-simulation-interactive-battle-space
8639dbcabbac411de9d39783c9137dc04acf3e5d
[ "BSD-2-Clause" ]
2
2015-03-13T14:11:25.000Z
2015-03-13T14:15:56.000Z
include/GestLaser.h
GuillaumeSmaha/rv-simulation-interactive-battle-space
8639dbcabbac411de9d39783c9137dc04acf3e5d
[ "BSD-2-Clause" ]
null
null
null
include/GestLaser.h
GuillaumeSmaha/rv-simulation-interactive-battle-space
8639dbcabbac411de9d39783c9137dc04acf3e5d
[ "BSD-2-Clause" ]
null
null
null
/*! * \file GestLaser.h * \brief Ce fichier contient la déclaration de la classe GestLaser. C'est la classe qui gère les lasers */ #ifndef __GEST_LASER_H__ #define __GEST_LASER_H__ #include <Ogre.h> #include "config.h" #include "ClassRoot.h" #include "Utils.h" #include "Laser.h" class Laser; /*! * \class GestLaser * \brief Classe gérant les lasers */ class GestLaser : public ClassRoot { public: /*! * \brief Vitesse du laser */ static Ogre::Real speedLaserBase; /*! * \brief Temps de vie du laser en milliseconde */ static Ogre::Real timeLife; private: /*! * \brief Gestionnaire de son */ std::vector<Laser *> listLasers; public: /*! * \brief Destructeur */ ~GestLaser(); /*! * \brief Ajoute un laser * \param position Position initiale du laser * \param orientation Orientation du laser * \param color La couleur du laser émis * \return Le laser crée */ Laser * create(const Ogre::Vector3 &position, const Ogre::Quaternion &orientation, const Ogre::ColourValue &color); /*! * \brief Ajoute un laser au gestionnaire * \param laser Pointeur sur le laser */ void add(Laser * laser); /*! * \brief Supprime un laser du gestionnaire * \param laser Pointeur sur le laser */ void remove(Laser * laser); /*! * \brief Récupère la liste des vaisseaux * \return Liste des vaisseaux */ std::vector<Laser *> getAll() { return listLasers; } /*! * \brief Met à jour la position de tous les lasers */ void updateLasers() { updateLasers(NULL); } /*! * \brief Met à jour la position de tous les lasers */ void updateLasers(void *); /*! * \brief Supprime tous les lasers du gestionnaire */ void deleteAll(); /*! * \brief Retourne une instance du singleton */ static GestLaser * getSingleton(void); /*! * \brief Detruit le singleton */ static void destroy(); private: /*! * \brief Instance de GestLaser pour le singleton */ static GestLaser * _instance ; /*! * \brief Construction */ GestLaser(); }; #endif // __GEST_LASER_H__
20.607143
131
0.590121
[ "vector" ]
7ef62e16b3ad471bab630c9299456337f91c6f7f
3,372
h
C
src/app/prototypes/polyline/shaders.h
Adnn/Graphics
335d54bdbb5d8d6042c9adfb9e47ccb14f612cf8
[ "MIT" ]
null
null
null
src/app/prototypes/polyline/shaders.h
Adnn/Graphics
335d54bdbb5d8d6042c9adfb9e47ccb14f612cf8
[ "MIT" ]
27
2021-08-03T11:34:41.000Z
2022-03-04T13:35:29.000Z
src/app/prototypes/polyline/shaders.h
ShredEagle/graphics
6dcc18e4fe21ecd833799bf7338305bbc3600041
[ "MIT" ]
1
2021-03-18T10:56:05.000Z
2021-03-18T10:56:05.000Z
#pragma once #include <glad/glad.h> namespace ad { namespace graphics { const GLchar* gVertexShader = R"#( #version 400 layout(location=0) in vec2 in_Position; void main(void) { gl_Position = vec4(in_Position, 0.0, 1.0); } )#"; // Note: No handling of joints, basically creating a concave "dent" on the convex side of the joint. const GLchar* gNaiveGeometryShader = R"#( #version 400 #extension GL_EXT_geometry_shader4 : enable layout(lines) in; layout(triangle_strip, max_vertices = 4) out; uniform float lineHalfWidth; uniform mat4 model; uniform mat4 projection; void main() { mat4 transformation = projection * model; vec4 normal = vec4(normalize(vec2(gl_PositionIn[0].y - gl_PositionIn[1].y, gl_PositionIn[1].x - gl_PositionIn[0].x)), 0., 0.); gl_Position = transformation * (gl_PositionIn[0] + normal * lineHalfWidth); EmitVertex(); gl_Position = transformation * (gl_PositionIn[0] - normal * lineHalfWidth); EmitVertex(); gl_Position = transformation * (gl_PositionIn[1] + normal * lineHalfWidth); EmitVertex(); gl_Position = transformation * (gl_PositionIn[1] - normal * lineHalfWidth); EmitVertex(); } )#"; // Note: A major drawback with this approach is that it computes twice // each miter (once as the right miter, then on next invocation as the left miter). const GLchar* gMiterGeometryShader = R"#( #version 400 #extension GL_EXT_geometry_shader4 : enable layout(lines_adjacency) in; layout(triangle_strip, max_vertices = 4) out; uniform float lineHalfWidth; uniform mat4 model; uniform mat4 projection; void main() { mat4 transformation = projection * model; vec4 left = gl_PositionIn[1] - gl_PositionIn[0]; vec4 mid = gl_PositionIn[2] - gl_PositionIn[1]; vec4 right = gl_PositionIn[3] - gl_PositionIn[2]; vec4 leftTangent = normalize(normalize(left) + normalize(mid)); vec4 rightTangent = normalize(normalize(mid) + normalize(right)); vec4 leftMiter = vec4(-leftTangent.y, leftTangent.x, 0., 0.); vec4 rightMiter = vec4(-rightTangent.y, rightTangent.x, 0., 0.); vec4 normal = vec4(normalize(vec2(gl_PositionIn[1].y - gl_PositionIn[2].y, gl_PositionIn[2].x - gl_PositionIn[1].x)), 0., 0.); float leftLength = lineHalfWidth / dot(normal, leftMiter); float rightLength = lineHalfWidth / dot(normal, rightMiter); gl_Position = transformation * (gl_PositionIn[1] + leftMiter * leftLength); EmitVertex(); gl_Position = transformation * (gl_PositionIn[1] - leftMiter * leftLength); EmitVertex(); gl_Position = transformation * (gl_PositionIn[2] + rightMiter * rightLength); EmitVertex(); gl_Position = transformation * (gl_PositionIn[2] - rightMiter * rightLength); EmitVertex(); } )#"; const GLchar* gFragmentShader = R"#( #version 400 out vec4 out_Color; void main(void) { out_Color = vec4(1.0, 1.0, 0.0, 1.0); } )#"; } // namespace graphics } // namespace ad
27.867769
100
0.61121
[ "model" ]
7ef924ee4aa9d96dff4e231c7adebb6a882ae25d
2,537
h
C
shim_and_sl/include/ShimUtils.h
iKeramat/platform_packages_modules_NeuralNetworks
7a1e1bb8ab2aa7f1336243604bac2b9d8840e469
[ "Apache-2.0" ]
null
null
null
shim_and_sl/include/ShimUtils.h
iKeramat/platform_packages_modules_NeuralNetworks
7a1e1bb8ab2aa7f1336243604bac2b9d8840e469
[ "Apache-2.0" ]
null
null
null
shim_and_sl/include/ShimUtils.h
iKeramat/platform_packages_modules_NeuralNetworks
7a1e1bb8ab2aa7f1336243604bac2b9d8840e469
[ "Apache-2.0" ]
2
2021-11-28T11:20:31.000Z
2021-11-28T11:28:38.000Z
/* * Copyright (C) 2021 The Android Open Source Project * * 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 <aidl/android/hardware/neuralnetworks/ErrorStatus.h> #include <android/binder_auto_utils.h> #include <string> #include <vector> #include "SupportLibraryWrapper.h" namespace aidl::android::hardware::neuralnetworks { ErrorStatus convertResultToErrorStatus(::android::nn::wrapper::Result status); bool isValidDimension(const std::vector<int32_t>& v); ndk::ScopedAStatus toAStatus(ErrorStatus errorStatus, const std::string& errorMessage); ndk::ScopedAStatus toAStatus(ErrorStatus errorStatus); #define SLW2SAS_RETURN_IF_ERROR(expr) \ do { \ const Result nnReturnIfErrorErrorCode = static_cast<Result>(expr); \ if (nnReturnIfErrorErrorCode != Result::NO_ERROR) { \ const auto nnReturnIfErrorErrorCodeConverted = \ convertResultToErrorStatus(nnReturnIfErrorErrorCode); \ return toAStatus(nnReturnIfErrorErrorCodeConverted); \ } \ } while (0) #define SLW2SAS_RETURN_AND_CALLBACK_IF_ERROR(expr, callback) \ do { \ const Result nnReturnIfErrorErrorCode = static_cast<Result>(expr); \ if (nnReturnIfErrorErrorCode != Result::NO_ERROR) { \ const auto nnReturnIfErrorErrorCodeConverted = \ convertResultToErrorStatus(nnReturnIfErrorErrorCode); \ callback->notify(nnReturnIfErrorErrorCodeConverted, nullptr); \ return toAStatus(nnReturnIfErrorErrorCodeConverted); \ } \ } while (0) } // namespace aidl::android::hardware::neuralnetworks
46.981481
87
0.609381
[ "vector" ]
7d03f0288837f1f477be588912430523ff1442e0
6,995
h
C
clicks/fram/lib/include/fram.h
StrahinjaJacimovic/mikrosdk_click_v2
f8002047c96605f340957a0d3fdbde33706d02ac
[ "MIT" ]
31
2020-10-02T14:15:14.000Z
2022-03-24T08:33:21.000Z
clicks/fram/lib/include/fram.h
greghol/mikrosdk_click_v2
76e5dec265dce5fca72c4b93f77afd668dde5dfa
[ "MIT" ]
4
2020-10-27T14:05:00.000Z
2022-03-10T09:38:57.000Z
clicks/fram/lib/include/fram.h
greghol/mikrosdk_click_v2
76e5dec265dce5fca72c4b93f77afd668dde5dfa
[ "MIT" ]
32
2020-11-28T07:56:42.000Z
2022-03-14T19:42:29.000Z
/* * MikroSDK - MikroE Software Development Kit * Copyright© 2020 MikroElektronika d.o.o. * * 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. */ /*! * \file * * \brief This file contains API for Fram Click driver. * * \addtogroup fram Fram Click Driver * @{ */ // ---------------------------------------------------------------------------- #ifndef FRAM_H #define FRAM_H #include "drv_digital_out.h" #include "drv_digital_in.h" #include "drv_spi_master.h" // -------------------------------------------------------------- PUBLIC MACROS /** * \defgroup macros Macros * \{ */ /** * \defgroup map_mikrobus MikroBUS * \{ */ #define FRAM_MAP_MIKROBUS( cfg, mikrobus ) \ cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \ cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \ cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \ cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \ cfg.hld = MIKROBUS( mikrobus, MIKROBUS_RST ); \ cfg.wp = MIKROBUS( mikrobus, MIKROBUS_PWM ) /** \} */ /** * \defgroup error_code Error Code * \{ */ #define FRAM_RETVAL uint8_t #define FRAM_OK 0x00 #define FRAM_INIT_ERROR 0xFF /** \} */ /** * \defgroup op_codes OP-CODEs * \{ */ #define FRAM_WREN 0x06 #define FRAM_WRDI 0x04 #define FRAM_RDSR 0x05 #define FRAM_WRSR 0x01 #define FRAM_READ 0x03 #define FRAM_WRITE 0x02 /** \} */ /** * \defgroup status_register_bits Status Register Bits * \{ */ #define FRAM_WPEN 0x80 #define FRAM_BP1 0x08 #define FRAM_BP0 0x04 #define FRAM_WEL 0x02 #define FRAM_MEM_SIZE 0x8000 /** \} */ /** \} */ // End group macro // --------------------------------------------------------------- PUBLIC TYPES /** * \defgroup type Types * \{ */ /** * @brief Click ctx object definition. */ typedef struct { // Output pins digital_out_t cs; digital_out_t hld; digital_out_t wp; // Modules spi_master_t spi; pin_name_t chip_select; } fram_t; /** * @brief Click configuration structure definition. */ typedef struct { // Communication gpio pins pin_name_t miso; pin_name_t mosi; pin_name_t sck; pin_name_t cs; // Additional gpio pins pin_name_t hld; pin_name_t wp; // static variable uint32_t spi_speed; spi_master_mode_t spi_mode; spi_master_chip_select_polarity_t cs_polarity; } fram_cfg_t; /** \} */ // End types group // ----------------------------------------------- PUBLIC FUNCTION DECLARATIONS /** * \defgroup public_function Public function * \{ */ #ifdef __cplusplus extern "C"{ #endif /** * @brief Config Object Initialization function. * * @param cfg Click configuration structure. * * @description This function initializes click configuration structure to init state. * @note All used pins will be set to unconnected state. */ void fram_cfg_setup ( fram_cfg_t *cfg ); /** * @brief Initialization function. * * @param ctx Click object. * @param cfg Click configuration structure. * * @description This function initializes all necessary pins and peripherals used for this click. */ FRAM_RETVAL fram_init ( fram_t *ctx, fram_cfg_t *cfg ); /** * @brief Generic transfer function. * * @param ctx Click object. * @param wr_buf Write data buffer * @param wr_len Number of byte in write data buffer * @param rd_buf Read data buffer * @param rd_len Number of byte in read data buffer * * @description Generic SPI transfer, for sending and receiving packages */ void fram_generic_transfer ( fram_t *ctx, uint8_t *wr_buf, uint16_t wr_len, uint8_t *rd_buf, uint16_t rd_len ); /** * @brief Fram click init function. * * @param ctx Click object. * * @description This function that initializes Fram click by setting Chip select. */ void fram_init_f ( fram_t *ctx ); /** * @brief Fram click Write Enable function. * * @param ctx Click object. * * @description This function that sends write enable command to the chip. */ void fram_write_enable ( fram_t *ctx ); /** * @brief Fram click Write Disable function. * * @param ctx Click object. * * @description This function that sends write disable command to the chip. */ void fram_write_disable ( fram_t *ctx ); /** * @brief Fram click Read Status function. * * @param ctx Click object. * * @description This function returns content of FRAM status register. */ uint8_t fram_read_status ( fram_t *ctx ) ; /** * @brief Fram click Write Status function. * * @param ctx Click object. * * @description This function writes in FRAM status register. */ void fram_write_status ( fram_t *ctx, uint8_t value ); /** * @brief Fram read function. * * @param ctx Click object. * @param address Desired starting address (0x0000 to FRAM_MEM_SIZE). * @param buffer Pointer to read buffer. * @param count Number of bytes to be read. * * @description This function reads sequential memory locations to buffer. */ void fram_read ( fram_t *ctx, uint16_t address, uint8_t *buffer, uint16_t count ); /** * @brief Fram write function. * * @param ctx Click object. * @param address Desired starting address (0x0000 to FRAM_MEM_SIZE). * @param buffer Pointer to read buffer. * @param count Number of bytes to be read. * * @description This function writes to sequential memory locations from buffer. */ void fram_write ( fram_t *ctx, uint16_t address, uint8_t *buffer, uint16_t count ); /** * @brief Fram erase all function. * * @param ctx Click object. * * @description This function flushes whole data memory and resets status reg. */ void fram_erase_all ( fram_t *ctx ); #ifdef __cplusplus } #endif #endif // _FRAM_H_ /** \} */ // End public_function group /// \} // End click Driver group /*! @} */ // ------------------------------------------------------------------------- END
25.161871
111
0.648606
[ "object" ]
7d04a2e358c270357f43122f95f88fa754e46998
1,442
h
C
src/integrators/normalbaker.h
zq317157782/raiden
09376a9499f8b86e86c3049b4e654957cb4dc29e
[ "BSD-2-Clause" ]
21
2016-12-14T09:46:27.000Z
2021-12-28T10:05:04.000Z
src/integrators/normalbaker.h
zq317157782/raiden
09376a9499f8b86e86c3049b4e654957cb4dc29e
[ "BSD-2-Clause" ]
2
2016-12-02T07:47:14.000Z
2018-01-30T18:11:09.000Z
src/integrators/normalbaker.h
zq317157782/raiden
09376a9499f8b86e86c3049b4e654957cb4dc29e
[ "BSD-2-Clause" ]
null
null
null
/* * normal.h * * Created on: 2018年12月25日 * Author: zhuqian */ #ifndef SRC_INTEGRATORS_NORMALBAKER_H_ #define SRC_INTEGRATORS_NORMALBAKER_H_ #include "raiden.h" #include "integrator.h" #include "spectrum.h" #include "interaction.h" #include "scene.h" #include "camera.h" enum class NormalSpace{ WORLD,OBJECT }; class NormalBakerIntegrator:public SamplerIntegrator{ private: NormalSpace _space; inline Normal3f MapTo01(const Normal3f& n) const{ return (n+Normal3f(1.0f,1.0f,1.0f))*0.5f; } public: NormalBakerIntegrator(const std::shared_ptr<const Camera>& camera,const std::shared_ptr<Sampler>& sampler,const Bound2i&pixelBound,NormalSpace space=NormalSpace::OBJECT): SamplerIntegrator(camera,sampler,pixelBound),_space(space){} virtual Spectrum Li(const RayDifferential &ray, const Scene &scene, Sampler &sampler, MemoryArena &arena, int depth = 0) const override{ SurfaceInteraction ref;//和表面的交互点 RGBSpectrum ret(0.0f); Normal3f nn=Normalize((Normal3f)ray.d); if(_space==NormalSpace::OBJECT){ nn=_camera->worldToCamera(nn); } //映射到[0~1]范围 nn=MapTo01(nn); ret[0]=nn.x; ret[1]=nn.y; ret[2]=nn.z; return ret; } }; NormalBakerIntegrator *CreateNormalBakerIntegrator( const ParamSet &params, std::shared_ptr<Sampler> sampler, std::shared_ptr<const Camera> camera); #endif /* SRC_INTEGRATORS_NORMAL_H_ */
25.298246
171
0.70111
[ "object" ]
7d0a87630263741d2edd06cef0c17bfa61bd9cce
750
c
C
src/a_dir/a.c
neocliff/my-make-things
98aee39c2479f8fba08196e225a2f46ce141e97f
[ "BSD-2-Clause" ]
null
null
null
src/a_dir/a.c
neocliff/my-make-things
98aee39c2479f8fba08196e225a2f46ce141e97f
[ "BSD-2-Clause" ]
4
2020-01-03T16:17:36.000Z
2020-01-05T21:12:01.000Z
src/a_dir/a.c
neocliff/my-make-things
98aee39c2479f8fba08196e225a2f46ce141e97f
[ "BSD-2-Clause" ]
null
null
null
/** * @file a.c * @brief object file linked directly to hello program * @author Cliff Williams * * This is an object file that is directly linked into the * hello program in src/hello. It proves we can link object files * from sibling directories. * * @bug no known bugs */ #include <stdlib.h> #include <stdio.h> #include "a.h" #include "a2.h" int a(); /** * a() - function to return a constant * * This is a "public" function called from @c main(). * * @return 0 - meaning success * * @note This could have had a @c void return type. I was just feeling * lazy. */ int a() { printf("you called a()\n"); printf("calling a2()\n"); int a2_return = a2(); printf("returned: %d\n", a2_return); return(0); }
19.736842
70
0.626667
[ "object" ]
7d15d3939924f719ea5bb19b63eca92435230bd8
13,641
c
C
net/ndis/uio/sys/send.c
npocmaka/Windows-Server-2003
5c6fe3db626b63a384230a1aa6b92ac416b0765f
[ "Unlicense" ]
17
2020-11-13T13:42:52.000Z
2021-09-16T09:13:13.000Z
net/ndis/uio/sys/send.c
sancho1952007/Windows-Server-2003
5c6fe3db626b63a384230a1aa6b92ac416b0765f
[ "Unlicense" ]
2
2020-10-19T08:02:06.000Z
2020-10-19T08:23:18.000Z
net/ndis/uio/sys/send.c
sancho1952007/Windows-Server-2003
5c6fe3db626b63a384230a1aa6b92ac416b0765f
[ "Unlicense" ]
14
2020-11-14T09:43:20.000Z
2021-08-28T08:59:57.000Z
/*++ Copyright (c) 2000 Microsoft Corporation Module Name: send.c Abstract: NDIS protocol entry points and utility routines to handle sending data. Environment: Kernel mode only. Revision History: arvindm 4/10/2000 Created --*/ #include "precomp.h" #define __FILENUMBER 'DNES' NTSTATUS NdisuioWrite( IN PDEVICE_OBJECT pDeviceObject, IN PIRP pIrp ) /*++ Routine Description: Dispatch routine to handle IRP_MJ_WRITE. Arguments: pDeviceObject - pointer to our device object pIrp - Pointer to request packet Return Value: NT status code. --*/ { PIO_STACK_LOCATION pIrpSp; ULONG DataLength; NTSTATUS NtStatus; NDIS_STATUS Status; PNDISUIO_OPEN_CONTEXT pOpenContext; PNDIS_PACKET pNdisPacket; PNDIS_BUFFER pNdisBuffer; NDISUIO_ETH_HEADER UNALIGNED *pEthHeader; #ifdef NDIS51 PVOID CancelId; #endif UNREFERENCED_PARAMETER(pDeviceObject); pIrpSp = IoGetCurrentIrpStackLocation(pIrp); pOpenContext = pIrpSp->FileObject->FsContext; pNdisPacket = NULL; do { if (pOpenContext == NULL) { DEBUGP(DL_WARN, ("Write: FileObject %p not yet associated with a device\n", pIrpSp->FileObject)); NtStatus = STATUS_INVALID_HANDLE; break; } NUIO_STRUCT_ASSERT(pOpenContext, oc); if (pIrp->MdlAddress == NULL) { DEBUGP(DL_FATAL, ("Write: NULL MDL address on IRP %p\n", pIrp)); NtStatus = STATUS_INVALID_PARAMETER; break; } // // Try to get a virtual address for the MDL. // #ifndef WIN9X pEthHeader = MmGetSystemAddressForMdlSafe(pIrp->MdlAddress, NormalPagePriority); if (pEthHeader == NULL) { DEBUGP(DL_FATAL, ("Write: MmGetSystemAddr failed for" " IRP %p, MDL %p\n", pIrp, pIrp->MdlAddress)); NtStatus = STATUS_INSUFFICIENT_RESOURCES; break; } #else pEthHeader = MmGetSystemAddressForMdl(pIrp->MdlAddress); // for Win9X #endif // // Sanity-check the length. // DataLength = MmGetMdlByteCount(pIrp->MdlAddress); if (DataLength < sizeof(NDISUIO_ETH_HEADER)) { DEBUGP(DL_WARN, ("Write: too small to be a valid packet (%d bytes)\n", DataLength)); NtStatus = STATUS_BUFFER_TOO_SMALL; break; } if (DataLength > (pOpenContext->MaxFrameSize + sizeof(NDISUIO_ETH_HEADER))) { DEBUGP(DL_WARN, ("Write: Open %p: data length (%d)" " larger than max frame size (%d)\n", pOpenContext, DataLength, pOpenContext->MaxFrameSize)); NtStatus = STATUS_INVALID_BUFFER_SIZE; break; } if (pEthHeader->EthType != Globals.EthType) { DEBUGP(DL_WARN, ("Write: Failing send with EthType %x\n", pEthHeader->EthType)); NtStatus = STATUS_INVALID_PARAMETER; break; } if (!NUIO_MEM_CMP(pEthHeader->SrcAddr, pOpenContext->CurrentAddress, NUIO_MAC_ADDR_LEN)) { DEBUGP(DL_WARN, ("Write: Failing with invalid Source address")); NtStatus = STATUS_INVALID_PARAMETER; break; } NUIO_ACQUIRE_LOCK(&pOpenContext->Lock); if (!NUIO_TEST_FLAGS(pOpenContext->Flags, NUIOO_BIND_FLAGS, NUIOO_BIND_ACTIVE)) { NUIO_RELEASE_LOCK(&pOpenContext->Lock); DEBUGP(DL_FATAL, ("Write: Open %p is not bound" " or in low power state\n", pOpenContext)); NtStatus = STATUS_INVALID_HANDLE; break; } // // Allocate a send packet. // NUIO_ASSERT(pOpenContext->SendPacketPool != NULL); NdisAllocatePacket( &Status, &pNdisPacket, pOpenContext->SendPacketPool); if (Status != NDIS_STATUS_SUCCESS) { NUIO_RELEASE_LOCK(&pOpenContext->Lock); DEBUGP(DL_FATAL, ("Write: open %p, failed to alloc send pkt\n", pOpenContext)); NtStatus = STATUS_INSUFFICIENT_RESOURCES; break; } // // Allocate a send buffer if necessary. // if (pOpenContext->bRunningOnWin9x) { NdisAllocateBuffer( &Status, &pNdisBuffer, pOpenContext->SendBufferPool, pEthHeader, DataLength); if (Status != NDIS_STATUS_SUCCESS) { NUIO_RELEASE_LOCK(&pOpenContext->Lock); NdisFreePacket(pNdisPacket); DEBUGP(DL_FATAL, ("Write: open %p, failed to alloc send buf\n", pOpenContext)); NtStatus = STATUS_INSUFFICIENT_RESOURCES; break; } } else { pNdisBuffer = pIrp->MdlAddress; } NdisInterlockedIncrement((PLONG)&pOpenContext->PendedSendCount); NUIO_REF_OPEN(pOpenContext); // pended send IoMarkIrpPending(pIrp); // // Initialize the packet ref count. This packet will be freed // when this count goes to zero. // NUIO_SEND_PKT_RSVD(pNdisPacket)->RefCount = 1; #ifdef NDIS51 // // NDIS 5.1 supports cancelling sends. We set up a cancel ID on // each send packet (which maps to a Write IRP), and save the // packet pointer in the IRP. If the IRP gets cancelled, we use // NdisCancelSendPackets() to cancel the packet. // CancelId = NUIO_GET_NEXT_CANCEL_ID(); NDIS_SET_PACKET_CANCEL_ID(pNdisPacket, CancelId); pIrp->Tail.Overlay.DriverContext[0] = (PVOID)pOpenContext; pIrp->Tail.Overlay.DriverContext[1] = (PVOID)pNdisPacket; NUIO_INSERT_TAIL_LIST(&pOpenContext->PendedWrites, &pIrp->Tail.Overlay.ListEntry); IoSetCancelRoutine(pIrp, NdisuioCancelWrite); #endif // NDIS51 NUIO_RELEASE_LOCK(&pOpenContext->Lock); // // Set a back pointer from the packet to the IRP. // NUIO_IRP_FROM_SEND_PKT(pNdisPacket) = pIrp; NtStatus = STATUS_PENDING; pNdisBuffer->Next = NULL; NdisChainBufferAtFront(pNdisPacket, pNdisBuffer); #if SEND_DBG { PUCHAR pData; #ifndef WIN9X pData = MmGetSystemAddressForMdlSafe(pNdisBuffer, NormalPagePriority); NUIO_ASSERT(pEthHeader == pData); #else pData = MmGetSystemAddressForMdl(pNdisBuffer); // Win9x #endif DEBUGP(DL_VERY_LOUD, ("Write: MDL %p, MdlFlags %x, SystemAddr %p, %d bytes\n", pIrp->MdlAddress, pIrp->MdlAddress->MdlFlags, pData, DataLength)); DEBUGPDUMP(DL_VERY_LOUD, pData, MIN(DataLength, 48)); } #endif // SEND_DBG NdisSendPackets(pOpenContext->BindingHandle, &pNdisPacket, 1); } while (FALSE); if (NtStatus != STATUS_PENDING) { pIrp->IoStatus.Status = NtStatus; IoCompleteRequest(pIrp, IO_NO_INCREMENT); } return (NtStatus); } #ifdef NDIS51 VOID NdisuioCancelWrite( IN PDEVICE_OBJECT pDeviceObject, IN PIRP pIrp ) /*++ Routine Description: Cancel a pending write IRP. This routine attempt to cancel the NDIS send. Arguments: pDeviceObject - pointer to our device object pIrp - IRP to be cancelled Return Value: None --*/ { PNDISUIO_OPEN_CONTEXT pOpenContext; PLIST_ENTRY pIrpEntry; PNDIS_PACKET pNdisPacket; UNREFERENCED_PARAMETER(pDeviceObject); IoReleaseCancelSpinLock(pIrp->CancelIrql); // // The NDIS packet representing this Write IRP. // pNdisPacket = NULL; pOpenContext = (PNDISUIO_OPEN_CONTEXT) pIrp->Tail.Overlay.DriverContext[0]; NUIO_STRUCT_ASSERT(pOpenContext, oc); // // Try to locate the IRP in the pended write queue. The send completion // routine may be running and might have removed it from there. // NUIO_ACQUIRE_LOCK(&pOpenContext->Lock); for (pIrpEntry = pOpenContext->PendedWrites.Flink; pIrpEntry != &pOpenContext->PendedWrites; pIrpEntry = pIrpEntry->Flink) { if (pIrp == CONTAINING_RECORD(pIrpEntry, IRP, Tail.Overlay.ListEntry)) { pNdisPacket = (PNDIS_PACKET) pIrp->Tail.Overlay.DriverContext[1]; // // Place a reference on this packet so that it won't get // freed/reused until we are done with it. // NUIO_REF_SEND_PKT(pNdisPacket); break; } } NUIO_RELEASE_LOCK(&pOpenContext->Lock); if (pNdisPacket != NULL) { // // Either the send completion routine hasn't run, or we got a peak // at the IRP/packet before it had a chance to take it out of the // pending IRP queue. // // We do not complete the IRP here - note that we didn't dequeue it // above. This is because we always want the send complete routine to // complete the IRP. And this in turn is because the packet that was // prepared from the IRP has a buffer chain pointing to data associated // with this IRP. Therefore we cannot complete the IRP before the driver // below us is done with the data it pointed to. // // // Request NDIS to cancel this send. The result of this call is that // our SendComplete handler will be called (if not already called). // DEBUGP(DL_INFO, ("CancelWrite: cancelling pkt %p on Open %p\n", pNdisPacket, pOpenContext)); NdisCancelSendPackets( pOpenContext->BindingHandle, NDIS_GET_PACKET_CANCEL_ID(pNdisPacket) ); // // It is now safe to remove the reference we had placed on the packet. // NUIO_DEREF_SEND_PKT(pNdisPacket); } // // else the send completion routine has already picked up this IRP. // } #endif // NDIS51 VOID NdisuioSendComplete( IN NDIS_HANDLE ProtocolBindingContext, IN PNDIS_PACKET pNdisPacket, IN NDIS_STATUS Status ) /*++ Routine Description: NDIS entry point called to signify completion of a packet send. We pick up and complete the Write IRP corresponding to this packet. NDIS 5.1: Arguments: ProtocolBindingContext - pointer to open context pNdisPacket - packet that completed send Status - status of send Return Value: None --*/ { PIRP pIrp; PIO_STACK_LOCATION pIrpSp; PNDISUIO_OPEN_CONTEXT pOpenContext; pOpenContext = (PNDISUIO_OPEN_CONTEXT)ProtocolBindingContext; NUIO_STRUCT_ASSERT(pOpenContext, oc); pIrp = NUIO_IRP_FROM_SEND_PKT(pNdisPacket); if (pOpenContext->bRunningOnWin9x) { // // We would have attached our own NDIS_BUFFER. Take it out // and free it. // #ifndef NDIS51 PNDIS_BUFFER pNdisBuffer; PVOID VirtualAddr; UINT BufferLength; UINT TotalLength; #endif #ifdef NDIS51 NUIO_ASSERT(FALSE); // NDIS 5.1 not on Win9X! #else NdisGetFirstBufferFromPacket( pNdisPacket, &pNdisBuffer, &VirtualAddr, &BufferLength, &TotalLength); NUIO_ASSERT(pNdisBuffer != NULL); NdisFreeBuffer(pNdisBuffer); #endif } #ifdef NDIS51 IoSetCancelRoutine(pIrp, NULL); NUIO_ACQUIRE_LOCK(&pOpenContext->Lock); NUIO_REMOVE_ENTRY_LIST(&pIrp->Tail.Overlay.ListEntry); NUIO_RELEASE_LOCK(&pOpenContext->Lock); #endif // // We are done with the NDIS_PACKET: // NUIO_DEREF_SEND_PKT(pNdisPacket); // // Complete the Write IRP with the right status. // pIrpSp = IoGetCurrentIrpStackLocation(pIrp); if (Status == NDIS_STATUS_SUCCESS) { pIrp->IoStatus.Information = pIrpSp->Parameters.Write.Length; pIrp->IoStatus.Status = STATUS_SUCCESS; } else { pIrp->IoStatus.Information = 0; pIrp->IoStatus.Status = STATUS_UNSUCCESSFUL; } DEBUGP(DL_INFO, ("SendComplete: packet %p/IRP %p/Length %d " "completed with status %x\n", pNdisPacket, pIrp, pIrp->IoStatus.Information, pIrp->IoStatus.Status)); IoCompleteRequest(pIrp, IO_NO_INCREMENT); NdisInterlockedDecrement((PLONG)&pOpenContext->PendedSendCount); NUIO_DEREF_OPEN(pOpenContext); // send complete - dequeued send IRP }
27.502016
97
0.566014
[ "object" ]
b42dcd195259b0b4587e19210bc71face099fe2c
2,863
h
C
src/fileutils.h
Novermars/parallel-kd-tree
c27fefe47dde9bf86525cf0914d861afd9fa3129
[ "MIT" ]
1
2022-01-08T23:05:09.000Z
2022-01-08T23:05:09.000Z
src/fileutils.h
Novermars/parallel-kd-tree
c27fefe47dde9bf86525cf0914d861afd9fa3129
[ "MIT" ]
null
null
null
src/fileutils.h
Novermars/parallel-kd-tree
c27fefe47dde9bf86525cf0914d861afd9fa3129
[ "MIT" ]
null
null
null
#pragma once #include "knode.h" #include <cstring> #include <fstream> #include <iostream> #include <queue> #include <stdexcept> #include <string> #include <vector> #include <tuple> #include "fileutils.h" namespace parkdtree::utils { /* This function reads the file row by row, and for each row stores the numbers found in an std::vector. The accepted dimension of each data point is the dimension of the data point in the first row of the file (a check is performed for each row though). */ template <typename T> std::tuple<std::vector<T>, int> readDataset(const std::string &filename) { std::ifstream file(filename); // local variable which holds the last known number of dimensions per data // point. used to check that all data points have the same number of // components int temp_dims = -1; constexpr char separator = ','; std::vector<T> lines_buffer; if (file.is_open()) { std::string line; while (std::getline(file, line)) { std::vector<T> row_buffer; int start = 0; for (unsigned idx = 1; idx < line.length(); ++idx) { // we found a component if (line[idx] == separator) { row_buffer.push_back(std::stod(line.substr(start, idx))); start = idx + 1; } } row_buffer.push_back(std::stod(line.substr(start, line.length()))); // we check that all the components have the same number of dimensions if (temp_dims != -1 && temp_dims != static_cast<int>(row_buffer.size())) throw std::invalid_argument( "Invalid number of dimensions for data point number " + std::to_string(lines_buffer.size())); temp_dims = row_buffer.size(); // we put everything into line_buffer for (int idx = 0; idx < temp_dims; ++idx) lines_buffer.push_back(row_buffer[idx]); } } else { throw std::invalid_argument("File not found."); } return {lines_buffer, temp_dims}; } template <typename T> void write_file(const std::string &filename, parkdtree::KNode<T> *root, int dims) { std::ofstream outdata; outdata.open(filename, std::fstream::out); if (!outdata) { throw std::invalid_argument("File not found."); } std::queue<parkdtree::KNode<T> *> to_visit; to_visit.push(root); while (to_visit.size() > 0) { parkdtree::KNode<T> *node = to_visit.front(); to_visit.pop(); for (int idx = 0; idx < dims; ++idx) { outdata << node->get_data(idx); if (idx < dims - 1) outdata << ","; } if (node->get_left() != nullptr) to_visit.push(node->get_left()); if (node->get_right() != nullptr) to_visit.push(node->get_right()); outdata << '\n'; } } }
28.63
81
0.597276
[ "vector" ]
b430a6a3af1d1e07bf20159c63b87234f679f352
1,364
h
C
include/ros_sec/Detector/colorDetector.h
zengzhen/ros_sec
110d07c3a786262b874386b266fc845c24fc43ae
[ "BSD-2-Clause" ]
null
null
null
include/ros_sec/Detector/colorDetector.h
zengzhen/ros_sec
110d07c3a786262b874386b266fc845c24fc43ae
[ "BSD-2-Clause" ]
null
null
null
include/ros_sec/Detector/colorDetector.h
zengzhen/ros_sec
110d07c3a786262b874386b266fc845c24fc43ae
[ "BSD-2-Clause" ]
null
null
null
/** * \file colorDetector.h * \author Zhen Zeng (zengzhen@umich.edu) * \brief RGB color detection to get objects with known color (eg, marked fingers) */ #ifndef COLORDETECTOR_H #define COLORDETECTOR_H #include <pcl/visualization/pcl_visualizer.h> #include "ros_sec/Visualizer/view2D.h" #include "ros_sec/typeDef.h" #include <cv.h> namespace TableObject{ class colorDetector { public: /** \brief empty Constructor */ colorDetector(){}; /** \brief Constructor * \param[in] rl/rh: low/high threshold of "r" value * \param[in] gl/gh: low/high threshold of "g" value * \param[in] bl/bh: low/high threshold of "b" value */ colorDetector(int rl, int rh, int gl, int gh, int bl, int bh); void setInputCloud(const CloudPtr& cloud, const std::vector<pcl::PointIndices>& clusters); void filter(pcl::PointIndices& fingertip_ptIdx, CloudPtr& detected_cloud); void showDetectedCloud(pcl::visualization::PCLVisualizer& viewer, std::string cloud_name); private: int _rl, _rh, _gl, _gh, _bl, _bh; CloudPtr _cloud; CloudPtr _detectedCloud; pcl::PointIndices _fingertip_ptIdx; std::vector<pcl::PointIndices> _clusters; }; } #endif // COLORDETECTOR_H
29.652174
98
0.625367
[ "vector" ]
b437bab11033cf42a034aad02aa5060d3a7b8a06
7,923
h
C
coupling/filtering/interfaces/FilterInterface.h
HSU-HPC/MaMiCo
d6f8597bd41ac3a5d3929c5eb4f7ecbc1b80e2ee
[ "BSD-4-Clause" ]
6
2021-02-06T17:21:10.000Z
2022-01-27T21:36:55.000Z
coupling/filtering/interfaces/FilterInterface.h
HSU-HPC/MaMiCo
d6f8597bd41ac3a5d3929c5eb4f7ecbc1b80e2ee
[ "BSD-4-Clause" ]
1
2021-06-24T15:17:46.000Z
2021-06-25T11:54:52.000Z
coupling/filtering/interfaces/FilterInterface.h
HSU-HPC/MaMiCo
d6f8597bd41ac3a5d3929c5eb4f7ecbc1b80e2ee
[ "BSD-4-Clause" ]
6
2021-12-16T11:39:24.000Z
2022-03-28T07:00:30.000Z
// This file is part of the Mamico project. For conditions of distribution // and use, please see the copyright notice in Mamico's main folder, or at // www5.in.tum.de/mamico #pragma once #include <vector> //#define DEBUG_FILTER_INTERFACE namespace coupling{ template<unsigned int dim> class FilterInterface; } /** * Generic interface for filters that are to be applied to data of coupling::MacroscopicCells before MD to Macro transfer. * Examples for such filters can be found in coupling/filtering/filters. * * If you wish to use a filter that does not give cell output data, i.e that is read-only, you want to use * coupling::FilterInterfaceReadOnly<dim> * instead (as provided in header file coupling/filtering/FilterPipelineReadOnly.h). * Examples for such filters are WriteToFile or Strouhal (in coupling/filtering/filters). * * @Author Felix Maurer */ template<unsigned int dim> class coupling::FilterInterface{ public: /* * Filter constructors are called during instanciation of their corresponding FilterSequence. * You can customize parameterization in coupling::FilterSequence::loadFiltersFromXML(...). */ FilterInterface( const std::vector<coupling::datastructures::MacroscopicCell<dim> *>& inputCellVector, const std::vector<coupling::datastructures::MacroscopicCell<dim> *>& outputCellVector, const std::vector<tarch::la::Vector<dim, unsigned int>> cellIndices, const std::array<bool, 7> filteredValues, const char* type): _inputCells(inputCellVector), _outputCells(outputCellVector), _cellIndices(cellIndices), _type(type) { if(filteredValues[0]){ _scalarSetters.push_back(&coupling::datastructures::MacroscopicCell<dim>::setMicroscopicMass); _scalarGetters.push_back(&coupling::datastructures::MacroscopicCell<dim>::getMicroscopicMass); } if(filteredValues[1]){ _vectorSetters.push_back(&coupling::datastructures::MacroscopicCell<dim>::setMicroscopicMomentum); _vectorGetters.push_back(&coupling::datastructures::MacroscopicCell<dim>::getMicroscopicMomentum); } if(filteredValues[2]){ _scalarSetters.push_back(&coupling::datastructures::MacroscopicCell<dim>::setMacroscopicMass); _scalarGetters.push_back(&coupling::datastructures::MacroscopicCell<dim>::getMacroscopicMass); } if(filteredValues[3]){ _vectorSetters.push_back(&coupling::datastructures::MacroscopicCell<dim>::setMacroscopicMomentum); _vectorGetters.push_back(&coupling::datastructures::MacroscopicCell<dim>::getMacroscopicMomentum); } if(filteredValues[4]){ _scalarSetters.push_back(&coupling::datastructures::MacroscopicCell<dim>::setPotentialEnergy); _scalarGetters.push_back(&coupling::datastructures::MacroscopicCell<dim>::getPotentialEnergy); } if(filteredValues[5]){ _vectorSetters.push_back(&coupling::datastructures::MacroscopicCell<dim>::setCurrentVelocity); _vectorGetters.push_back(&coupling::datastructures::MacroscopicCell<dim>::getCurrentVelocity); } if(filteredValues[6]){ _scalarSetters.push_back(&coupling::datastructures::MacroscopicCell<dim>::setTemperature); _scalarGetters.push_back(&coupling::datastructures::MacroscopicCell<dim>::getTemperature); } } FilterInterface(const char* type) : _type(type) {/* Used by incomplete implementations of FilterInterface. Should be redesigned via meta class.*/} virtual ~FilterInterface(){}; /* * Applies the filter to all cells that are within the filter's sequence's domain. * * It is very important that this method provides complete output data, * i.e uses all elements of _scalarSetters and _vectorSetters on all elements of _outputCells. * If this is not the case, you dont want to use this interface, but rather coupling::FilterInterfaceReadOnly * and use its method copyInputToOutput(). */ virtual void operator()() = 0; void updateCellData( const std::vector<coupling::datastructures::MacroscopicCell<dim>* >& new_inputCells, const std::vector<coupling::datastructures::MacroscopicCell<dim>* >& new_outputCells, const std::vector<tarch::la::Vector<dim,unsigned int>>& new_cellIndices ) { if(new_inputCells.size() != new_outputCells.size() || new_outputCells.size() != new_cellIndices.size()) throw std::runtime_error("New input-, output-, and indexing vectors must be of identical size."); //Note: I reverted this back to the original version. The cause for the malloc: invalid size bug most probably isnt here. _inputCells = new_inputCells; _outputCells = new_outputCells; _cellIndices = new_cellIndices; #ifdef DEBUG_FILTER_INTERFACE std::cout << " FI: Updated cell data." << std::endl; #endif } /* * Basic Getters/Setters */ const char* getType() const { return _type; } std::vector<coupling::datastructures::MacroscopicCell<dim>* > getInputCells() const { return _inputCells; } std::vector<coupling::datastructures::MacroscopicCell<dim>* > getOutputCells() const { return _outputCells; } std::vector<tarch::la::Vector<dim,unsigned int>> getCellIndices() const { return _cellIndices; } /* * Advanced Getters/Setters */ coupling::datastructures::MacroscopicCell<dim>* getInputCellOfIndex(tarch::la::Vector<dim,unsigned int> index) { for(unsigned int i = 0; i < _cellIndices.size(); i++) { if(_cellIndices[i] == index) return _inputCells[i]; } std::cout << "Index not found: " << index << std::endl; throw std::runtime_error("FilterInterface: getInputCellofIndex(): Could not find index."); } coupling::datastructures::MacroscopicCell<dim>* getOutputCellOfIndex(tarch::la::Vector<dim,unsigned int> index) { for(unsigned int i = 0; i < _cellIndices.size(); i++) { if(_cellIndices[i] == index) return _outputCells[i]; } std::cout << "Index not found: " << index << std::endl; throw std::runtime_error("FilterInterface: getOutputCellofIndex(): Could not find index."); } /* * Only used in one scenario: * - this is at index 0 in FS * - new filter gets dynamically linked into FS at index 0 * In that case, this was previously getting input from MD but won't any longer. * The newly added filter will provide input for this one instead. */ void setInputCells(const std::vector<coupling::datastructures::MacroscopicCell<dim>* >& newInputCells) { _inputCells = newInputCells; } //Size = number of cells in this filter. int getSize() const { return _cellIndices.size(); } protected: void DEBUG_PRINT_CELL_VELOCITY(const char* caller, unsigned int index = 0) { std::cout << " " << caller << " IN ("<< (_inputCells[index]) <<"): " << _inputCells[index]->getCurrentVelocity() << std::endl; std::cout << " " << caller << " OUT ("<< (_outputCells[index]) <<"): " << _outputCells[index]->getCurrentVelocity() << std::endl; } /** * Filters should read from input vector and write to output vector. * Both vectors use the same indexing by default. * All unmodified cells of the output vector are implicitly copied from their respective input counterpart, * i.e it is not mandatory to have any output. */ std::vector<coupling::datastructures::MacroscopicCell<dim>* > _inputCells; std::vector<coupling::datastructures::MacroscopicCell<dim>* > _outputCells; std::vector<tarch::la::Vector<dim,unsigned int>> _cellIndices; //scalars std::vector<void (coupling::datastructures::MacroscopicCell<dim>::*)(const double&)> _scalarSetters; std::vector<const double& (coupling::datastructures::MacroscopicCell<dim>::*)() const> _scalarGetters; //vectors std::vector<void (coupling::datastructures::MacroscopicCell<dim>::*)(const tarch::la::Vector<dim, double>&)> _vectorSetters; std::vector<const tarch::la::Vector<dim, double>& (coupling::datastructures::MacroscopicCell<dim>::*)() const> _vectorGetters; //unique identifier per filter class const char* _type; };
45.274286
148
0.729017
[ "vector" ]
b43ce0d3ffac05789232f778609db8ab844d8263
53,755
c
C
src/libraries/ut/sg_history.c
avar/veracity
ffda987d8b722e6f51c409c79355cf5fe5e552f0
[ "Apache-2.0" ]
2
2015-09-17T04:34:02.000Z
2019-12-28T18:15:09.000Z
src/libraries/ut/sg_history.c
avar/veracity
ffda987d8b722e6f51c409c79355cf5fe5e552f0
[ "Apache-2.0" ]
null
null
null
src/libraries/ut/sg_history.c
avar/veracity
ffda987d8b722e6f51c409c79355cf5fe5e552f0
[ "Apache-2.0" ]
null
null
null
/* Copyright 2010 SourceGear, 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. */ #include <sg.h> //This is used to pass around caches and repos while calling back to fill in the history results details. struct _fill_in_result_details_data { SG_repo * pRepo; SG_bool bChildren; }; void _sg_history_find_treenodeentry_in_one_of_these_paths(SG_context * pCtx, SG_repo * pRepo, SG_treenode * pTreenodeRoot, const char * pszSearchGID, SG_int32 vectorIndex, SG_vector * pVectorKnownPaths, SG_vector * pVectorCurrentPathIndex, SG_treenode_entry ** ppTreeNodeEntry) { SG_uint32 pathVectorIndex = 0; SG_uint32 pathVectorCount = 0; const char* pszSearchPath = NULL; SG_uint32 currentPathIndex = 0; char* pGID = NULL; SG_stringarray * pStringArrayPathsForCurrentGID = NULL; SG_uint32 countPathsForCurrentGID = 0; SG_treenode_entry * ptne = NULL; SG_ERR_CHECK( SG_vector__get(pCtx, pVectorCurrentPathIndex, vectorIndex, (void**)&currentPathIndex) ); SG_ERR_CHECK( SG_vector__get(pCtx, pVectorKnownPaths, vectorIndex, (void**)&pStringArrayPathsForCurrentGID) ); if (pStringArrayPathsForCurrentGID == NULL) { *ppTreeNodeEntry = NULL; return; } SG_ERR_CHECK( SG_stringarray__count(pCtx, pStringArrayPathsForCurrentGID, &countPathsForCurrentGID) ); if(countPathsForCurrentGID==0) { *ppTreeNodeEntry = NULL; return; } SG_ERR_CHECK( SG_stringarray__get_nth(pCtx, pStringArrayPathsForCurrentGID, currentPathIndex, &pszSearchPath) ); SG_ERR_CHECK( SG_treenode__find_treenodeentry_by_path(pCtx, pRepo, pTreenodeRoot, pszSearchPath, &pGID, &ptne) ); if (ptne == NULL || strcmp(pGID, pszSearchGID) != 0) { if (ptne != NULL) { SG_TREENODE_ENTRY_NULLFREE(pCtx, ptne); SG_NULLFREE(pCtx, pGID); } //We didn't find it at the last path that we tried. Retry all of them, until we get a hit. //Then cache that path index in the pVectorCurrentPathIndex vector. SG_ERR_CHECK( SG_stringarray__count(pCtx, pStringArrayPathsForCurrentGID, &pathVectorCount ) ); for (pathVectorIndex = 0; pathVectorIndex < pathVectorCount; pathVectorIndex++) { SG_ERR_CHECK( SG_stringarray__get_nth(pCtx, pStringArrayPathsForCurrentGID, pathVectorIndex, &pszSearchPath) ); SG_ERR_CHECK( SG_treenode__find_treenodeentry_by_path(pCtx, pRepo, pTreenodeRoot, pszSearchPath, &pGID, &ptne) ); if (ptne != NULL && strcmp(pGID, pszSearchGID) == 0) { //Found it! SG_ERR_CHECK( SG_vector__set(pCtx, pVectorCurrentPathIndex, vectorIndex, (void*)pathVectorIndex) ); break; } SG_NULLFREE(pCtx, pGID); SG_TREENODE_ENTRY_NULLFREE(pCtx, ptne); ptne = NULL; } } SG_NULLFREE(pCtx, pGID); *ppTreeNodeEntry = ptne; return; fail: return; } void SG_history__get_id_and_parents(SG_context* pCtx, SG_repo* pRepo, SG_dagnode * pCurrentDagnode, SG_vhash** ppvh_changesetDescription) { SG_bool b = SG_FALSE; SG_rbtree_iterator * pit = NULL; SG_rbtree * prb_parents = NULL; SG_varray * pVArrayParents = NULL; SG_varray * pVArrayParents_ref = NULL; const char * pszParentID = NULL; const char* pszDagNodeHID = NULL; SG_UNUSED(pRepo); SG_ERR_CHECK( SG_dagnode__get_id_ref(pCtx, pCurrentDagnode, &pszDagNodeHID) ); SG_ERR_CHECK( SG_vhash__add__string__sz(pCtx, *ppvh_changesetDescription, "changeset_id", pszDagNodeHID) ); SG_ERR_CHECK( SG_VARRAY__ALLOC(pCtx, &pVArrayParents) ); pVArrayParents_ref = pVArrayParents; SG_ERR_CHECK( SG_vhash__add__varray(pCtx, *ppvh_changesetDescription, "parents", &pVArrayParents) ); SG_ERR_CHECK( SG_dagnode__get_parents__rbtree_ref(pCtx, pCurrentDagnode, &prb_parents) ); if (prb_parents) { SG_ERR_CHECK( SG_rbtree__iterator__first(pCtx, &pit, prb_parents, &b, &pszParentID, NULL) ); while (b) { SG_ERR_CHECK( SG_varray__append__string__sz(pCtx, pVArrayParents_ref, pszParentID) ); SG_ERR_CHECK( SG_rbtree__iterator__next(pCtx, pit, &b, &pszParentID, NULL) ); } SG_RBTREE_ITERATOR_NULLFREE(pCtx, pit); } fail: SG_RBTREE_ITERATOR_NULLFREE(pCtx, pit); SG_VARRAY_NULLFREE(pCtx, pVArrayParents); } void _sg_history_check_dagnode_for_inclusion(SG_context * pCtx, SG_repo * pRepo, SG_dagnode * pCurrentDagnode, SG_bool bHistoryOnRoot, SG_stringarray * pStringArrayGIDs, SG_vector * pVectorKnownPaths, SG_vector * pVectorCurrentPathIndex, SG_rbtree * pCandidateChangesets, SG_varray * pArrayReturnResults) { SG_changeset * pChangeset = NULL; SG_changeset * pChangesetParent = NULL; SG_treenode_entry * ptne = NULL; SG_treenode_entry * ptneParent = NULL; const char* pszHidTreeNode = NULL; const char* pszHidTreeNodeParent = NULL; SG_treenode * pTreenodeRoot = NULL; SG_treenode * pTreenodeRootParent = NULL; SG_vhash * pvh_changesetDescription = NULL; SG_treenode_entry ** ptneChildTreeNodeEntries = NULL; const char* pszCurrentSearchGID = NULL; SG_rbtree * pRBT_parents = NULL; SG_rbtree_iterator * pIterator = NULL; SG_uint32 numberOfGIDs = 0; SG_bool bEqual = SG_FALSE; SG_uint32 currentGID_index = 0; SG_uint32 parentCount = 0; SG_bool bIncludeChangeset = SG_FALSE; SG_bool bContinue = SG_FALSE; SG_bool bFoundItInCandidateList = SG_FALSE; void * unusedPointer; const char * pszDagNodeHID; const char * pszParentHid = NULL; SG_ERR_CHECK( SG_dagnode__get_id_ref(pCtx, pCurrentDagnode, &pszDagNodeHID) ); if (pCandidateChangesets != NULL) { SG_ERR_CHECK( SG_rbtree__find(pCtx, pCandidateChangesets, pszDagNodeHID, &bFoundItInCandidateList, &unusedPointer) ); //If the DagNode HID is not in the Candidate list, skip it. if (bFoundItInCandidateList == SG_FALSE) return; } //bHistoryOnRoot true means that we include every dagnode. if (bHistoryOnRoot == SG_FALSE) { SG_ERR_CHECK( SG_dagnode__count_parents(pCtx, pCurrentDagnode, &parentCount) ); SG_ERR_CHECK( SG_dagnode__get_parents__rbtree_ref(pCtx, pCurrentDagnode, &pRBT_parents) ); SG_ERR_CHECK( SG_changeset__load_from_repo(pCtx, pRepo, pszDagNodeHID, &pChangeset) ); SG_ERR_CHECK( SG_changeset__get_root(pCtx, pChangeset, &pszHidTreeNode) ); SG_ERR_CHECK( SG_treenode__load_from_repo(pCtx, pRepo, pszHidTreeNode, &pTreenodeRoot) ); SG_ERR_CHECK( SG_stringarray__count(pCtx, pStringArrayGIDs, &numberOfGIDs ) ); SG_ERR_CHECK( SG_allocN(pCtx, numberOfGIDs, ptneChildTreeNodeEntries) ); for(currentGID_index = 0; currentGID_index < numberOfGIDs; currentGID_index++) { if (ptneChildTreeNodeEntries[currentGID_index] == NULL) { //Find the treenodeentry in the child. SG_ERR_CHECK( SG_stringarray__get_nth(pCtx, pStringArrayGIDs, currentGID_index, &pszCurrentSearchGID) ); SG_ERR_CHECK( _sg_history_find_treenodeentry_in_one_of_these_paths(pCtx, pRepo, pTreenodeRoot, pszCurrentSearchGID, currentGID_index, pVectorKnownPaths, pVectorCurrentPathIndex, &ptne) ); ptneChildTreeNodeEntries[currentGID_index] = ptne; if (ptne != NULL && parentCount == 0) //Special case for the @ sign. It gets added in the one changeset with no parent. { bIncludeChangeset = SG_TRUE; break; } } } if (parentCount > 0) { SG_ERR_CHECK( SG_rbtree__iterator__first(pCtx, &pIterator, pRBT_parents, &bContinue, &pszParentHid, &unusedPointer) ); while (bContinue == SG_TRUE && bIncludeChangeset == SG_FALSE) { //Load the parent changeset SG_ERR_CHECK( SG_changeset__load_from_repo(pCtx, pRepo, pszParentHid, &pChangesetParent) ); SG_ERR_CHECK( SG_changeset__get_root(pCtx, pChangesetParent, &pszHidTreeNodeParent) ); SG_ERR_CHECK( SG_treenode__load_from_repo(pCtx, pRepo, pszHidTreeNodeParent, &pTreenodeRootParent) ); for(currentGID_index = 0; currentGID_index < numberOfGIDs; currentGID_index++) { SG_ERR_CHECK( _sg_history_find_treenodeentry_in_one_of_these_paths(pCtx, pRepo, pTreenodeRootParent, pszCurrentSearchGID, currentGID_index, pVectorKnownPaths, pVectorCurrentPathIndex, &ptneParent) ); if ( (ptneChildTreeNodeEntries[currentGID_index] == NULL && ptneParent != NULL) || (ptneParent == NULL && ptneChildTreeNodeEntries[currentGID_index] != NULL)) { //The thing was deleted or added (possibly secondarily deleted). hrmph bIncludeChangeset = SG_TRUE; } else if ( ptneChildTreeNodeEntries[currentGID_index] != NULL && ptneParent != NULL ) { //They're both not null. Compare them. SG_ERR_CHECK( SG_treenode_entry__equal(pCtx, ptneChildTreeNodeEntries[currentGID_index], ptneParent, &bEqual) ); if (bEqual != SG_TRUE) { bIncludeChangeset = SG_TRUE; } } SG_TREENODE_ENTRY_NULLFREE(pCtx, ptneParent); if (bIncludeChangeset == SG_TRUE) //We got a hit, so we don't need to check any more parents. break; } SG_TREENODE_NULLFREE(pCtx, pTreenodeRootParent); SG_CHANGESET_NULLFREE(pCtx, pChangesetParent); if (bIncludeChangeset == SG_TRUE) //We got a hit, so we don't need to check any more GIDs. break; SG_ERR_CHECK( SG_rbtree__iterator__next(pCtx, pIterator, &bContinue, &pszParentHid, NULL) ); } SG_RBTREE_ITERATOR_NULLFREE(pCtx, pIterator); } for(currentGID_index = 0; currentGID_index < numberOfGIDs; currentGID_index++) { SG_TREENODE_ENTRY_NULLFREE(pCtx, ptneChildTreeNodeEntries[currentGID_index]); } } else //bHistoryOnRoot is TRUE. bIncludeChangeset = SG_TRUE; if (bIncludeChangeset == SG_TRUE) { SG_ERR_CHECK( SG_VHASH__ALLOC(pCtx, &pvh_changesetDescription) ); SG_ERR_CHECK( SG_history__get_id_and_parents(pCtx, pRepo, pCurrentDagnode, &pvh_changesetDescription) ); SG_ERR_CHECK( SG_varray__append__vhash(pCtx, pArrayReturnResults, &pvh_changesetDescription) ); SG_VHASH_NULLFREE(pCtx, pvh_changesetDescription); } SG_NULLFREE(pCtx, ptneChildTreeNodeEntries); SG_TREENODE_NULLFREE(pCtx, pTreenodeRoot); SG_CHANGESET_NULLFREE(pCtx, pChangeset); return; fail: SG_NULLFREE(pCtx, ptneChildTreeNodeEntries); SG_TREENODE_NULLFREE(pCtx, pTreenodeRoot); SG_CHANGESET_NULLFREE(pCtx, pChangeset); SG_VHASH_NULLFREE(pCtx, pvh_changesetDescription); } static void sg_history__slice__one( SG_context* pCtx, SG_vector* pvec, const char* psz_field, SG_varray** ppva ) { SG_varray* pva = NULL; SG_uint32 count = 0; SG_uint32 i = 0; SG_ERR_CHECK( SG_varray__alloc(pCtx, &pva) ); SG_ERR_CHECK( SG_vector__length(pCtx, pvec, &count) ); for (i=0; i<count; i++) { SG_vhash* pvh_orig = NULL; const char* psz_val = NULL; SG_ERR_CHECK( SG_vector__get(pCtx, pvec, i, (void**) &pvh_orig) ); SG_ERR_CHECK( SG_vhash__get__sz(pCtx, pvh_orig, psz_field, &psz_val) ); SG_ERR_CHECK( SG_varray__append__string__sz(pCtx, pva, psz_val) ); } *ppva = pva; pva = NULL; fail: SG_VARRAY_NULLFREE(pCtx, pva); } static void sg_history__slice__audits( SG_context* pCtx, SG_vector* pvec, SG_rbtree* prb_users, SG_varray** ppva ) { SG_varray* pva = NULL; SG_vhash* pvh_copy = NULL; SG_uint32 count = 0; SG_uint32 i = 0; SG_ERR_CHECK( SG_varray__alloc(pCtx, &pva) ); SG_ERR_CHECK( SG_vector__length(pCtx, pvec, &count) ); for (i=0; i<count; i++) { SG_vhash* pvh_orig = NULL; const char* psz_val = NULL; SG_int64 i_time = 0; SG_vhash* pvh_user = NULL; SG_bool b_found_user = SG_FALSE; SG_ERR_CHECK( SG_vector__get(pCtx, pvec, i, (void**) &pvh_orig) ); SG_ERR_CHECK( SG_varray__appendnew__vhash(pCtx, pva, &pvh_copy) ); SG_ERR_CHECK( SG_vhash__get__sz(pCtx, pvh_orig, "who", &psz_val) ); SG_ERR_CHECK( SG_vhash__add__string__sz(pCtx, pvh_copy, "who", psz_val) ); SG_ERR_CHECK( SG_rbtree__find(pCtx, prb_users, psz_val, &b_found_user, (void**) &pvh_user) ); if (b_found_user && pvh_user) { const char* psz_email = NULL; SG_ERR_CHECK( SG_vhash__get__sz(pCtx, pvh_user, "email", &psz_email) ); SG_ERR_CHECK( SG_vhash__add__string__sz(pCtx, pvh_copy, "email", psz_email) ); } SG_ERR_CHECK( SG_vhash__get__int64(pCtx, pvh_orig, "when", &i_time) ); SG_ERR_CHECK( SG_vhash__add__int64(pCtx, pvh_copy, "when", i_time) ); } *ppva = pva; pva = NULL; fail: SG_VARRAY_NULLFREE(pCtx, pva); } static void sg_history__comments( SG_context* pCtx, SG_vector* pvec, SG_rbtree* prb_users, SG_varray** ppva ) { SG_varray* pva = NULL; SG_vhash* pvh_copy = NULL; SG_uint32 count = 0; SG_uint32 i = 0; SG_bool b_has_history = SG_FALSE; SG_ERR_CHECK( SG_varray__alloc(pCtx, &pva) ); SG_ERR_CHECK( SG_vector__length(pCtx, pvec, &count) ); for (i=0; i<count; i++) { SG_vhash* pvh_orig = NULL; SG_varray* pva_history = NULL; SG_varray* pva_audits = NULL; SG_uint32 count_audits = 0; SG_uint32 count_entries = 0; SG_uint32 j = 0; SG_uint32 k = 0; SG_ERR_CHECK( SG_vector__get(pCtx, pvec, i, (void**) &pvh_orig) ); SG_ERR_CHECK( SG_vhash__alloc__copy(pCtx, &pvh_copy, pvh_orig) ); SG_ERR_CHECK( SG_vhash__has(pCtx, pvh_copy, "history", &b_has_history) ); if (b_has_history) { SG_ERR_CHECK( SG_vhash__get__varray(pCtx, pvh_copy, "history", &pva_history) ); SG_ERR_CHECK( SG_varray__count(pCtx, pva_history, &count_entries) ); for (k=0; k<count_entries; k++) { SG_vhash* pvh_entry = NULL; SG_ERR_CHECK( SG_varray__get__vhash(pCtx, pva_history, k, &pvh_entry) ); SG_ERR_CHECK( SG_vhash__get__varray(pCtx, pvh_entry, "audits", &pva_audits) ); SG_ERR_CHECK( SG_varray__count(pCtx, pva_audits, &count_audits) ); for (j=0; j<count_audits; j++) { SG_vhash* pvh_audit = NULL; const char* psz_who = NULL; SG_vhash* pvh_user = NULL; SG_bool b_found = SG_FALSE; SG_ERR_CHECK( SG_varray__get__vhash(pCtx, pva_audits, j, &pvh_audit) ); SG_ERR_CHECK( SG_vhash__get__sz(pCtx, pvh_audit, "who", &psz_who) ); SG_ERR_CHECK( SG_rbtree__find(pCtx, prb_users, psz_who, &b_found, (void**) &pvh_user) ); if (b_found && pvh_user) { const char* psz_email = NULL; SG_ERR_CHECK( SG_vhash__get__sz(pCtx, pvh_user, "email", &psz_email) ); SG_ERR_CHECK( SG_vhash__add__string__sz(pCtx, pvh_audit, "email", psz_email) ); } } } } SG_ERR_CHECK( SG_varray__append__vhash(pCtx, pva, &pvh_copy) ); } *ppva = pva; pva = NULL; fail: SG_VARRAY_NULLFREE(pCtx, pva); } static void sg_history__details_for_one_changeset( SG_context* pCtx, SG_vhash * pCurrentHash, SG_rbtree* prb_all_audits, SG_rbtree* prb_all_stamps, SG_rbtree* prb_all_tags, SG_rbtree* prb_all_comments, SG_rbtree* prb_all_users ) { SG_bool b_found = SG_FALSE; SG_vector* pvec = NULL; SG_varray * pva_audits = NULL; SG_varray * pva_tags = NULL; SG_varray * pva_stamps = NULL; SG_varray * pva_comments = NULL; const char* psz_csid = NULL; SG_ERR_CHECK( SG_vhash__get__sz(pCtx, pCurrentHash, "changeset_id", &psz_csid) ); // -------- audits -------- b_found = SG_FALSE; pvec = NULL; SG_ERR_CHECK( SG_rbtree__find(pCtx, prb_all_audits, psz_csid, &b_found, (void**) &pvec) ); if (pvec) { SG_ERR_CHECK( sg_history__slice__audits(pCtx, pvec, prb_all_users, &pva_audits) ); } else { SG_ERR_CHECK( SG_varray__alloc(pCtx, &pva_audits) ); } SG_ERR_CHECK( SG_vhash__add__varray(pCtx, pCurrentHash, "audits", &pva_audits) ); // -------- tags -------- b_found = SG_FALSE; pvec = NULL; SG_ERR_CHECK( SG_rbtree__find(pCtx, prb_all_tags, psz_csid, &b_found, (void**) &pvec) ); if (pvec) { SG_ERR_CHECK( sg_history__slice__one(pCtx, pvec, "tag", &pva_tags) ); } else { SG_ERR_CHECK( SG_varray__alloc(pCtx, &pva_tags) ); } SG_ERR_CHECK( SG_vhash__add__varray(pCtx, pCurrentHash, "tags", &pva_tags) ); // -------- stamps -------- b_found = SG_FALSE; pvec = NULL; SG_ERR_CHECK( SG_rbtree__find(pCtx, prb_all_stamps, psz_csid, &b_found, (void**) &pvec) ); if (pvec) { SG_ERR_CHECK( sg_history__slice__one(pCtx, pvec, "stamp", &pva_stamps) ); } else { SG_ERR_CHECK( SG_varray__alloc(pCtx, &pva_stamps) ); } SG_ERR_CHECK( SG_vhash__add__varray(pCtx, pCurrentHash, "stamps", &pva_stamps) ); // -------- comments -------- b_found = SG_FALSE; pvec = NULL; SG_ERR_CHECK( SG_rbtree__find(pCtx, prb_all_comments, psz_csid, &b_found, (void**) &pvec) ); if (pvec) { SG_ERR_CHECK( sg_history__comments(pCtx, pvec, prb_all_users, &pva_comments) ); } else { SG_ERR_CHECK( SG_varray__alloc(pCtx, &pva_comments) ); } SG_ERR_CHECK( SG_vhash__add__varray(pCtx, pCurrentHash, "comments", &pva_comments) ); fail: SG_VARRAY_NULLFREE(pCtx, pva_audits); SG_VARRAY_NULLFREE(pCtx, pva_tags); SG_VARRAY_NULLFREE(pCtx, pva_stamps); SG_VARRAY_NULLFREE(pCtx, pva_comments); } void SG_history__get_changeset_comments(SG_context* pCtx, SG_repo* pRepo, const char* pszDagNodeHID, SG_varray** ppvaComments) { SG_varray* pvaComments = NULL; SG_varray* pvaResults = NULL; SG_bool b_has_history; SG_uint32 count; SG_uint32 i; SG_VARRAY__ALLOC(pCtx, &pvaResults); SG_ERR_CHECK( SG_vc_comments__lookup(pCtx, pRepo, pszDagNodeHID, &pvaComments) ); SG_ERR_CHECK( SG_varray__count(pCtx, pvaComments, &count) ); for (i=0; i<count; i++) { SG_vhash* pvh_orig = NULL; SG_vhash* pvh_copy = NULL; SG_varray* pva_history = NULL; SG_uint32 count_entries; SG_uint32 k; SG_ERR_CHECK( SG_varray__get__vhash(pCtx, pvaComments, i, &pvh_orig) ); SG_ERR_CHECK( SG_VHASH__ALLOC__COPY(pCtx, &pvh_copy, pvh_orig) ); SG_ERR_CHECK( SG_vhash__has(pCtx, pvh_copy, "history", &b_has_history) ); if (b_has_history) { SG_varray* pva_audits = NULL; SG_ERR_CHECK( SG_vhash__get__varray(pCtx, pvh_copy, "history", &pva_history) ); SG_ERR_CHECK( SG_varray__count(pCtx, pva_history, &count_entries) ); for (k=0; k<count_entries; k++) { SG_vhash* pvh_entry = NULL; SG_uint32 count_audits; SG_uint32 j; SG_ERR_CHECK( SG_varray__get__vhash(pCtx, pva_history, k, &pvh_entry) ); SG_ERR_CHECK( SG_vhash__get__varray(pCtx, pvh_entry, "audits", &pva_audits) ); SG_ERR_CHECK( SG_varray__count(pCtx, pva_audits, &count_audits) ); for (j=0; j<count_audits; j++) { SG_vhash* pvh_audit = NULL; const char* psz_who = NULL; SG_vhash* pvh_user = NULL; SG_ERR_CHECK( SG_varray__get__vhash(pCtx, pva_audits, j, &pvh_audit) ); SG_ERR_CHECK( SG_vhash__get__sz(pCtx, pvh_audit, "who", &psz_who) ); SG_ERR_CHECK( SG_user__lookup_by_userid(pCtx, pRepo, psz_who, &pvh_user) ); if (pvh_user) { const char* psz_email = NULL; SG_ERR_CHECK( SG_vhash__get__sz(pCtx, pvh_user, "email", &psz_email) ); SG_ERR_CHECK( SG_vhash__add__string__sz(pCtx, pvh_audit, "email", psz_email) ); } SG_VHASH_NULLFREE(pCtx, pvh_user); } } } SG_ERR_CHECK( SG_varray__append__vhash(pCtx, pvaResults, &pvh_copy) ); SG_VHASH_NULLFREE(pCtx, pvh_copy); } *ppvaComments = pvaResults; pvaResults = NULL; fail: SG_VARRAY_NULLFREE(pCtx, pvaComments); SG_VARRAY_NULLFREE(pCtx, pvaResults); } void SG_history__get_parents_description(SG_context* pCtx, SG_repo* pRepo, const char* pChangesetHid, SG_vhash** ppvhParents) { SG_bool b = SG_FALSE; SG_rbtree_iterator * pit = NULL; SG_rbtree * prbParents = NULL; SG_vhash * pvhParents = NULL; const char * pszParentID = NULL; SG_vhash* pvhAuditResult = NULL; SG_uint32 count_audits; SG_varray* pvaAudits = NULL; SG_varray* pvaAuditsResult = NULL; SG_varray* pvaComments = NULL; SG_vhash* pvh_result = NULL; SG_dagnode* pdn = NULL; SG_ERR_CHECK( SG_repo__fetch_dagnode(pCtx, pRepo, pChangesetHid, &pdn) ); SG_ERR_CHECK( SG_VHASH__ALLOC(pCtx, &pvhParents) ); SG_ERR_CHECK( SG_dagnode__get_parents__rbtree_ref(pCtx, pdn, &prbParents) ); if (prbParents) { SG_ERR_CHECK( SG_rbtree__iterator__first(pCtx, &pit, prbParents, &b, &pszParentID, NULL) ); while (b) { SG_uint32 i; SG_VHASH__ALLOC(pCtx, &pvh_result); SG_VARRAY__ALLOC(pCtx, &pvaAuditsResult); SG_ERR_CHECK( SG_audit__lookup(pCtx, pRepo, pszParentID, SG_DAGNUM__VERSION_CONTROL, &pvaAudits) ); SG_ERR_CHECK( SG_varray__count(pCtx, pvaAudits, &count_audits) ); for (i=0; i<count_audits; i++) { SG_vhash* pvh = NULL; SG_vhash* pvh_user = NULL; const char* psz_userid = NULL; SG_ERR_CHECK( SG_varray__get__vhash(pCtx, pvaAudits, i, &pvh) ); SG_ERR_CHECK( SG_VHASH__ALLOC__COPY(pCtx, &pvhAuditResult, pvh) ); SG_ERR_CHECK( SG_vhash__get__sz(pCtx, pvhAuditResult, "who", &psz_userid) ); SG_ERR_CHECK( SG_user__lookup_by_userid(pCtx, pRepo, psz_userid, &pvh_user) ); if (pvh_user) { const char* psz_email = NULL; SG_ERR_CHECK( SG_vhash__get__sz(pCtx, pvh_user, "email", &psz_email) ); SG_ERR_CHECK( SG_vhash__add__string__sz(pCtx, pvhAuditResult, "email", psz_email) ); } SG_ERR_CHECK( SG_varray__append__vhash(pCtx, pvaAuditsResult, &pvhAuditResult) ); SG_VHASH_NULLFREE(pCtx, pvhAuditResult); SG_VHASH_NULLFREE(pCtx, pvh_user); } SG_ERR_CHECK( SG_vhash__add__varray(pCtx, pvh_result, "audits", &pvaAuditsResult) ); SG_ERR_CHECK( SG_history__get_changeset_comments(pCtx, pRepo, pszParentID, &pvaComments) ); SG_ERR_CHECK( SG_vhash__add__varray(pCtx, pvh_result, "comments", &pvaComments) ); SG_ERR_CHECK( SG_vhash__add__vhash(pCtx, pvhParents, pszParentID, &pvh_result) ); SG_VHASH_NULLFREE(pCtx, pvh_result); SG_VARRAY_NULLFREE(pCtx, pvaComments); SG_VARRAY_NULLFREE(pCtx, pvaAudits); SG_VHASH_NULLFREE(pCtx, pvh_result); SG_ERR_CHECK( SG_rbtree__iterator__next(pCtx, pit, &b, &pszParentID, NULL) ); } SG_RBTREE_ITERATOR_NULLFREE(pCtx, pit); } *ppvhParents = pvhParents; pvhParents = NULL; fail: SG_RBTREE_ITERATOR_NULLFREE(pCtx, pit); SG_VHASH_NULLFREE(pCtx, pvhParents); SG_VARRAY_NULLFREE(pCtx, pvaComments); SG_VARRAY_NULLFREE(pCtx, pvaAuditsResult); SG_VHASH_NULLFREE(pCtx, pvh_result); SG_VARRAY_NULLFREE(pCtx, pvaAudits); SG_VHASH_NULLFREE(pCtx, pvhAuditResult); SG_DAGNODE_NULLFREE(pCtx, pdn); } void SG_history__get_changeset_description(SG_context* pCtx, SG_repo* pRepo, const char* pChangesetHid, SG_bool bChildren, SG_vhash** ppvhChangesetDescription) { SG_rbtree_iterator * pit = NULL; SG_rbtree* prbChildren = NULL; SG_varray * pvaUsers = NULL; SG_varray * pva_tags = NULL; SG_varray * pva_stamps = NULL; SG_varray * pvaTags = NULL; SG_varray * pvaComments = NULL; SG_varray * pvaChildren = NULL; SG_varray * pvaStamps = NULL; SG_varray * pvaAudits = NULL; SG_vhash * pvhParents = NULL; SG_uint32 count_audits; SG_uint32 i; SG_vhash* pvh_result = NULL; SG_uint32 parent_count; SG_ERR_CHECK( SG_VHASH__ALLOC(pCtx, &pvh_result) ); SG_ERR_CHECK( SG_vhash__add__string__sz(pCtx, pvh_result, "changeset_id", pChangesetHid) ); SG_ERR_CHECK( SG_varray__alloc(pCtx, &pvaUsers) ); SG_ERR_CHECK( SG_audit__lookup(pCtx, pRepo, pChangesetHid, SG_DAGNUM__VERSION_CONTROL, &pvaAudits) ); SG_ERR_CHECK( SG_varray__count(pCtx, pvaAudits, &count_audits) ); for (i=0; i<count_audits; i++) { SG_vhash* pvh = NULL; SG_vhash* pvh_user = NULL; const char* psz_userid = NULL; const char* psz_email = NULL; SG_vhash* pvhAuditResult = NULL; SG_ERR_CHECK( SG_varray__get__vhash(pCtx, pvaAudits, i, &pvh) ); SG_ERR_CHECK( SG_VHASH__ALLOC__COPY(pCtx, &pvhAuditResult, pvh) ); SG_ERR_CHECK( SG_vhash__get__sz(pCtx, pvhAuditResult, "who", &psz_userid) ); SG_ERR_CHECK( SG_user__lookup_by_userid(pCtx, pRepo, psz_userid, &pvh_user) ); if (pvh_user) { SG_ERR_CHECK( SG_vhash__get__sz(pCtx, pvh_user, "email", &psz_email) ); SG_ERR_CHECK( SG_vhash__add__string__sz(pCtx, pvhAuditResult, "email", psz_email) ); } SG_ERR_CHECK( SG_varray__append__vhash(pCtx, pvaUsers, &pvhAuditResult) ); SG_VHASH_NULLFREE(pCtx, pvh_user); SG_VHASH_NULLFREE(pCtx, pvhAuditResult); } SG_ERR_CHECK( SG_vhash__add__varray(pCtx, pvh_result, "audits", &pvaUsers) ); SG_VARRAY_NULLFREE(pCtx, pvaUsers); SG_VARRAY_NULLFREE(pCtx, pvaAudits ); SG_ERR_CHECK( SG_history__get_parents_description(pCtx, pRepo, pChangesetHid, &pvhParents) ); SG_ERR_CHECK( SG_vhash__count(pCtx, pvhParents, &parent_count) ); SG_ERR_CHECK( SG_vhash__add__vhash(pCtx, pvh_result, "parents", &pvhParents) ); SG_ERR_CHECK( SG_vhash__add__int64(pCtx, pvh_result, "parent_count", (SG_int64) parent_count) ); SG_VHASH_NULLFREE(pCtx, pvhParents); SG_ERR_CHECK( SG_vc_tags__lookup(pCtx, pRepo, pChangesetHid, &pva_tags) ); if (pva_tags) { SG_ERR_CHECK( SG_zing__extract_one_from_slice__string(pCtx, pva_tags, "tag", &pvaTags) ); SG_VARRAY_NULLFREE(pCtx, pva_tags); } SG_ERR_CHECK( SG_vhash__add__varray(pCtx, pvh_result, "tags", &pvaTags) ); SG_VARRAY_NULLFREE(pCtx, pvaTags); SG_ERR_CHECK( SG_vc_stamps__lookup(pCtx, pRepo, pChangesetHid, &pva_stamps) ); if (pva_stamps) { SG_ERR_CHECK( SG_zing__extract_one_from_slice__string(pCtx, pva_stamps, "stamp", &pvaStamps) ); SG_VARRAY_NULLFREE(pCtx, pva_stamps); } SG_ERR_CHECK( SG_vhash__add__varray(pCtx, pvh_result, "stamps", &pvaStamps) ); SG_VARRAY_NULLFREE(pCtx, pva_stamps); SG_ERR_CHECK( SG_history__get_changeset_comments(pCtx, pRepo, pChangesetHid, &pvaComments) ); SG_ERR_CHECK( SG_vhash__add__varray(pCtx, pvh_result, "comments", &pvaComments) ); SG_VARRAY_NULLFREE(pCtx, pvaComments); if (bChildren) { SG_ERR_CHECK( SG_repo__fetch_dagnode_children(pCtx, pRepo, SG_DAGNUM__VERSION_CONTROL, pChangesetHid, &prbChildren) ); SG_ERR_CHECK( SG_rbtree__to_varray__keys_only(pCtx, prbChildren, &pvaChildren) ); SG_ERR_CHECK( SG_vhash__add__varray(pCtx, pvh_result, "children", &pvaChildren) ); SG_VARRAY_NULLFREE(pCtx, pvaChildren); SG_RBTREE_NULLFREE(pCtx, prbChildren); } *ppvhChangesetDescription = pvh_result; pvh_result = NULL; fail: SG_RBTREE_ITERATOR_NULLFREE(pCtx, pit); SG_VARRAY_NULLFREE(pCtx, pvaUsers); SG_VARRAY_NULLFREE(pCtx, pvaAudits ); SG_VARRAY_NULLFREE(pCtx, pva_tags); SG_VHASH_NULLFREE(pCtx, pvh_result); SG_VARRAY_NULLFREE(pCtx, pva_stamps); SG_VARRAY_NULLFREE(pCtx, pvaTags); SG_VARRAY_NULLFREE(pCtx, pvaComments); SG_VARRAY_NULLFREE(pCtx, pvaChildren); SG_RBTREE_NULLFREE(pCtx, prbChildren); SG_VHASH_NULLFREE(pCtx, pvhParents); } struct _my_history_dagwalk_data { SG_uint32 nResultLimit; SG_stringarray * pStringArrayGIDs; SG_vector * pVectorKnownPaths; SG_vector * pVectorCurrentPathIndex; SG_rbtree * pCandidateChangesets; SG_varray * pArrayReturnResults; SG_bool bHistoryOnRoot; }; void _pending_tree__history__dag_walk_callback(SG_context * pCtx, SG_repo * pRepo, void * myData, SG_dagnode * currentDagnode, SG_rbtree * pDagnodeCache, SG_bool * bContinue) { struct _my_history_dagwalk_data * pData = NULL; SG_uint32 resultsSoFar = 0; SG_UNUSED(pDagnodeCache); pData = (struct _my_history_dagwalk_data*)myData; SG_ERR_CHECK( _sg_history_check_dagnode_for_inclusion(pCtx, pRepo, currentDagnode, pData->bHistoryOnRoot, pData->pStringArrayGIDs, pData->pVectorKnownPaths, pData->pVectorCurrentPathIndex, pData->pCandidateChangesets, pData->pArrayReturnResults) ); SG_ERR_CHECK( SG_varray__count(pCtx, pData->pArrayReturnResults, &resultsSoFar) ); if (resultsSoFar >= pData->nResultLimit) *bContinue = SG_FALSE; return; fail: return; } void SG_tuple_array__build_reverse_lookup__multiple( SG_context * pCtx, SG_varray* pva, const char* psz_field, SG_rbtree** pprb ) { SG_rbtree* prb = NULL; SG_uint32 count = 0; SG_uint32 i = 0; SG_vector* pvec_new = NULL; SG_ERR_CHECK( SG_rbtree__alloc(pCtx, &prb) ); SG_ERR_CHECK( SG_varray__count(pCtx, pva, &count) ); for (i=0; i<count; i++) { SG_vhash* pvh = NULL; const char* psz_val = NULL; SG_vector* pvec = NULL; SG_bool b_already = SG_FALSE; SG_ERR_CHECK( SG_varray__get__vhash(pCtx, pva, i, &pvh) ); SG_ERR_CHECK( SG_vhash__get__sz(pCtx, pvh, psz_field, &psz_val) ); SG_ERR_CHECK( SG_rbtree__find(pCtx, prb, psz_val, &b_already, (void**) &pvec) ); if (!b_already) { SG_ERR_CHECK( SG_vector__alloc(pCtx, &pvec_new, 1) ); SG_ERR_CHECK( SG_rbtree__add__with_assoc(pCtx, prb, psz_val, pvec_new) ); pvec = pvec_new; pvec_new = NULL; } SG_ERR_CHECK( SG_vector__append(pCtx, pvec, pvh, NULL) ); } *pprb = prb; prb = NULL; fail: SG_VECTOR_NULLFREE(pCtx, pvec_new); SG_RBTREE_NULLFREE(pCtx, prb); } void SG_tuple_array__build_reverse_lookup__single( SG_context * pCtx, SG_varray* pva, const char* psz_field, SG_rbtree** pprb ) { SG_rbtree* prb = NULL; SG_uint32 count = 0; SG_uint32 i = 0; SG_ERR_CHECK( SG_rbtree__alloc(pCtx, &prb) ); SG_ERR_CHECK( SG_varray__count(pCtx, pva, &count) ); for (i=0; i<count; i++) { SG_vhash* pvh = NULL; const char* psz_val = NULL; SG_ERR_CHECK( SG_varray__get__vhash(pCtx, pva, i, &pvh) ); SG_ERR_CHECK( SG_vhash__get__sz(pCtx, pvh, psz_field, &psz_val) ); #if 1 && defined(DEBUG) // TODO 2010/06/11 Jeff here. My local db has a duplicate record in the users table. // TODO [g23c8723921b24146854c7af8e18a2cee5d400ca46d8711df996b005056c00001] { SG_bool b_already; SG_vhash * pvh_existing; SG_ERR_CHECK( SG_rbtree__find(pCtx, prb, psz_val, &b_already, (void **) &pvh_existing) ); if (b_already) { SG_ERR_IGNORE( SG_console(pCtx, SG_CS_STDERR, "TODO build_reverse_lookup__single: Duplicate record [%s]\n", psz_val) ); SG_ERR_IGNORE( SG_vhash_debug__dump_to_console__named(pCtx, pvh_existing, "Existing Record") ); SG_ERR_IGNORE( SG_vhash_debug__dump_to_console__named(pCtx, pvh, "New Record") ); } else { SG_ERR_CHECK( SG_rbtree__add__with_assoc(pCtx, prb, psz_val, pvh) ); } } #else SG_ERR_CHECK( SG_rbtree__add__with_assoc(pCtx, prb, psz_val, pvh) ); #endif } *pprb = prb; prb = NULL; fail: SG_RBTREE_NULLFREE(pCtx, prb); } static void sg_history__fill_in_details( SG_context * pCtx, SG_repo * pRepo, SG_varray* pva_history ) { SG_varray* pva_all_audits = NULL; SG_varray* pva_all_users = NULL; SG_varray* pva_all_tags = NULL; SG_varray* pva_all_stamps = NULL; SG_varray* pva_all_comments = NULL; SG_rbtree* prb_all_users = NULL; SG_rbtree* prb_all_audits = NULL; SG_rbtree* prb_all_stamps = NULL; SG_rbtree* prb_all_tags = NULL; SG_rbtree* prb_all_comments = NULL; SG_uint32 count = 0; SG_uint32 i = 0; SG_varray* pva_csid_list__comments = NULL; SG_varray* pva_csid_list__stamps = NULL; SG_varray* pva_csid_list__tags = NULL; SG_varray* pva_csid_list__audits = NULL; SG_ERR_CHECK( SG_varray__alloc(pCtx, &pva_csid_list__comments) ); SG_ERR_CHECK( SG_varray__count(pCtx, pva_history, &count) ); for (i=0; i<count; i++) { SG_vhash* pvh = NULL; const char* psz_csid = NULL; SG_ERR_CHECK( SG_varray__get__vhash(pCtx, pva_history, i, &pvh) ); SG_ERR_CHECK( SG_vhash__get__sz(pCtx, pvh, "changeset_id", &psz_csid) ); SG_ERR_CHECK( SG_varray__append__string__sz(pCtx, pva_csid_list__comments, psz_csid) ); } // TODO it's very silly that we have to make four copies of this list SG_ERR_CHECK( SG_varray__alloc(pCtx, &pva_csid_list__stamps) ); SG_ERR_CHECK( SG_varray__alloc(pCtx, &pva_csid_list__audits) ); SG_ERR_CHECK( SG_varray__alloc(pCtx, &pva_csid_list__tags) ); SG_ERR_CHECK( SG_varray__copy_items(pCtx, pva_csid_list__comments, pva_csid_list__stamps) ); SG_ERR_CHECK( SG_varray__copy_items(pCtx, pva_csid_list__comments, pva_csid_list__audits) ); SG_ERR_CHECK( SG_varray__copy_items(pCtx, pva_csid_list__comments, pva_csid_list__tags) ); // TODO if we're getting all the history, it would be // faster to just call list_all like we did before SG_ERR_CHECK( SG_vc_comments__list_for_given_changesets(pCtx, pRepo, &pva_csid_list__comments, &pva_all_comments) ); SG_ERR_CHECK( SG_audit__list_for_given_changesets(pCtx, pRepo, SG_DAGNUM__VERSION_CONTROL, &pva_csid_list__audits, &pva_all_audits) ); SG_ERR_CHECK( SG_vc_stamps__list_for_given_changesets(pCtx, pRepo, &pva_csid_list__stamps, &pva_all_stamps) ); SG_ERR_CHECK( SG_vc_tags__list_for_given_changesets(pCtx, pRepo, &pva_csid_list__tags, &pva_all_tags) ); SG_ERR_CHECK( SG_user__list_all(pCtx, pRepo, &pva_all_users) ); SG_ERR_CHECK( SG_tuple_array__build_reverse_lookup__single(pCtx, pva_all_users, "recid", &prb_all_users) ); SG_ERR_CHECK( SG_tuple_array__build_reverse_lookup__multiple(pCtx, pva_all_audits, "csid", &prb_all_audits) ); SG_ERR_CHECK( SG_tuple_array__build_reverse_lookup__multiple(pCtx, pva_all_stamps, "csid", &prb_all_stamps) ); SG_ERR_CHECK( SG_tuple_array__build_reverse_lookup__multiple(pCtx, pva_all_tags, "csid", &prb_all_tags) ); SG_ERR_CHECK( SG_tuple_array__build_reverse_lookup__multiple(pCtx, pva_all_comments, "csid", &prb_all_comments) ); SG_ERR_CHECK( SG_varray__count(pCtx, pva_history, &count) ); for (i=0; i<count; i++) { SG_vhash* pvh = NULL; SG_ERR_CHECK( SG_varray__get__vhash(pCtx, pva_history, i, &pvh) ); SG_ERR_CHECK( sg_history__details_for_one_changeset(pCtx, pvh, prb_all_audits, prb_all_stamps, prb_all_tags, prb_all_comments, prb_all_users) ); } fail: SG_RBTREE_NULLFREE(pCtx, prb_all_users); SG_RBTREE_NULLFREE_WITH_ASSOC(pCtx, prb_all_audits, (SG_free_callback*) SG_vector__free); SG_RBTREE_NULLFREE_WITH_ASSOC(pCtx, prb_all_stamps, (SG_free_callback*) SG_vector__free); SG_RBTREE_NULLFREE_WITH_ASSOC(pCtx, prb_all_tags, (SG_free_callback*) SG_vector__free); SG_RBTREE_NULLFREE_WITH_ASSOC(pCtx, prb_all_comments, (SG_free_callback*) SG_vector__free); SG_VARRAY_NULLFREE(pCtx, pva_all_tags); SG_VARRAY_NULLFREE(pCtx, pva_all_users); SG_VARRAY_NULLFREE(pCtx, pva_all_audits); SG_VARRAY_NULLFREE(pCtx, pva_all_stamps); SG_VARRAY_NULLFREE(pCtx, pva_all_comments); } void SG_history__query( SG_context * pCtx, SG_pendingtree * pPendingTree, SG_repo * pRepo, SG_uint32 count_args, const char ** paszArgs, const char * const* pasz_changesets, SG_uint32 nCountChangesets, const char* pStrUser, const char* pStrStamp, SG_uint32 nResultLimit, SG_int64 nFromDate, SG_int64 nToDate, SG_bool bAllLeaves, SG_bool bForceDagWalk, SG_varray ** ppVArrayResults ) { SG_bool bPendingTreeWasPassedIn = SG_FALSE; SG_varray * pVArrayResults = NULL; SG_stringarray * pStringArrayGIDs = NULL; SG_vector * pVectorPathArrays = NULL; //SG_varray * pVArrayCurrentPaths = NULL; SG_pathname * pPathName = NULL; SG_stringarray * pStringArrayPaths = NULL; SG_rbtree * pRBTreeCandidateChangesets = NULL; SG_vector * pVectorCurrentPathIndex = NULL; SG_stringarray * pStringArraySearchNodes = NULL; SG_vhash * pvh_query = NULL; SG_treendx * pTreeNdx = NULL; const char * currentGID = NULL; SG_pathname* pPathCwd = NULL; SG_string* pstr_where = NULL; const SG_varray * pva_wd_parents; SG_stringarray * pstringarray_csids_with_stamps = NULL; SG_bool bFilteredOnUserOrDate = SG_FALSE; SG_dagnode * pdnCurrent = NULL; SG_uint32 candidateCount = 0; SG_bool bUnlimited = SG_FALSE; SG_bool bHistoryOnRoot = SG_FALSE; SG_bool bFreeArgs = SG_FALSE; SG_uint32 i = 0; SG_uint32 arrayIndexReturned = 0; SG_bool bWalkDag = SG_TRUE; if (pPendingTree != NULL) { bPendingTreeWasPassedIn = SG_TRUE; } if (count_args == 0) { bHistoryOnRoot = SG_TRUE; } if (count_args == 1 && nCountChangesets >= 1 && (strcmp(paszArgs[0], "@") == 0 || strcmp(paszArgs[0], "@/") == 0)) { bHistoryOnRoot = SG_TRUE; count_args = 0; } if ((pStrUser == NULL || strcmp(pStrUser, "") == 0) && (pStrStamp == NULL || strcmp(pStrStamp, "") == 0) && nFromDate == 0 && nToDate == SG_INT64_MAX) bUnlimited = SG_TRUE; //Figure out which dagnodes we are starting from. SG_ERR_CHECK( SG_STRINGARRAY__ALLOC(pCtx, &pStringArraySearchNodes, count_args == 0 ? 1 : count_args) ); if (nCountChangesets > 0) { SG_uint32 revLen = nCountChangesets; SG_uint32 k = 0; for (k=0; k < revLen; k++) { SG_ERR_CHECK( SG_stringarray__add(pCtx, pStringArraySearchNodes, pasz_changesets[k]) ); } if (bForceDagWalk != SG_TRUE) //They passed in a flag to force the dag walk. That usually happens from the parents command. bWalkDag = SG_FALSE; } else if (bAllLeaves == SG_TRUE) { void * data = NULL; const char * rbKey = NULL; SG_rbtree * prbtLeaves = NULL; SG_rbtree_iterator * prbtIterator = NULL; SG_bool b = SG_FALSE; SG_ERR_CHECK( SG_repo__fetch_dag_leaves(pCtx, pRepo, SG_DAGNUM__VERSION_CONTROL, &prbtLeaves) ); SG_ERR_CHECK( SG_rbtree__iterator__first(pCtx, &prbtIterator, prbtLeaves, &b, &rbKey, &data) ); while (b) { SG_ERR_CHECK( SG_stringarray__add(pCtx, pStringArraySearchNodes, rbKey) ); SG_ERR_CHECK( SG_rbtree__iterator__next(pCtx, prbtIterator, &b, &rbKey, &data) ); nCountChangesets++; } SG_RBTREE_NULLFREE(pCtx, prbtLeaves); SG_RBTREE_ITERATOR_NULLFREE(pCtx, prbtIterator); } else { SG_bool bIgnoreWarnings = SG_FALSE; SG_uint32 k, nrParents; if (bPendingTreeWasPassedIn == SG_FALSE) { SG_ERR_CHECK( SG_PATHNAME__ALLOC(pCtx, &pPathCwd) ); SG_ERR_CHECK( SG_pathname__set__from_cwd(pCtx, pPathCwd) ); SG_ERR_CHECK( SG_PENDINGTREE__ALLOC(pCtx, pPathCwd, bIgnoreWarnings, &pPendingTree) ); } // TODO 4/20/10 @Jeremy: do you want all of the wd parents in your array? SG_ERR_CHECK( SG_pendingtree__get_wd_parents__ref(pCtx, pPendingTree, &pva_wd_parents) ); SG_ERR_CHECK( SG_varray__count(pCtx, pva_wd_parents, &nrParents) ); SG_ASSERT( (nrParents > 0) ); for (k=0; k<nrParents; k++) { const char * psz_hid_parent_k; SG_ERR_CHECK( SG_varray__get__sz(pCtx, pva_wd_parents, k, &psz_hid_parent_k) ); SG_ERR_CHECK( SG_stringarray__add(pCtx, pStringArraySearchNodes, psz_hid_parent_k) ); } SG_PATHNAME_NULLFREE(pCtx, pPathCwd); } //Now loop over all of the supplied paths, converting them all to GID SG_ERR_CHECK( SG_STRINGARRAY__ALLOC(pCtx, &pStringArrayGIDs, count_args == 0 ? 1 : count_args) ); SG_ERR_CHECK( SG_VECTOR__ALLOC(pCtx, &pVectorPathArrays, count_args == 0 ? 1 : count_args) ); SG_ERR_CHECK( SG_VECTOR__ALLOC(pCtx, &pVectorCurrentPathIndex, count_args == 0 ? 1 : count_args) ); SG_ERR_CHECK( SG_VARRAY__ALLOC(pCtx, &pVArrayResults) ); for (i = 0; i <count_args; i++) { //fill the array index cache with zeroes SG_ERR_CHECK( SG_vector__append(pCtx, pVectorCurrentPathIndex, (void*)0, &arrayIndexReturned ) ); } if (nCountChangesets == 0 && bHistoryOnRoot == SG_FALSE) { //They didn't specify a changeset, so use the pending tree to look up the objects. SG_ERR_CHECK( SG_pendingtree__get_gids_for_paths(pCtx, pPendingTree, count_args, paszArgs, pStringArrayGIDs, &bHistoryOnRoot) ); } else { //This might be used if you have --leaves, or if there are multiple parents //since they specified a changeset, we need to use the full repo path @/blah/blah to look up the objects SG_changeset * pcsSpecified = NULL; const char * pszHidForRoot = NULL; const char * pszCurrentDagnodeID = NULL; char * pszSearchItemGID = NULL; SG_treenode * pTreeNodeRoot = NULL; SG_treenode_entry * ptne = NULL; SG_uint32 revLen = nCountChangesets; SG_uint32 k = 0; for (k=0; k < revLen; k++) { SG_ERR_CHECK( SG_stringarray__get_nth(pCtx, pStringArraySearchNodes, k, &pszCurrentDagnodeID) ); SG_ERR_CHECK( SG_changeset__load_from_repo(pCtx, pRepo, pszCurrentDagnodeID, &pcsSpecified) ); SG_ERR_CHECK( SG_changeset__get_root(pCtx, pcsSpecified, &pszHidForRoot) ); SG_ERR_CHECK( SG_treenode__load_from_repo(pCtx, pRepo, pszHidForRoot, &pTreeNodeRoot) ); if (bHistoryOnRoot) { SG_ERR_CHECK( SG_treenode__find_treenodeentry_by_path(pCtx, pRepo, pTreeNodeRoot, "@", &pszSearchItemGID, &ptne) ); if (pszSearchItemGID == NULL) { SG_TREENODE_NULLFREE(pCtx, pTreeNodeRoot); SG_CHANGESET_NULLFREE(pCtx, pcsSpecified); SG_ERR_THROW( SG_ERR_NOT_FOUND ); } SG_ERR_CHECK( SG_stringarray__add(pCtx, pStringArrayGIDs, pszSearchItemGID) ); SG_NULLFREE(pCtx, pszSearchItemGID); SG_TREENODE_ENTRY_NULLFREE(pCtx, ptne); } else { for (i = 0; i < count_args; i++) { SG_ERR_CHECK( SG_treenode__find_treenodeentry_by_path(pCtx, pRepo, pTreeNodeRoot, paszArgs[i], &pszSearchItemGID, &ptne) ); if (pszSearchItemGID == NULL) { SG_TREENODE_NULLFREE(pCtx, pTreeNodeRoot); SG_CHANGESET_NULLFREE(pCtx, pcsSpecified); SG_ERR_THROW( SG_ERR_NOT_FOUND ); } SG_ERR_CHECK( SG_stringarray__add(pCtx, pStringArrayGIDs, pszSearchItemGID) ); SG_NULLFREE(pCtx, pszSearchItemGID); SG_TREENODE_ENTRY_NULLFREE(pCtx, ptne); } } SG_TREENODE_NULLFREE(pCtx, pTreeNodeRoot); SG_CHANGESET_NULLFREE(pCtx, pcsSpecified); } } //Use the treendx to look up all the paths for the GIDs that we just got. for (i = 0; i < count_args; i++) { SG_ERR_CHECK( SG_stringarray__get_nth(pCtx, pStringArrayGIDs, i, &currentGID) ); SG_ERR_CHECK( SG_repo__treendx__get_all_paths(pCtx, pRepo, SG_DAGNUM__VERSION_CONTROL, currentGID, &pStringArrayPaths) ); SG_ERR_CHECK( SG_vector__append(pCtx, pVectorPathArrays, pStringArrayPaths, &arrayIndexReturned) ); } //We now have two arrays, pVArrayGIDs, which contains a GID for each queried item. //pVectorPathArrays, which must have the same length. if (bWalkDag == SG_FALSE) { //They gave us specific revisions and tags, we need to just output //information about those. SG_uint32 revisionsIndex = 0; SG_uint32 revisionsCount = 0; SG_vhash * pvhCurrent = NULL; SG_ERR_CHECK( SG_stringarray__count(pCtx, pStringArraySearchNodes, &revisionsCount) ); for (revisionsIndex = 0; revisionsIndex < revisionsCount; revisionsIndex++) { SG_ERR_CHECK( SG_stringarray__get_nth(pCtx, pStringArraySearchNodes, revisionsIndex, &currentGID) ); SG_ERR_CHECK( SG_repo__fetch_dagnode(pCtx, pRepo, currentGID, &pdnCurrent) ); SG_ERR_CHECK( SG_VHASH__ALLOC(pCtx, &pvhCurrent) ); SG_ERR_CHECK( SG_history__get_id_and_parents(pCtx, pRepo, pdnCurrent, &pvhCurrent) ); SG_ERR_CHECK( SG_varray__append__vhash(pCtx, pVArrayResults, &pvhCurrent) ); SG_DAGNODE_NULLFREE(pCtx, pdnCurrent); } } else if (bUnlimited == SG_TRUE) { //There are no user or date restrictions, we don't need to build the candidate list at all. //Passing in NULL for the candidate list will trigger the "all changesets are candidates" case. struct _my_history_dagwalk_data myData; myData.nResultLimit = nResultLimit; myData.pArrayReturnResults = pVArrayResults; myData.pCandidateChangesets = NULL; myData.pStringArrayGIDs = pStringArrayGIDs; myData.pVectorCurrentPathIndex = pVectorCurrentPathIndex; myData.pVectorKnownPaths = pVectorPathArrays; myData.bHistoryOnRoot = bHistoryOnRoot; SG_ERR_CHECK( SG_dagwalker__walk_dag(pCtx, pRepo, pStringArraySearchNodes, _pending_tree__history__dag_walk_callback, (void*)&myData) ); // SG_ERR_CHECK( _sg_pendingtree__history__walk_dag(pCtx, pPendingTree, nResultLimit, pStringArraySearchNodes, pStringArrayGIDs, pVectorPathArrays, pVectorCurrentPathIndex, NULL/*pVectorCandidateChangesets*/, pVArrayResults) ); } else { struct _my_history_dagwalk_data myData; SG_int_to_string_buffer buf_min; SG_int_to_string_buffer buf_max; myData.nResultLimit = nResultLimit; myData.pArrayReturnResults = pVArrayResults; myData.pStringArrayGIDs = pStringArrayGIDs; myData.pVectorCurrentPathIndex = pVectorCurrentPathIndex; myData.pVectorKnownPaths = pVectorPathArrays; myData.bHistoryOnRoot = bHistoryOnRoot; if ((pStrUser && pStrUser[0]) || nToDate != SG_INT64_MAX || nFromDate != 0) { bFilteredOnUserOrDate = SG_TRUE; SG_ERR_CHECK( SG_STRING__ALLOC(pCtx, &pstr_where) ); SG_int64_to_sz(nFromDate, buf_min); SG_int64_to_sz(nToDate, buf_max); if (pStrUser && pStrUser[0]) { if (nFromDate != 0) { if (nToDate != SG_INT64_MAX) { SG_ERR_CHECK( SG_string__sprintf( pCtx, pstr_where, "(who == '%s') && ((when >= %s) && (when <= %s))", pStrUser, buf_min, buf_max ) ); } else { SG_ERR_CHECK( SG_string__sprintf( pCtx, pstr_where, "(who == '%s') && (when >= %s)", pStrUser, buf_min ) ); } } else { if (nToDate != SG_INT64_MAX) { SG_ERR_CHECK( SG_string__sprintf( pCtx, pstr_where, "(who == '%s') && (when <= %s)", pStrUser, buf_max ) ); } else { SG_ERR_CHECK( SG_string__sprintf( pCtx, pstr_where, "who == '%s'", pStrUser ) ); } } } else { if (nFromDate != 0) { if (nToDate != SG_INT64_MAX) { SG_ERR_CHECK( SG_string__sprintf( pCtx, pstr_where, "(when >= %s) && (when <= %s)", buf_min, buf_max ) ); } else { SG_ERR_CHECK( SG_string__sprintf( pCtx, pstr_where, "when >= %s", buf_min ) ); } } else { if (nToDate != SG_INT64_MAX) { SG_ERR_CHECK( SG_string__sprintf( pCtx, pstr_where, "when <= %s", buf_max ) ); } else { SG_ERR_CHECK( SG_string__sprintf( pCtx, pstr_where, "" ) ); } } } SG_ERR_CHECK( SG_audit__query(pCtx, pRepo, SG_DAGNUM__VERSION_CONTROL, SG_string__sz(pstr_where), &pRBTreeCandidateChangesets) ); SG_STRING_NULLFREE(pCtx, pstr_where); } //Now filter by stamps. if (pStrStamp != NULL && strcmp(pStrStamp, "") != 0) { SG_ERR_CHECK( SG_vc_stamps__lookup_by_stamp(pCtx, pRepo, pStrStamp, &pstringarray_csids_with_stamps) ); if (pstringarray_csids_with_stamps != NULL) { SG_uint32 csidCount = 0; SG_uint32 csidIndex = 0; SG_bool bAlreadyThere = SG_FALSE; const char * psz_currentcsid = NULL; SG_rbtree * prb_newTree = NULL; SG_ERR_CHECK( SG_stringarray__count(pCtx, pstringarray_csids_with_stamps, &csidCount) ); SG_ERR_CHECK( SG_RBTREE__ALLOC(pCtx, &prb_newTree) ); for (csidIndex = 0; csidIndex < csidCount; csidIndex++) { if (pRBTreeCandidateChangesets == NULL) //There were now SG_ERR_CHECK( SG_RBTREE__ALLOC(pCtx, &pRBTreeCandidateChangesets) ); SG_ERR_CHECK( SG_stringarray__get_nth(pCtx, pstringarray_csids_with_stamps, csidIndex, &psz_currentcsid) ); if (bFilteredOnUserOrDate == SG_TRUE) //We need to look to see if it's already there before adding it to the new rbtree. { SG_ERR_CHECK( SG_rbtree__find(pCtx, pRBTreeCandidateChangesets, psz_currentcsid, &bAlreadyThere, NULL) ); if (bAlreadyThere) SG_ERR_CHECK( SG_rbtree__add(pCtx, prb_newTree, psz_currentcsid) ); } else//We just put our entry in, no matter what. { SG_ERR_CHECK( SG_rbtree__add(pCtx, prb_newTree, psz_currentcsid) ); } } SG_RBTREE_NULLFREE(pCtx, pRBTreeCandidateChangesets); pRBTreeCandidateChangesets = prb_newTree; } } if (pRBTreeCandidateChangesets != NULL) SG_ERR_CHECK( SG_rbtree__count(pCtx, pRBTreeCandidateChangesets, &candidateCount) ); //We now have the GIDs, and the candidate change sets. if (candidateCount > 0) //If there are no candidates, then we don't need to walk the dag at all. { myData.pCandidateChangesets = pRBTreeCandidateChangesets; SG_ERR_CHECK( SG_dagwalker__walk_dag(pCtx, pRepo, pStringArraySearchNodes, _pending_tree__history__dag_walk_callback, (void*)&myData) ); //SG_ERR_CHECK( _sg_pendingtree__history__walk_dag(pCtx, pPendingTree, nResultLimit, pStringArraySearchNodes, pStringArrayGIDs, pVectorPathArrays, pVectorCurrentPathIndex, pRBTreeCandidateChangesets, pVArrayResults) ); } } SG_ERR_CHECK( sg_history__fill_in_details(pCtx, pRepo, pVArrayResults) ); if (bFreeArgs) SG_NULLFREE(pCtx, paszArgs); SG_TREENDX_NULLFREE(pCtx, pTreeNdx); SG_PATHNAME_NULLFREE(pCtx, pPathName); SG_VHASH_NULLFREE(pCtx, pvh_query); SG_STRINGARRAY_NULLFREE(pCtx, pStringArrayGIDs); SG_STRINGARRAY_NULLFREE(pCtx, pStringArraySearchNodes); SG_VECTOR_NULLFREE(pCtx, pVectorCurrentPathIndex); SG_RBTREE_NULLFREE(pCtx, pRBTreeCandidateChangesets); SG_VECTOR_NULLFREE_WITH_ASSOC(pCtx, pVectorPathArrays, (SG_free_callback *)SG_stringarray__free); SG_VECTOR_NULLFREE(pCtx, pVectorPathArrays); if (bPendingTreeWasPassedIn == SG_FALSE) SG_PENDINGTREE_NULLFREE(pCtx, pPendingTree); SG_STRINGARRAY_NULLFREE(pCtx, pstringarray_csids_with_stamps); SG_DAGNODE_NULLFREE(pCtx, pdnCurrent); //SG_STRINGARRAY_NULLFREE(pCtx, pStringArrayPaths); *ppVArrayResults = pVArrayResults; return; fail: SG_STRING_NULLFREE(pCtx, pstr_where); if (bFreeArgs) SG_NULLFREE(pCtx, paszArgs); SG_TREENDX_NULLFREE(pCtx, pTreeNdx); SG_PATHNAME_NULLFREE(pCtx, pPathName); SG_VECTOR_NULLFREE(pCtx, pVectorPathArrays); SG_VHASH_NULLFREE(pCtx, pvh_query); SG_STRINGARRAY_NULLFREE(pCtx, pStringArrayGIDs); SG_VECTOR_NULLFREE(pCtx, pVectorCurrentPathIndex); SG_STRINGARRAY_NULLFREE(pCtx, pStringArraySearchNodes); SG_RBTREE_NULLFREE(pCtx, pRBTreeCandidateChangesets); SG_VECTOR_NULLFREE_WITH_ASSOC(pCtx, pVectorPathArrays, (SG_free_callback *)SG_stringarray__free); SG_PENDINGTREE_NULLFREE(pCtx, pPendingTree); //SG_STRINGARRAY_NULLFREE(pCtx, pStringArrayPaths); SG_VARRAY_NULLFREE(pCtx, pVArrayResults); SG_PATHNAME_NULLFREE(pCtx, pPathCwd); SG_DAGNODE_NULLFREE(pCtx, pdnCurrent); SG_STRINGARRAY_NULLFREE(pCtx, pstringarray_csids_with_stamps); }
38.043171
305
0.679732
[ "vector" ]
b43f982a473656dec93d0ef7706994a5be93e0ac
5,529
h
C
Source/HDK_GeometricCGPoissonSolver.h
rgoldade/GeometricMultigridPressureSolver
fee1470a3b7f8536de9c53a8526836e998197483
[ "MIT" ]
8
2019-10-03T17:10:33.000Z
2020-12-30T01:31:05.000Z
Source/HDK_GeometricCGPoissonSolver.h
rgoldade/GeometricMultiGridPressureSolver
fee1470a3b7f8536de9c53a8526836e998197483
[ "MIT" ]
2
2019-12-22T20:49:50.000Z
2020-09-05T17:00:19.000Z
Source/HDK_GeometricCGPoissonSolver.h
rgoldade/GeometricMultiGridPressureSolver
fee1470a3b7f8536de9c53a8526836e998197483
[ "MIT" ]
2
2019-10-03T05:02:15.000Z
2020-06-29T04:17:47.000Z
#ifndef HDK_GEOMETRIC_CONJUGATE_GRADIENT_SOLVER_H #define HDK_GEOMETRIC_CONJUGATE_GRADIENT_SOLVER_H #include <UT/UT_StopWatch.h> #include "HDK_GeometricMultigridOperators.h" namespace HDK { template<typename MatrixVectorMultiplyFunctor, typename PreconditionerFunctor, typename DotProductFunctor, typename SquaredL2NormFunctor, typename AddToVectorFunctor, typename AddScaledVectorFunctor, typename StoreReal> void solveGeometricConjugateGradient(UT_VoxelArray<StoreReal> &solutionGrid, const UT_VoxelArray<StoreReal> &rhsGrid, const MatrixVectorMultiplyFunctor &matrixVectorMultiplyFunctor, const PreconditionerFunctor &preconditionerFunctor, const DotProductFunctor &dotProductFunctor, const SquaredL2NormFunctor &squaredNormFunctor, const AddToVectorFunctor &addToVectorFunctor, const AddScaledVectorFunctor &addScaledVectorFunctor, const StoreReal tolerance, const int maxIterations) { using namespace GeometricMultigridOperators; using SolveReal = double; UT_Vector3I voxelRes = solutionGrid.getVoxelRes(); assert(solutionGrid.getVoxelRes() == rhsGrid.getVoxelRes()); SolveReal rhsNorm2 = squaredNormFunctor(rhsGrid); if (rhsNorm2 == 0) { std::cout << "RHS is zero. Nothing to solve" << std::endl; return; } // Build initial residual vector using an initial guess UT_VoxelArray<StoreReal> residualGrid; residualGrid.size(voxelRes[0], voxelRes[1], voxelRes[2]); { UT_StopWatch timer; timer.start(); matrixVectorMultiplyFunctor(residualGrid, solutionGrid); addScaledVectorFunctor(residualGrid, rhsGrid, residualGrid, -1); auto time = timer.stop(); std::cout << " Compute initial residual time: " << time << std::endl; } SolveReal residualNorm2 = squaredNormFunctor(residualGrid); SolveReal threshold = SolveReal(tolerance) * SolveReal(tolerance) * rhsNorm2; if (residualNorm2 < threshold) { std::cout << "Residual already below error: " << SYSsqrt(residualNorm2 / rhsNorm2) << std::endl; return; } // Apply preconditioner for initial search direction UT_VoxelArray<StoreReal> pGrid; pGrid.size(voxelRes[0], voxelRes[1], voxelRes[2]); pGrid.constant(0); { UT_StopWatch timer; timer.start(); preconditionerFunctor(pGrid, residualGrid); auto time = timer.stop(); std::cout << " Apply initial preconditioner time: " << time << std::endl; } SolveReal absNew; { UT_StopWatch timer; timer.start(); absNew = dotProductFunctor(pGrid, residualGrid); auto time = timer.stop(); std::cout << " Initial dot product time: " << time << std::endl; } UT_VoxelArray<StoreReal> zGrid; zGrid.size(voxelRes[0], voxelRes[1], voxelRes[2]); zGrid.constant(0); UT_VoxelArray<StoreReal> tempGrid; tempGrid.size(voxelRes[0], voxelRes[1], voxelRes[2]); tempGrid.constant(0); int iteration = 0; for (; iteration < maxIterations; ++iteration) { std::cout << " Iteration: " << iteration << std::endl; { UT_StopWatch timer; timer.start(); // Matrix-vector multiplication matrixVectorMultiplyFunctor(tempGrid, pGrid); auto time = timer.stop(); std::cout << " Matrix-vector multiply time: " << time << std::endl; } SolveReal alpha; { UT_StopWatch timer; timer.start(); alpha = absNew / dotProductFunctor(pGrid, tempGrid); auto time = timer.stop(); std::cout << " Alpha dot product time: " << time << std::endl; } { UT_StopWatch timer; timer.start(); // Update solution addToVectorFunctor(solutionGrid, pGrid, alpha); auto time = timer.stop(); std::cout << " Update solution time: " << time << std::endl; } { UT_StopWatch timer; timer.start(); // Update residual addToVectorFunctor(residualGrid, tempGrid, -alpha); auto time = timer.stop(); std::cout << " Update residual time: " << time << std::endl; } { UT_StopWatch timer; timer.start(); residualNorm2 = squaredNormFunctor(residualGrid); auto time = timer.stop(); std::cout << " L-2 norm time: " << time << std::endl; } std::cout << " Relative error: " << SYSsqrt(residualNorm2 / rhsNorm2) << std::endl; if (residualNorm2 < threshold) break; { UT_StopWatch timer; timer.start(); preconditionerFunctor(zGrid, residualGrid); auto time = timer.stop(); std::cout << " Apply preconditioner time: " << time << std::endl; } SolveReal absOld = absNew; SolveReal beta; { UT_StopWatch timer; timer.start(); absNew = dotProductFunctor(zGrid, residualGrid); beta = absNew / absOld; auto time = timer.stop(); std::cout << " Apply dot product: " << time << std::endl; } { UT_StopWatch timer; timer.start(); addScaledVectorFunctor(pGrid, zGrid, pGrid, beta); auto time = timer.stop(); std::cout << " Update search direction: " << time << std::endl; } } std::cout << "Iterations: " << iteration << std::endl; SolveReal error = SYSsqrt(residualNorm2 / rhsNorm2); std::cout << "Drifted relative L2 Error: " << error << std::endl; // Recompute residual matrixVectorMultiplyFunctor(residualGrid, solutionGrid); addScaledVectorFunctor(residualGrid, rhsGrid, residualGrid, -1); error = SYSsqrt(squaredNormFunctor(residualGrid) / rhsNorm2); std::cout << "Recomputed relative L2 Error: " << error << std::endl; } } #endif
26.328571
101
0.66956
[ "vector" ]
b4448460b6101e8945db6b78d7cc3025282736da
6,533
c
C
code/weapon/weapon_projectile.c
3RUN/Retro-FPS
638a2dc5555c864a58aca5f1ae05d8fad9909791
[ "MIT" ]
6
2019-08-02T20:23:34.000Z
2022-01-20T05:33:45.000Z
code/weapon/weapon_projectile.c
3RUN/Retro-FPS
638a2dc5555c864a58aca5f1ae05d8fad9909791
[ "MIT" ]
1
2021-02-11T16:55:59.000Z
2021-02-11T16:55:59.000Z
code/weapon/weapon_projectile.c
3RUN/Retro-FPS
638a2dc5555c864a58aca5f1ae05d8fad9909791
[ "MIT" ]
1
2019-08-04T13:07:00.000Z
2019-08-04T13:07:00.000Z
// melee attack func void melee_func() { set(my, PASSABLE | INVISIBLE); my->OBJ_TIMER = 16; my->group = PROJECTILE_GROUP; my->push = PROJECTILE_GROUP; } // create melee attack trace void melee_create(VECTOR *pos, VECTOR *angle, var type_, var group_, var damage_) { ENTITY *projectile_ent = ent_create(NULL, pos, melee_func); vec_set(&projectile_ent->WPN_ORIGIN_X, pos); vec_set(&projectile_ent->WPN_DIR_X, vector(WPN_MELEE_DISTANCE, 0, 0)); vec_rotate(&projectile_ent->WPN_DIR_X, angle); vec_add(&projectile_ent->WPN_DIR_X, &projectile_ent->WPN_ORIGIN_X); projectile_ent->WPN_OWNER_GROUP = group_; projectile_ent->OBJ_TAKE_DAMAGE = damage_; projectile_ent->OBJ_TYPE = type_; projectile_ent = NULL; } // update melee attack void melee_update(ENTITY *ent) { c_ignore(SWITCH_ITEM_GROUP, PROJECTILE_GROUP, ent->WPN_OWNER_GROUP, SHOOT_THROUGH_GROUP, 0); ent_trace(ent, &ent->x, &ent->WPN_DIR_X, TRACE_FLAGS | ACTIVATE_SHOOT | USE_POLYGON); if (HIT_TARGET) { projectile_impact_function(you); } ent_delete(ent); } // create visual projectile sprite for the given entity void projectile_create_sprite(ENTITY *ent, var size_) { if (!ent) { error("There is no projectile to create bullet for!"); return; } ent->parent = ent_create(projectile_tga, &ent->x, NULL); vec_fill(&ent->parent->scale_x, size_); set(ent->parent, PASSABLE | NOFILTER | UNLIT | LIGHT); vec_fill(&ent->parent->blue, 255); ent->parent->ambient = 100; ent->parent->material = mtl_z_write; } // bullet function void bullet_func() { set(my, PASSABLE | INVISIBLE); my->OBJ_STATE = WPN_PROJ_FLY; my->OBJ_TIMER = 16; my->group = PROJECTILE_GROUP; my->push = PROJECTILE_GROUP; } // create bullets void bullet_create(VECTOR *pos, VECTOR *angle, var type_, var group_, var damage_, var speed_, var accuracy_, var size_) { ENTITY *projectile_ent = ent_create(NULL, pos, bullet_func); vec_set(&projectile_ent->WPN_ORIGIN_X, pos); vec_set(&projectile_ent->WPN_DIR_X, vector(speed_, (random(accuracy_ * 2) - accuracy_), (random(accuracy_ * 2) - accuracy_))); vec_rotate(&projectile_ent->WPN_DIR_X, angle); projectile_ent->WPN_OWNER_GROUP = group_; projectile_ent->OBJ_TAKE_DAMAGE = damage_; projectile_ent->OBJ_TYPE = type_; projectile_create_sprite(projectile_ent, size_); projectile_ent = NULL; } // function to update given bullet void bullet_update(ENTITY *ent) { // simply flying ? if (ent->OBJ_STATE == WPN_PROJ_FLY) { vec_set(&ent->WPN_VEL_X, &ent->WPN_DIR_X); vec_scale(&ent->WPN_VEL_X, time_step); vec_add(&ent->WPN_VEL_X, &ent->WPN_ORIGIN_X); c_ignore(SWITCH_ITEM_GROUP, PROJECTILE_GROUP, ent->WPN_OWNER_GROUP, SHOOT_THROUGH_GROUP, 0); ent_trace(ent, &ent->WPN_ORIGIN_X, &ent->WPN_VEL_X, TRACE_FLAGS | ACTIVATE_SHOOT | USE_POLYGON); if (HIT_TARGET) { projectile_impact_function(you); ent->OBJ_TIMER = -1; // kill us } vec_set(&ent->WPN_ORIGIN_X, &ent->WPN_VEL_X); // if we run out of time, delete projectile ent->OBJ_TIMER -= time_step; if (ent->OBJ_TIMER <= 0) { ent->OBJ_STATE = WPN_PROJ_DELETE; } } // remove projectile if (ent->OBJ_STATE == WPN_PROJ_DELETE) { ent_delete(ent->parent); ent_delete(ent); } if (ent->parent) { vec_set(&ent->parent->x, &ent->WPN_VEL_X); ent_rotate_to_camera(ent->parent); } } // rocket's func void rocket_func() { vec_fill(&my->scale_x, 0.125); c_setminmax(my); set(my, INVISIBLE); my->OBJ_STATE = WPN_PROJ_FLY; my->OBJ_TIMER = 32; my->group = PROJECTILE_GROUP; my->push = PROJECTILE_GROUP; } // create rocket void rocket_create(VECTOR *pos, VECTOR *angle, var type_, var group_, var damage_, var speed_, var size_) { ENTITY *projectile_ent = ent_create(bbox_props_mdl, pos, rocket_func); vec_set(&projectile_ent->pan, angle); projectile_ent->OBJ_ALLOW_MOVE = speed_; projectile_ent->WPN_OWNER_GROUP = group_; projectile_ent->OBJ_TAKE_DAMAGE = damage_; projectile_ent->OBJ_TYPE = type_; projectile_create_sprite(projectile_ent, size_); projectile_ent = NULL; } // function to update rockets void rocket_update(ENTITY *ent) { // simply flying ? if (ent->OBJ_STATE == WPN_PROJ_FLY) { c_ignore(SWITCH_ITEM_GROUP, PROJECTILE_GROUP, ent->WPN_OWNER_GROUP, SHOOT_THROUGH_GROUP, 0); c_move(ent, vector(ent->OBJ_ALLOW_MOVE * time_step, 0, 0), nullvector, MOVE_FLAGS | ACTIVATE_SHOOT | USE_POLYGON); if (HIT_TARGET) { // place slightly above the surface vec_set(&ent->WPN_ORIGIN_X, vector(2, 0, 0)); vec_to_angle(&ent->WPN_DIR_X, &normal); vec_rotate(&ent->WPN_ORIGIN_X, &ent->WPN_DIR_X); vec_add(&ent->WPN_ORIGIN_X, &hit->x); ent->OBJ_TIMER = -1; // kill projectile } // if far enough from camera if (vec_dist(&camera->x, &ent->x) > 64) { ent->OBJ_PAIN_TYPE = 1; // use this in order to enable smoketrail effect } if (ent->OBJ_PAIN_TYPE == 1) { effect(smoketrail_particle, 4, &ent->x, nullvector); } // if rocket runs out of time, then remove it // this may happen if we f.e. shoot it in the air etc. ent->OBJ_TIMER -= time_step; if (ent->OBJ_TIMER <= 0) { ent->OBJ_STATE = WPN_PROJ_DELETE; } } // remove rocket if (ent->OBJ_STATE == WPN_PROJ_DELETE) { explosion_create(&ent->WPN_ORIGIN_X, false, ent->OBJ_TYPE); ent_delete(ent->parent); ent_delete(ent); } if (ent->parent) { vec_set(&ent->parent->x, &ent->x); ent_rotate_to_camera(ent->parent); } } // update all projectiles in this function void projectiles_update() { ENTITY *ent; for (ent = ent_next(NULL); ent; ent = ent_next(ent)) { if (ent->OBJ_TYPE == TYPE_PLAYER_MELEE || ent->OBJ_TYPE == TYPE_NPC_MELEE) { melee_update(ent); } if (ent->OBJ_TYPE == TYPE_PLAYER_BULLET || ent->OBJ_TYPE == TYPE_NPC_BULLET) { bullet_update(ent); } if (ent->OBJ_TYPE == TYPE_PLAYER_ROCKET || ent->OBJ_TYPE == TYPE_NPC_ROCKET) { rocket_update(ent); } } }
29.96789
130
0.635236
[ "vector" ]
b44dd789c7f30738d2e3d3cb2a8fa299db6b39df
1,708
h
C
GTD/src/GTD/Game/ECS/Controllable.h
dunn0052/GTD
24081069c4418ea7357301dc02ab417aff9990d7
[ "Apache-2.0" ]
null
null
null
GTD/src/GTD/Game/ECS/Controllable.h
dunn0052/GTD
24081069c4418ea7357301dc02ab417aff9990d7
[ "Apache-2.0" ]
null
null
null
GTD/src/GTD/Game/ECS/Controllable.h
dunn0052/GTD
24081069c4418ea7357301dc02ab417aff9990d7
[ "Apache-2.0" ]
null
null
null
#pragma once #include "IComponent.h" #include "../../Util/JoypadCodes.h" #include "../../Util/KeyCodes.h" #include "../../Util/MouseCodes.h" #include "../../Util/Utils.h" #include "../../include/ControllerCodes.h" #include "../../include/ContextCodes.h" #include "../../include/Controllers.h" #include "../../include/ControllerProp.h" #include "../../include/Core.h" #include "../../include/Timestep.h" namespace GTD { struct ControlCallbackParams { Timestep dt; void* object; }; typedef void (*ButtonActionCallback)(const ControlCallbackParams&, unsigned char status); typedef void (*AxisActionCallback)(const ControlCallbackParams&, float axis); class Controllable : public IComponent { public: //Controllable(const XboxController& controller); GTD_API Controllable(const XboxController* controller); GTD_API virtual ~Controllable() {}; GTD_API virtual void Init() override; GTD_API virtual void Update() override; GTD_API virtual void Activation(bool activate) override; GTD_API virtual COMPONENTS GetType() const override { return COMPONENTS::CONTROLLABLE; }; GTD_API void Do(Button button); // could be private GTD_API void Do(ContextAxis axis); // could be private GTD_API void SetAction(const ContextCode& button, const ButtonActionCallback& action, const ControlCallbackParams& params); GTD_API void AddAction(const ContextAxis& button, const AxisActionCallback& action, const ControlCallbackParams& params); private: bool m_Active = false; std::unordered_map<ContextCode, std::function<void(unsigned char)>> m_ButtonCallbacks; std::unordered_map<ContextAxis, std::function<void(float)>> m_AxisActions; const XboxController* m_Controller; }; }
32.226415
125
0.745316
[ "object" ]
b4567d68302816a69a3f4a54bc2cc939832cf56f
17,210
h
C
third_party/gstreamer/gst/gst_private.h
isabella232/aistreams
209f4385425405676a581a749bb915e257dbc1c1
[ "Apache-2.0" ]
6
2020-09-22T18:07:15.000Z
2021-10-21T01:34:04.000Z
third_party/gstreamer/gst/gst_private.h
isabella232/aistreams
209f4385425405676a581a749bb915e257dbc1c1
[ "Apache-2.0" ]
2
2020-11-10T13:17:39.000Z
2022-03-30T11:22:14.000Z
third_party/gstreamer/gst/gst_private.h
isabella232/aistreams
209f4385425405676a581a749bb915e257dbc1c1
[ "Apache-2.0" ]
3
2020-09-26T08:40:35.000Z
2021-10-21T01:33:56.000Z
/* GStreamer * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu> * 2000 Wim Taymans <wtay@chello.be> * * gst_private.h: Private header for within libgst * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef __GST_PRIVATE_H__ #define __GST_PRIVATE_H__ #ifdef HAVE_CONFIG_H # ifndef GST_LICENSE /* don't include config.h twice, it has no guards */ # include "config.h" # endif #endif /* This needs to be before glib.h, since it might be used in inline * functions */ extern const char g_log_domain_gstreamer[]; #include <glib.h> #include <stdlib.h> #include <string.h> /* Needed for GST_API */ #include "gst/gstconfig.h" /* Needed for GstRegistry * */ #include "gstregistry.h" #include "gststructure.h" /* we need this in pretty much all files */ #include "gstinfo.h" /* for the flags in the GstPluginDep structure below */ #include "gstplugin.h" /* for the pad cache */ #include "gstpad.h" /* for GstElement */ #include "gstelement.h" /* for GstDeviceProvider */ #include "gstdeviceprovider.h" /* for GstToc */ #include "gsttoc.h" #include "gstdatetime.h" #include "gsttracerutils.h" G_BEGIN_DECLS /* used by gstparse.c and grammar.y */ struct _GstParseContext { GList * missing_elements; }; /* used by gstplugin.c and gstregistrybinary.c */ typedef struct { /* details registered via gst_plugin_add_dependency() */ GstPluginDependencyFlags flags; gchar **env_vars; gchar **paths; gchar **names; /* information saved from the last time the plugin was loaded (-1 = unset) */ guint env_hash; /* hash of content of environment variables in env_vars */ guint stat_hash; /* hash of stat() on all relevant files and directories */ } GstPluginDep; struct _GstPluginPrivate { GList *deps; /* list of GstPluginDep structures */ GstStructure *cache_data; }; /* Needed by GstMeta (to access meta seq) and GstBuffer (create/free/iterate) */ typedef struct _GstMetaItem GstMetaItem; struct _GstMetaItem { GstMetaItem *next; guint64 seq_num; GstMeta meta; }; /* FIXME: could rename all priv_gst_* functions to __gst_* now */ G_GNUC_INTERNAL gboolean priv_gst_plugin_loading_have_whitelist (void); G_GNUC_INTERNAL guint32 priv_gst_plugin_loading_get_whitelist_hash (void); G_GNUC_INTERNAL gboolean priv_gst_plugin_desc_is_whitelisted (const GstPluginDesc * desc, const gchar * filename); G_GNUC_INTERNAL gboolean _priv_plugin_deps_env_vars_changed (GstPlugin * plugin); G_GNUC_INTERNAL gboolean _priv_plugin_deps_files_changed (GstPlugin * plugin); G_GNUC_INTERNAL gboolean _priv_gst_in_valgrind (void); /* init functions called from gst_init(). */ G_GNUC_INTERNAL void _priv_gst_quarks_initialize (void); G_GNUC_INTERNAL void _priv_gst_mini_object_initialize (void); G_GNUC_INTERNAL void _priv_gst_memory_initialize (void); G_GNUC_INTERNAL void _priv_gst_allocator_initialize (void); G_GNUC_INTERNAL void _priv_gst_buffer_initialize (void); G_GNUC_INTERNAL void _priv_gst_buffer_list_initialize (void); G_GNUC_INTERNAL void _priv_gst_structure_initialize (void); G_GNUC_INTERNAL void _priv_gst_caps_initialize (void); G_GNUC_INTERNAL void _priv_gst_caps_features_initialize (void); G_GNUC_INTERNAL void _priv_gst_event_initialize (void); G_GNUC_INTERNAL void _priv_gst_format_initialize (void); G_GNUC_INTERNAL void _priv_gst_message_initialize (void); G_GNUC_INTERNAL void _priv_gst_meta_initialize (void); G_GNUC_INTERNAL void _priv_gst_plugin_initialize (void); G_GNUC_INTERNAL void _priv_gst_query_initialize (void); G_GNUC_INTERNAL void _priv_gst_sample_initialize (void); G_GNUC_INTERNAL void _priv_gst_tag_initialize (void); G_GNUC_INTERNAL void _priv_gst_value_initialize (void); G_GNUC_INTERNAL void _priv_gst_debug_init (void); G_GNUC_INTERNAL void _priv_gst_context_initialize (void); G_GNUC_INTERNAL void _priv_gst_toc_initialize (void); G_GNUC_INTERNAL void _priv_gst_date_time_initialize (void); /* cleanup functions called from gst_deinit(). */ G_GNUC_INTERNAL void _priv_gst_allocator_cleanup (void); G_GNUC_INTERNAL void _priv_gst_caps_features_cleanup (void); G_GNUC_INTERNAL void _priv_gst_caps_cleanup (void); G_GNUC_INTERNAL void _priv_gst_debug_cleanup (void); /* called from gst_task_cleanup_all(). */ G_GNUC_INTERNAL void _priv_gst_element_cleanup (void); /* Private registry functions */ G_GNUC_INTERNAL gboolean _priv_gst_registry_remove_cache_plugins (GstRegistry *registry); G_GNUC_INTERNAL void _priv_gst_registry_cleanup (void); GST_API gboolean _gst_plugin_loader_client_run (void); G_GNUC_INTERNAL GstPlugin * _priv_gst_plugin_load_file_for_registry (const gchar *filename, GstRegistry * registry, GError** error); /* GValue serialization/deserialization */ G_GNUC_INTERNAL const char * _priv_gst_value_gtype_to_abbr (GType type); G_GNUC_INTERNAL gboolean _priv_gst_value_parse_string (gchar * s, gchar ** end, gchar ** next, gboolean unescape); G_GNUC_INTERNAL gboolean _priv_gst_value_parse_simple_string (gchar * str, gchar ** end); G_GNUC_INTERNAL gboolean _priv_gst_value_parse_value (gchar * str, gchar ** after, GValue * value, GType default_type); G_GNUC_INTERNAL gchar * _priv_gst_value_serialize_any_list (const GValue * value, const gchar * begin, const gchar * end, gboolean print_type); /* Used in GstBin for manual state handling */ G_GNUC_INTERNAL void _priv_gst_element_state_changed (GstElement *element, GstState oldstate, GstState newstate, GstState pending); /* used in both gststructure.c and gstcaps.c; numbers are completely made up */ #define STRUCTURE_ESTIMATED_STRING_LEN(s) (16 + gst_structure_n_fields(s) * 22) #define FEATURES_ESTIMATED_STRING_LEN(s) (16 + gst_caps_features_get_size(s) * 14) G_GNUC_INTERNAL gboolean priv_gst_structure_append_to_gstring (const GstStructure * structure, GString * s); G_GNUC_INTERNAL gboolean priv__gst_structure_append_template_to_gstring (GQuark field_id, const GValue *value, gpointer user_data); G_GNUC_INTERNAL void priv_gst_caps_features_append_to_gstring (const GstCapsFeatures * features, GString *s); G_GNUC_INTERNAL gboolean priv_gst_structure_parse_name (gchar * str, gchar **start, gchar ** end, gchar ** next); G_GNUC_INTERNAL gboolean priv_gst_structure_parse_fields (gchar *str, gchar ** end, GstStructure *structure); /* used in gstvalue.c and gststructure.c */ #define GST_WRAPPED_PTR_FORMAT "p\aa" G_GNUC_INTERNAL gchar *priv_gst_string_take_and_wrap (gchar * s); /* registry cache backends */ G_GNUC_INTERNAL gboolean priv_gst_registry_binary_read_cache (GstRegistry * registry, const char *location); G_GNUC_INTERNAL gboolean priv_gst_registry_binary_write_cache (GstRegistry * registry, GList * plugins, const char *location); G_GNUC_INTERNAL void __gst_element_factory_add_static_pad_template (GstElementFactory * elementfactory, GstStaticPadTemplate * templ); G_GNUC_INTERNAL void __gst_element_factory_add_interface (GstElementFactory * elementfactory, const gchar * interfacename); /* used in gstvalue.c and gststructure.c */ #define GST_ASCII_IS_STRING(c) (g_ascii_isalnum((c)) || ((c) == '_') || \ ((c) == '-') || ((c) == '+') || ((c) == '/') || ((c) == ':') || \ ((c) == '.')) /* This is only meant for internal uses */ G_GNUC_INTERNAL gint __gst_date_time_compare (const GstDateTime * dt1, const GstDateTime * dt2); G_GNUC_INTERNAL gchar * __gst_date_time_serialize (GstDateTime * datetime, gboolean with_usecs); /* For use in gstdebugutils */ G_GNUC_INTERNAL GstCapsFeatures * __gst_caps_get_features_unchecked (const GstCaps * caps, guint idx); #ifndef GST_DISABLE_REGISTRY /* Secret variable to initialise gst without registry cache */ GST_API gboolean _gst_disable_registry_cache; #endif /* Secret variable to let the plugin scanner use the same base path * as the main application in order to determine dependencies */ GST_API gchar *_gst_executable_path; /* provide inline gst_g_value_get_foo_unchecked(), used in gststructure.c */ #define DEFINE_INLINE_G_VALUE_GET_UNCHECKED(ret_type,name_type,v_field) \ static inline ret_type \ gst_g_value_get_##name_type##_unchecked (const GValue *value) \ { \ return value->data[0].v_field; \ } DEFINE_INLINE_G_VALUE_GET_UNCHECKED(gboolean,boolean,v_int) DEFINE_INLINE_G_VALUE_GET_UNCHECKED(gint,int,v_int) DEFINE_INLINE_G_VALUE_GET_UNCHECKED(guint,uint,v_uint) DEFINE_INLINE_G_VALUE_GET_UNCHECKED(gint64,int64,v_int64) DEFINE_INLINE_G_VALUE_GET_UNCHECKED(guint64,uint64,v_uint64) DEFINE_INLINE_G_VALUE_GET_UNCHECKED(gfloat,float,v_float) DEFINE_INLINE_G_VALUE_GET_UNCHECKED(gdouble,double,v_double) DEFINE_INLINE_G_VALUE_GET_UNCHECKED(const gchar *,string,v_pointer) /*** debugging categories *****************************************************/ #ifndef GST_REMOVE_GST_DEBUG GST_API GstDebugCategory *GST_CAT_GST_INIT; GST_API GstDebugCategory *GST_CAT_MEMORY; GST_API GstDebugCategory *GST_CAT_PARENTAGE; GST_API GstDebugCategory *GST_CAT_STATES; GST_API GstDebugCategory *GST_CAT_SCHEDULING; GST_API GstDebugCategory *GST_CAT_BUFFER; GST_API GstDebugCategory *GST_CAT_BUFFER_LIST; GST_API GstDebugCategory *GST_CAT_BUS; GST_API GstDebugCategory *GST_CAT_CAPS; GST_API GstDebugCategory *GST_CAT_CLOCK; GST_API GstDebugCategory *GST_CAT_ELEMENT_PADS; GST_API GstDebugCategory *GST_CAT_PADS; GST_API GstDebugCategory *GST_CAT_PERFORMANCE; GST_API GstDebugCategory *GST_CAT_PIPELINE; GST_API GstDebugCategory *GST_CAT_PLUGIN_LOADING; GST_API GstDebugCategory *GST_CAT_PLUGIN_INFO; GST_API GstDebugCategory *GST_CAT_PROPERTIES; GST_API GstDebugCategory *GST_CAT_NEGOTIATION; GST_API GstDebugCategory *GST_CAT_REFCOUNTING; GST_API GstDebugCategory *GST_CAT_ERROR_SYSTEM; GST_API GstDebugCategory *GST_CAT_EVENT; GST_API GstDebugCategory *GST_CAT_MESSAGE; GST_API GstDebugCategory *GST_CAT_PARAMS; GST_API GstDebugCategory *GST_CAT_CALL_TRACE; GST_API GstDebugCategory *GST_CAT_SIGNAL; GST_API GstDebugCategory *GST_CAT_PROBE; GST_API GstDebugCategory *GST_CAT_REGISTRY; GST_API GstDebugCategory *GST_CAT_QOS; GST_API GstDebugCategory *GST_CAT_META; GST_API GstDebugCategory *GST_CAT_LOCKING; GST_API GstDebugCategory *GST_CAT_CONTEXT; /* Categories that should be completely private to * libgstreamer should be done like this: */ #define GST_CAT_POLL _priv_GST_CAT_POLL extern GstDebugCategory *_priv_GST_CAT_POLL; #define GST_CAT_PROTECTION _priv_GST_CAT_PROTECTION extern GstDebugCategory *_priv_GST_CAT_PROTECTION; extern GstClockTime _priv_gst_start_time; #else #define GST_CAT_GST_INIT NULL #define GST_CAT_AUTOPLUG NULL #define GST_CAT_AUTOPLUG_ATTEMPT NULL #define GST_CAT_PARENTAGE NULL #define GST_CAT_STATES NULL #define GST_CAT_SCHEDULING NULL #define GST_CAT_DATAFLOW NULL #define GST_CAT_BUFFER NULL #define GST_CAT_BUFFER_LIST NULL #define GST_CAT_BUS NULL #define GST_CAT_CAPS NULL #define GST_CAT_CLOCK NULL #define GST_CAT_ELEMENT_PADS NULL #define GST_CAT_PADS NULL #define GST_CAT_PERFORMANCE NULL #define GST_CAT_PIPELINE NULL #define GST_CAT_PLUGIN_LOADING NULL #define GST_CAT_PLUGIN_INFO NULL #define GST_CAT_PROPERTIES NULL #define GST_CAT_NEGOTIATION NULL #define GST_CAT_REFCOUNTING NULL #define GST_CAT_ERROR_SYSTEM NULL #define GST_CAT_EVENT NULL #define GST_CAT_MESSAGE NULL #define GST_CAT_PARAMS NULL #define GST_CAT_CALL_TRACE NULL #define GST_CAT_SIGNAL NULL #define GST_CAT_PROBE NULL #define GST_CAT_REGISTRY NULL #define GST_CAT_QOS NULL #define GST_CAT_TYPES NULL #define GST_CAT_POLL NULL #define GST_CAT_META NULL #define GST_CAT_LOCKING NULL #define GST_CAT_CONTEXT NULL #define GST_CAT_PROTECTION NULL #endif #ifdef GST_DISABLE_GST_DEBUG /* for _gst_element_error_printf */ #define __gst_vasprintf __gst_info_fallback_vasprintf int __gst_vasprintf (char **result, char const *format, va_list args); #endif /**** objects made opaque until the private bits have been made private ****/ #include <gmodule.h> #include <time.h> /* time_t */ #include <sys/types.h> /* off_t */ #include <sys/stat.h> /* off_t */ typedef struct _GstPluginPrivate GstPluginPrivate; struct _GstPlugin { GstObject object; /*< private >*/ GstPluginDesc desc; gchar * filename; gchar * basename; /* base name (non-dir part) of plugin path */ GModule * module; /* contains the module if plugin is loaded */ off_t file_size; time_t file_mtime; gboolean registered; /* TRUE when the registry has seen a filename * that matches the plugin's basename */ GstPluginPrivate *priv; gpointer _gst_reserved[GST_PADDING]; }; struct _GstPluginClass { GstObjectClass object_class; /*< private >*/ gpointer _gst_reserved[GST_PADDING]; }; struct _GstPluginFeature { GstObject object; /*< private >*/ gboolean loaded; guint rank; const gchar *plugin_name; GstPlugin *plugin; /* weak ref */ /*< private >*/ gpointer _gst_reserved[GST_PADDING]; }; struct _GstPluginFeatureClass { GstObjectClass parent_class; /*< private >*/ gpointer _gst_reserved[GST_PADDING]; }; #include "gsttypefind.h" struct _GstTypeFindFactory { GstPluginFeature feature; /* <private> */ GstTypeFindFunction function; gchar ** extensions; GstCaps * caps; gpointer user_data; GDestroyNotify user_data_notify; gpointer _gst_reserved[GST_PADDING]; }; struct _GstTypeFindFactoryClass { GstPluginFeatureClass parent; /* <private> */ gpointer _gst_reserved[GST_PADDING]; }; struct _GstTracerFactory { GstPluginFeature feature; /* <private> */ GType type; /* gpointer user_data; GDestroyNotify user_data_notify; */ gpointer _gst_reserved[GST_PADDING]; }; struct _GstTracerFactoryClass { GstPluginFeatureClass parent; /* <private> */ gpointer _gst_reserved[GST_PADDING]; }; struct _GstElementFactory { GstPluginFeature parent; GType type; /* unique GType of element or 0 if not loaded */ gpointer metadata; GList * staticpadtemplates; /* GstStaticPadTemplate list */ guint numpadtemplates; /* URI interface stuff */ GstURIType uri_type; gchar ** uri_protocols; GList * interfaces; /* interface type names this element implements */ /*< private >*/ gpointer _gst_reserved[GST_PADDING]; }; struct _GstElementFactoryClass { GstPluginFeatureClass parent_class; gpointer _gst_reserved[GST_PADDING]; }; struct _GstDeviceProviderFactory { GstPluginFeature feature; /* <private> */ GType type; /* unique GType the device factory or 0 if not loaded */ volatile GstDeviceProvider *provider; gpointer metadata; gpointer _gst_reserved[GST_PADDING]; }; struct _GstDeviceProviderFactoryClass { GstPluginFeatureClass parent; /* <private> */ gpointer _gst_reserved[GST_PADDING]; }; struct _GstDynamicTypeFactory { GstPluginFeature feature; GType type; /* GType of the type, when loaded. 0 if not */ }; struct _GstDynamicTypeFactoryClass { GstPluginFeatureClass parent; }; /* privat flag used by GstBus / GstMessage */ #define GST_MESSAGE_FLAG_ASYNC_DELIVERY (GST_MINI_OBJECT_FLAG_LAST << 0) G_END_DECLS #endif /* __GST_PRIVATE_H__ */
33.223938
143
0.716676
[ "object" ]
b458358cf002405a26827d837104d6e55128398b
1,218
h
C
Code/GuiApps/QMLVTKDemo/Model/mpBaseModel.h
MattClarkson/CMakeCatchTemplate
80283f3eeb7b475ab6aea42e4bee79ab803335d2
[ "BSD-3-Clause" ]
19
2017-01-17T14:12:34.000Z
2022-02-25T08:59:36.000Z
Code/GuiApps/QMLVTKDemo/Model/mpBaseModel.h
MattClarkson/CMakeCatchTemplate
80283f3eeb7b475ab6aea42e4bee79ab803335d2
[ "BSD-3-Clause" ]
65
2017-02-12T08:07:42.000Z
2021-07-06T14:47:36.000Z
Code/GuiApps/QMLVTKDemo/Model/mpBaseModel.h
MattClarkson/CMakeCatchTemplate
80283f3eeb7b475ab6aea42e4bee79ab803335d2
[ "BSD-3-Clause" ]
17
2017-01-17T14:11:08.000Z
2022-02-25T09:07:37.000Z
/*============================================================================= MYPROJECT: A software package for whatever. Copyright (c) University College London (UCL). All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt in the top level directory for details. =============================================================================*/ #ifndef mpBaseModel_h #define mpBaseModel_h #include <QtQuick/QQuickItem> namespace mp { /** * \class BaseModel * \brief Base class for our model classes, each derived from QQuickItem. */ class BaseModel : public QQuickItem { Q_OBJECT public: BaseModel(); public slots: /** * \name Render Thread Methods */ ///@{ /// \brief Called when the current window emits QQuickWindow::beforeSynchronizing. void sync(); /// \brief Called when the current window emits QQuickWindow::sceneGraphInvalidated. void cleanup(); ///@} protected: virtual void InternalCleanup() {} virtual void InternalSync() {} private slots: void handleWindowChanged(QQuickWindow *win); }; } // end namespace #endif
19.03125
86
0.627258
[ "render", "model" ]
b45cd1b5913e32ca8fc21527830fda3034f74bc6
14,063
h
C
core/src/TNAH/Physics/Rigidbody.h
BryceStandley/TNAH
909ba9cf9f04632a3b518646c3af39752bd9d407
[ "MIT" ]
1
2021-11-08T09:44:40.000Z
2021-11-08T09:44:40.000Z
core/src/TNAH/Physics/Rigidbody.h
BryceStandley/TNAH
909ba9cf9f04632a3b518646c3af39752bd9d407
[ "MIT" ]
null
null
null
core/src/TNAH/Physics/Rigidbody.h
BryceStandley/TNAH
909ba9cf9f04632a3b518646c3af39752bd9d407
[ "MIT" ]
null
null
null
#pragma once #include "PhysicsStructures.h" #include "Collider.h" #include "TNAH/Scene/Components/Components.h" namespace tnah::Physics { /** * @class RigidBody * * @brief A class that defines all rigidbody physics body properties. * * @author Bryce Standley * @date 20/10/2021 * */ class RigidBody : public RefCounted { public: /** * @brief Construct a new Rigid Body object * @author Bryce Standley * @date 06-11-2021 */ RigidBody(); /** * @brief Construct a new Rigid Body object * @author Bryce Standley * @date 06-11-2021 */ RigidBody(TransformComponent& transform, BodyMass mass, BodyType type = BodyType::Dynamic); /** * @brief Creates a Ref to a RigidBody object * @author Bryce Standley * @date 06-11-2021 * @return Ref<RigidBody> */ static Ref<RigidBody> Create(TransformComponent& transform, BodyMass mass, BodyType type = BodyType::Dynamic); /** * @brief Updates the body * @author Bryce Standley * @date 06-11-2021 */ void OnUpdate(TransformComponent& transform); /** * @brief Get the Body Mass object * @author Bryce Standley * @date 06-11-2021 * @return BodyMass */ BodyMass GetBodyMass() const { return m_BodyMass; } /** * @brief Adds force to the body (Linear) * @author Bryce Standley * @date 06-11-2021 */ void AddForce(const glm::vec3& force); /** * @brief Adds torque to the body (Angular) * @author Bryce Standley * @date 06-11-2021 */ void AddTorque(const glm::vec3& torque); /** * @brief Set the Collision Body object * @author Bryce Standley * @date 06-11-2021 */ void SetCollisionBody(rp3d::CollisionBody* collisionBody) { m_CollisionBody = collisionBody; } /** * @brief Get the Collision Body object * @author Bryce Standley * @date 06-11-2021 * @return rp3d::CollisionBody* */ rp3d::CollisionBody* GetCollisionBody() const { return m_CollisionBody; } /** * @brief Adds a collider to the body * @author Bryce Standley * @date 06-11-2021 */ void AddCollider(Ref<Collider> collider); /** * @brief Get the Colliders objects * @author Bryce Standley * @date 06-11-2021 * @return std::unordered_map<uint32_t, Ref<Collider>> */ std::unordered_map<uint32_t, Ref<Collider>> GetColliders() { return m_Colliders; } /** * @brief Checks if colliders have been attached to the body * @author Bryce Standley * @date 06-11-2021 * @return true * @return false */ bool HasColliders() const { return m_TotalColliders > 0 ? true : false; } /** * @fn tnah::Physics::RigidBody::UpdateBodyProperties() * * @brief Updates and recalculates the Local properties of the RigidBody based on its colliders attached. * This overrides any values set. To modify the properties of the body, * address the tnah::Physics::Collider objects directly with RigidBody::GetColliders() * * @author Bryce Standley * @date Monday, 25 October 2021 * */ void UpdateBodyProperties(); /** * @brief Gets the ID of the body * @author Bryce Standley * @date 06-11-2021 * @return uint32_t */ uint32_t GetID() const { return m_ID; } /** * @brief Set the Type object * @author Bryce Standley * @date 06-11-2021 */ void SetType(const BodyType& type) { m_BodyType = type; } /** * @brief Get the Type object * @author Bryce Standley * @date 06-11-2021 * @return BodyType */ BodyType GetType() const { return m_BodyType; } /** * @brief Get the Inertia Tensor object * @author Bryce Standley * @date 06-11-2021 * @return InertiaTensor */ InertiaTensor GetInertiaTensor() const { return m_InertiaTensor; } /** * @brief Recalculates the inertia tensor in world space * @author Bryce Standley * @date 06-11-2021 */ void RecalculateWorldInertiaTensor(); /** * @brief Get the Linear Velocity object * @author Bryce Standley * @date 06-11-2021 * @return LinearVelocity */ LinearVelocity GetLinearVelocity() const { return m_LinearVelocity; } /** * @brief Get the Angular Velocity object * @author Bryce Standley * @date 06-11-2021 * @return AngularVelocity */ AngularVelocity GetAngularVelocity() const { return m_AngularVelocity; } /** * @brief Get the Velocities objects * @author Bryce Standley * @date 06-11-2021 * @return std::pair<LinearVelocity, AngularVelocity> */ std::pair<LinearVelocity, AngularVelocity> GetVelocities() { return {m_LinearVelocity, m_AngularVelocity}; } /** * @brief Set the Linear Rotational Lock Factor object * @author Bryce Standley * @date 06-11-2021 */ void SetLinearRotationalLockFactor(const glm::ivec3& lock) { m_LinearRotationLock = lock; } /** * @brief Set the Angular Rotational Lock Factor object * @author Bryce Standley * @date 06-11-2021 */ void SetAngularRotationalLockFactor(const glm::ivec3& lock) { m_AngularRotationLock = lock; } /** * @brief Get the Linear Rotational Lock Factor object * @author Bryce Standley * @date 06-11-2021 * @return glm::vec3& */ glm::vec3& GetLinearRotationalLockFactor() { return m_LinearRotationLock; } /** * @brief Get the Angular Rotational Lock Factor object * @author Bryce Standley * @date 06-11-2021 * @return glm::vec3& */ glm::vec3& GetAngularRotationalLockFactor() { return m_AngularRotationLock; } /** * @brief Applies a collision Impulse to the body (Unused) * @author Bryce Standley * @date 06-11-2021 */ void ApplyCollisionImpulse(const glm::vec3& linearVelocity, const glm::vec3& angularVelocity); /** * @brief Resets the velocity, position and orientation values of the body * @author Bryce Standley * @date 06-11-2021 */ void ResetValues(); /** * @brief Reference to ignore gravity flag. Used to toggle between ignoring or not ignoring gravity * @author Bryce Standley * @date 06-11-2021 * @return true * @return false */ bool& IgnoreGravity() { return m_IgnoreGravity; } /** * @brief Checks if the body is sleeping * @author Bryce Standley * @date 06-11-2021 * @return true * @return false */ bool IsSleeping() const { return m_IsSleeping; } /** * @brief Wakes up the body from sleep * @author Bryce Standley * @date 06-11-2021 */ void Awake() { m_IsSleeping = false; } /** * @brief Sets a body to sleep * @author Bryce Standley * @date 06-11-2021 */ void Sleep(); /** * @brief Set the Linear Dampening object, clamping between 0 and 1 * @author Bryce Standley * @date 06-11-2021 */ void SetLinearDampening(float value) {m_LinearDampening.Dampening = glm::clamp(value, 0.0f, 1.0f);} /** * @brief Set the Angular Dampening object, clamping between 0 and 1 * @author Bryce Standley * @date 06-11-2021 */ void SetAngularDampening(float value) {m_AngularDampening.Dampening = glm::clamp(value, 0.0f, 1.0f);} /** * @brief Calculates the local inertia tensor * @author Bryce Standley * @date 06-11-2021 * @return glm::vec3 */ glm::vec3 CalculateLocalInertiaTensor(); private: /** * @brief Calculates the centre of mass of the body * @author Bryce Standley * @date 06-11-2021 * @return glm::vec3 */ glm::vec3 CalculateCentreOfMass(); /** * @brief Sets the ID of the body * @author Bryce Standley * @date 06-11-2021 */ void SetID(const uint32_t id) { m_ID = id; } private: /** * @var m_BodyType * * @brief The type of the Rigidbody. Either Dynamic or static. */ BodyType m_BodyType; /** * @var m_BodyMass * * @brief The BodyMass of the Rigidbody. This is the combined total for the whole Rigidbody with all of its Colliders. */ BodyMass m_BodyMass; /** * @var m_LinearVelocity * * @brief The current LinearVelocity of the Rigidbody. */ LinearVelocity m_LinearVelocity; /** * @var m_AngularVelocity * * @brief The current AngularVelocity of the Rigidbody. */ AngularVelocity m_AngularVelocity; /** * @var m_ConstrainedLinearVelocity * * @brief The current Constrained LinearVelocity of the Rigidbody. */ LinearVelocity m_ConstrainedLinearVelocity; /** * @var m_ConstrainedAngularVelocity * * @brief The current Constrained AngularVelocity of the Rigidbody. */ AngularVelocity m_ConstrainedAngularVelocity; /** * @var m_Force * * @brief Current forces applied to the Rigidbody. These are used and zeroed out every PhysicsSystem::OnUpdate(). */ Force m_Force; /** * @var m_Torque * * @brief Current torques applied to the Rigidbody. These are used and zeroed out every PhysicsSystem::OnUpdate(). */ Torque m_Torque; /** * @var m_LinearDampening * * @brief The LinearDampening of the Rigidbody. Values of 0 disable dampening and values of 1 enable full dampening. */ LinearDampening m_LinearDampening; /** * @var m_AngularDampening * * @brief The AngularDampening of the Rigidbody. Values of 0 disable dampening and values of 1 enable full dampening. */ AngularDampening m_AngularDampening; /** * @var m_InertiaTensor * * @brief The InertiaTensor of the Rigidbody with both world and local space data. */ InertiaTensor m_InertiaTensor; /** * @var m_Colliders * * @brief A vector of all colliders on the Rigidbody */ std::unordered_map<uint32_t, Ref<Collider>> m_Colliders; /** * @var m_TotalColliders * @brief Total colliders attached to the body * @author Bryce Standley * @date 06-11-2021 */ uint32_t m_TotalColliders = 0; /** * @var m_ID * * @brief The global ID of the RigidBody. */ uint32_t m_ID = 0; /** * @var m_LinearRotationLock * * @brief Rotational lock factor for linear velocities. 1 is enabled, 0 is disabled per axis. */ glm::vec3 m_LinearRotationLock = {1,1,1}; /** * @var m_AngularRotationLock * * @brief Rotational lock factor for angular velocities. 1 is enabled, 0 is disabled per axis. */ glm::vec3 m_AngularRotationLock = {1,1,1}; /** * @var m_Position * @brief World position of the body * @author Bryce Standley * @date 06-11-2021 */ glm::vec3 m_Position = {0,0,0}; /** * @var m_Orientation * @brief World orientation of the body * @author Bryce Standley * @date 06-11-2021 */ glm::quat m_Orientation = {0,0,0,0}; /** * @var m_IsSleeping * * @brief A flag to note if the RigidBody is currently sleeping thus not being simulated. */ bool m_IsSleeping = false; /** * @var m_SleepVelocityThreshold * @brief Threshold to sleep based on velocity * @author Bryce Standley * @date 06-11-2021 */ float m_SleepVelocityThreshold = 0.2f; /** * @var m_SleepTimeThreshold * @brief Threshold to sleep based on time * @author Bryce Standley * @date 06-11-2021 */ float m_SleepTimeThreshold = 1.0f; /** * @var m_SleepTimeAccumulator * @brief Accumulator of time when the body reached the threshold velocity to sleep * @author Bryce Standley * @date 06-11-2021 */ float m_SleepTimeAccumulator = 0.0f; /** * @var m_IgnoreGravity * * @brief A flag to note if the RigidBody should ignore gravity within the world. */ bool m_IgnoreGravity = false; /** * @var m_CollisionBody * * @brief The Reactphysics3d Collision body used by the Rigidbody to interact and move within the PhysicsWorld. */ rp3d::CollisionBody* m_CollisionBody = nullptr; friend class PhysicsEngine; friend class EditorUI; friend class Serializer; }; }
28.936214
125
0.552016
[ "object", "vector", "transform" ]
b484e6b21a1f6b848692adda2b6043c3848191bd
2,378
h
C
JETAN/JETAN/AliDAJetFinder.h
maroozm/AliPhysics
22ec256928cfdf8f800e05bfc1a6e124d90b6eaf
[ "BSD-3-Clause" ]
114
2017-03-03T09:12:23.000Z
2022-03-03T20:29:42.000Z
JETAN/JETAN/AliDAJetFinder.h
maroozm/AliPhysics
22ec256928cfdf8f800e05bfc1a6e124d90b6eaf
[ "BSD-3-Clause" ]
19,637
2017-01-16T12:34:41.000Z
2022-03-31T22:02:40.000Z
JETAN/JETAN/AliDAJetFinder.h
maroozm/AliPhysics
22ec256928cfdf8f800e05bfc1a6e124d90b6eaf
[ "BSD-3-Clause" ]
1,021
2016-07-14T22:41:16.000Z
2022-03-31T05:15:51.000Z
#ifndef ALIDAJETFINDER_H #define ALIDAJETFINDER_H /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * * See cxx source for full Copyright notice */ /* $Id$ */ //--------------------------------------------------------------------- //Jet finder based on Deterministic Annealing //Author: Davide Perrino (davide.perrino@ba.infn.it) // magali.estienne@subatech.in2p3.fr & // alexandre.shabetai@cern.ch (Modification of the input object (reader/finder splitting)) // ** 2011 // Modified accordingly to reader/finder splitting and new handling of neutral information //--------------------------------------------------------------------- #include "AliJetFinder.h" #include <TMatrixD.h> #include <TVectorD.h> class AliDAJetFinder : public AliJetFinder { public: AliDAJetFinder(); virtual ~AliDAJetFinder(); void FindJets (); protected: Double_t fAlpha; // beta increment Double_t fDelta; // perturbation proportional to Delta Double_t fAvDist; // minimum distance to distinguish two clusters Double_t fEps; // convergence criterium below max number of loops Double_t fEpsMax; // convergence criterium above max number of loops Int_t fNloopMax; // maximum number of loops at a fixed beta Double_t fBeta; // increasing multiplier of entropy Int_t fNclustMax; // maximum number of clusters to find Int_t fNin; // number of input data Int_t fNeff; // total input data, including fakes private: void InitDetAnn (Double_t &dEtSum, Double_t **xData, TVectorD *px, TVectorD *py, TMatrixD *pyx, TMatrixD *y); void Annealing (Int_t nk, Double_t **xData, const TVectorD *vPx, TVectorD *vPy, TMatrixD *mPyx, TMatrixD *mY); void NumCl (Int_t &nc, Int_t &nk, TVectorD *vPy, TMatrixD *mPyx, TMatrixD *mY); void ReduceClusters(Int_t **iSame, Int_t nc, Int_t &ncout, Int_t **cont, Int_t *nSameOut) const; void DoubleClusters(Int_t nc, Int_t &nk, TVectorD *vPy, TMatrixD *mY) const; void EndDetAnn (Int_t &nk, Double_t **xData, Int_t *xx, Double_t etx, const TVectorD *px, TVectorD *py, TMatrixD *pyx, TMatrixD *y); void StoreJets (Int_t nk, Double_t **xData, const Int_t *xx, const TMatrixD *mY); ClassDef(AliDAJetFinder,4) // DA Jet finder }; #endif
41.719298
142
0.642557
[ "object" ]
7d8b2d45249806bc9aff31840829f75eddffea47
2,399
h
C
lean/header/lean/smart/common.h
dgu123/lean-cpp-lib
e4698699a743e567f287f5592af0f23219657929
[ "MIT" ]
null
null
null
lean/header/lean/smart/common.h
dgu123/lean-cpp-lib
e4698699a743e567f287f5592af0f23219657929
[ "MIT" ]
null
null
null
lean/header/lean/smart/common.h
dgu123/lean-cpp-lib
e4698699a743e567f287f5592af0f23219657929
[ "MIT" ]
null
null
null
/*****************************************************/ /* lean Smart (c) Tobias Zirr 2011 */ /*****************************************************/ #pragma once #ifndef LEAN_SMART_COMMON #define LEAN_SMART_COMMON #include "../lean.h" namespace lean { namespace smart { #ifdef DOXYGEN_READ_THIS /// Allows for the binding of existing COM object / resource references on smart pointer construction. enum bind_reference_t { bind_reference ///< Allows for the binding of existing COM object / resource references on smart pointer construction. }; #else /// Allows for the binding of existing COM object / resource references on smart pointer construction. typedef consume_t bind_reference_t; /// Allows for the binding of existing COM object / resource references on smart pointer construction. const bind_reference_t bind_reference = consume; #endif /// Determines whether a reference is in a critical state. enum reference_state_t { stable_ref = false, ///< Reference is stable, referenced object cannot accidentally be destroyed. critical_ref = true ///< Reference is critical, referenced object might accidentally get destroyed. }; /// Determines wrapper semantic. enum ptr_semantic_t { val_sem = false, ///< Value semantics (const-transitive, non-null). ptr_sem = true ///< Pointer semantics (const-intransitive, null). }; #ifndef LEAN0X_NO_DECLTYPE namespace impl { template <class Type> struct move_ref_deref_helper { template <class T> static auto maybe_type(T *v) -> decltype(**v); static void maybe_type(...); typedef decltype(maybe_type(static_cast<Type*>(nullptr))) type; }; } #endif /// Move reference wrapper. template <class Type> struct move_ref { /// Moved object type. typedef Type value_type; /// Pointer to the object to be moved. value_type *const moved_ptr; /// Constructs a move reference object for the given value. move_ref(value_type &v) : moved_ptr(addressof(v)) { } /// Gets a reference to the object to be moved. value_type& moved() const { return *moved_ptr; } }; } // namespace using smart::bind_reference_t; using smart::bind_reference; using smart::ptr_semantic_t; using smart::val_sem; using smart::ptr_sem; using smart::reference_state_t; using smart::stable_ref; using smart::critical_ref; } // namespace #endif
26.655556
120
0.684035
[ "object" ]
7d9057c1f52961e5ae7883ddae7841c406f1c43b
686
h
C
catboost/libs/data/pool.h
SitdikovRustam/CatBoost
39fb9dfddb24e977ed87efc71063b03cd4bc8f16
[ "Apache-2.0" ]
1
2017-08-27T20:55:56.000Z
2017-08-27T20:55:56.000Z
catboost/libs/data/pool.h
dsferz/machinelearning_yandex
8fde8314c5c70299ece8b8f00075ddfcd5e07ddf
[ "Apache-2.0" ]
null
null
null
catboost/libs/data/pool.h
dsferz/machinelearning_yandex
8fde8314c5c70299ece8b8f00075ddfcd5e07ddf
[ "Apache-2.0" ]
null
null
null
#pragma once #include <util/random/fast.h> #include <util/generic/vector.h> #include <util/generic/utility.h> #include <util/ysaveload.h> #include <util/generic/hash.h> struct TDocInfo { float Target; float Weight = 1; yvector<float> Factors; yvector<double> Baseline; TString Id; void Swap(TDocInfo& other) { DoSwap(Target, other.Target); DoSwap(Weight, other.Weight); Factors.swap(other.Factors); Baseline.swap(other.Baseline); DoSwap(Id, other.Id); } }; struct TPool { yvector<TDocInfo> Docs; yvector<int> CatFeatures; yvector<TString> FeatureId; yhash<int, TString> CatFeaturesHashToString; };
22.129032
48
0.663265
[ "vector" ]
7d923726bb6e9773cd02a1e58787b5e1bad69a31
4,570
h
C
include/IECoreScene/Font.h
bradleyhenke/cortex
f8245cc6c9464b1de9e6c6e57068248198e63de0
[ "BSD-3-Clause" ]
386
2015-01-02T11:10:43.000Z
2022-03-10T15:12:20.000Z
include/IECoreScene/Font.h
bradleyhenke/cortex
f8245cc6c9464b1de9e6c6e57068248198e63de0
[ "BSD-3-Clause" ]
484
2015-01-09T18:28:06.000Z
2022-03-31T16:02:04.000Z
include/IECoreScene/Font.h
bradleyhenke/cortex
f8245cc6c9464b1de9e6c6e57068248198e63de0
[ "BSD-3-Clause" ]
99
2015-01-28T23:18:04.000Z
2022-03-27T00:59:39.000Z
////////////////////////////////////////////////////////////////////////// // // Copyright (c) 2008-2013, Image Engine Design Inc. All rights reserved. // // 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 Image Engine Design nor the names of any // other contributors to this software 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 IECORESCENE_FONT_H #define IECORESCENE_FONT_H #include "IECoreScene/Export.h" #include "IECoreScene/TypeIds.h" #include "IECore/Export.h" #include "IECore/RunTimeTyped.h" IECORE_PUSH_DEFAULT_VISIBILITY #include "OpenEXR/ImathBox.h" #include "OpenEXR/ImathVec.h" IECORE_POP_DEFAULT_VISIBILITY namespace IECoreScene { IE_CORE_FORWARDDECLARE( MeshPrimitive ); IE_CORE_FORWARDDECLARE( Group ); /// The Font class allows the loading of fonts and their /// conversion to MeshPrimitives. /// \ingroup renderingGroup class IECORESCENE_API Font : public IECore::RunTimeTyped { public : IE_CORE_DECLARERUNTIMETYPEDEXTENSION( Font, FontTypeId, IECore::RunTimeTyped ); Font( const std::string &fontFile ); ~Font() override; const std::string &fileName() const; void setKerning( float kerning ); float getKerning() const; void setLineSpacing( float lineSpacing ); float getLineSpacing() const; /// Sets the tolerance used when converting /// curved segments of glyphs into triangle /// meshes. Smaller values produce denser /// meshes. Tolerance is specified in the /// same coordinate system as the resulting /// mesh - that is one unit in the mesh is /// equal to one em. void setCurveTolerance( float tolerance ); float getCurveTolerance() const; /// Returns a mesh for the specified character, using /// the current curve tolerance. This returns a reference /// into an internal cache and hence the resulting mesh /// is const. const MeshPrimitive *mesh( char c ) const; /// Returns a mesh representing the specified string, /// using the current curve tolerance and kerning. MeshPrimitivePtr mesh( const std::string &text ) const; /// Returns a group representing the specified string, /// using the current curve tolerance and kerning. GroupPtr meshGroup( const std::string &text ) const; /// Returns the necessary appropriate offset between the /// origins of the first and second characters, taking /// into account the current kerning. Imath::V2f advance( char first, char second ) const; /// Returns a bounding box guaranteed to be large enough /// to contain all characters from the font. 1 unit in this /// bound is equal to 1 em. Imath::Box2f bound() const; /// Returns the bounding box for the specified character - /// units are as above. Imath::Box2f bound( char c ) const; /// Returns the bounding box for the specified string taking /// into account the current kerning settings - units are as /// above. Imath::Box2f bound( const std::string &text ) const; private : IE_CORE_FORWARDDECLARE( Implementation ); ImplementationPtr m_implementation; class Mesher; }; IE_CORE_DECLAREPTR( Font ); } #endif // IECORESCENE_FONT_H
35.984252
81
0.71488
[ "mesh" ]
7da85eb1426dcfb1806a198abf3d9c7e66b66b56
3,694
h
C
include/nlu.h
QwantResearch/text-nlu
862eaa41dd4c80688b857ffe0209cef994d18b1b
[ "Apache-2.0" ]
null
null
null
include/nlu.h
QwantResearch/text-nlu
862eaa41dd4c80688b857ffe0209cef994d18b1b
[ "Apache-2.0" ]
6
2019-08-22T13:36:20.000Z
2020-06-02T13:13:27.000Z
include/nlu.h
QwantResearch/text-nlu
862eaa41dd4c80688b857ffe0209cef994d18b1b
[ "Apache-2.0" ]
null
null
null
// Copyright 2019 Qwant Research. Licensed under the terms of the Apache 2.0 // license. See LICENSE in the project root. #ifndef __NLU_H #define __NLU_H #include <iostream> #include <fstream> #include <fcntl.h> #include "grpcpp/create_channel.h" #include <grpcpp/security/credentials.h> #include <google/protobuf/map.h> #include <google/protobuf/text_format.h> #include <google/protobuf/io/zero_copy_stream_impl.h> #include "tensorflow_serving/apis/prediction_service.grpc.pb.h" #include "tensorflow_serving/apis/model_service.grpc.pb.h" #include "tokenizer.h" #include "utils.h" #include <grpcpp/grpcpp.h> using grpc::Channel; using grpc::ClientContext; using grpc::Status; using tensorflow::serving::PredictRequest; using tensorflow::serving::PredictResponse; using tensorflow::serving::PredictionService; using tensorflow::serving::ModelService; typedef google::protobuf::Map<std::string, tensorflow::TensorProto> OutMap; using namespace std; // Flattens a 2D std::vector to a 1D std::vector. template <typename T> std::vector<T> FlattenVector(const std::vector<std::vector<T> >& vals) { std::vector<T> flat_vals; flat_vals.reserve(vals.size() * vals.front().size()); for (const auto& v : vals) { flat_vals.insert(flat_vals.end(), v.cbegin(), v.cend()); } return flat_vals; } // Flattens a 3D std::vector to a 1D std::vector. template <typename T> std::vector<T> FlattenVector(const std::vector<std::vector<std::vector<T> > >& vals) { std::vector<T> flat_vals; size_t final_size = vals.size() * vals.front().size() * vals.front().front().size(); // flat_vals.reserve(vals.size() * vals.front().size() * vals.front().front().size() ); for (const auto& values : vals) { for (const auto& v : values) { flat_vals.insert(flat_vals.end(), v.cbegin(), v.cend()); } } return flat_vals; } class nlu { public: nlu(int debug_mode, std::string model_config_path, std::string tfserving_host); std::vector<std::string> getDomains(); bool getLocal(); void setDebugMode(int debug_mode); std::vector <std::string> tokenize(std::string &input, std::string &lang, bool lowercase); std::vector <std::string> tokenize(std::string &input, std::string &lang); std::string tokenize_str(std::string &input, std::string &lang, bool lowercase); std::string detokenize_str(std::string &input, std::string &lang, bool lowercase); std::string tokenize_str(std::string &input, std::string &lang); std::string detokenize_str(std::string &input, std::string &lang); Status NLUBatch( std::vector<std::vector<std::string> >& batch_tokens, std::vector<std::vector<std::string> >& output_batch_tokens, std::string domain); Status NLUDecode( std::vector<std::vector<std::string> >& batch_tokens, std::vector<std::vector<std::string> >& output_batch_tokens, std::string domain); bool CheckModelsStatus(); private: static map<tensorflow::serving::ModelVersionStatus_State, std::string> mapState; unique_ptr<PredictionService::Stub> _stub; shared_ptr<Channel> _channel; bool _local; int _debug_mode; std::string _model_config_path; std::vector<int> PadBatch( std::vector<std::vector<std::string> >& batch_tokens); int getMaxLengthWord(std::vector<std::vector<std::string>>& batch_tokens); void getBatchCharsListFromBatchTokens( std::vector<std::vector<std::vector<std::string>>>& chars_list_batch, std::vector<std::vector<std::string>>& batch_tokens, int max_length_word); }; #endif // __NLU_H
33.581818
98
0.681375
[ "vector", "3d" ]
7dad99b7a7cb08a6add5b0b7a257273b936b6e82
4,220
h
C
Dependencies/OpenTissue/include/OpenTissue/dynamics/psys/psys_system.h
marizoldi/Hapty
ed9ef1175d755dbca1609dbb27601440220fd98c
[ "MIT" ]
3
2016-01-06T13:43:21.000Z
2016-03-24T08:57:57.000Z
Dependencies/OpenTissue/include/OpenTissue/dynamics/psys/psys_system.h
marizoldi/Hapty
ed9ef1175d755dbca1609dbb27601440220fd98c
[ "MIT" ]
2
2016-01-06T12:15:43.000Z
2016-01-16T19:57:09.000Z
Dependencies/OpenTissue/include/OpenTissue/dynamics/psys/psys_system.h
marizoldi/Hapty
ed9ef1175d755dbca1609dbb27601440220fd98c
[ "MIT" ]
null
null
null
#ifndef OPENTISSUE_DYNAMICS_PSYS_PSYS_SYSTEM_H #define OPENTISSUE_DYNAMICS_PSYS_PSYS_SYSTEM_H // // OpenTissue Template Library // - A generic toolbox for physics-based modeling and simulation. // Copyright (C) 2008 Department of Computer Science, University of Copenhagen. // // OTTL is licensed under zlib: http://opensource.org/licenses/zlib-license.php // #include <OpenTissue/configuration.h> #include <vector> namespace OpenTissue { namespace psys { /** * This is the ``core'' data structure for particles. It provides iterator * capabilities. Particle lookup based on indices and time-management of * the entire particle system. * * Also there is simple support functionality for deriving AABB information * of the particle system (see min and max methods). */ template<typename types > class System { public: typedef typename types::math_types math_types; typedef typename math_types::real_type real_type; typedef typename math_types::vector3_type vector3_type; typedef typename types::particle_type particle_type; typedef std::vector<particle_type> particle_container; typedef typename particle_container::iterator particle_iterator; typedef typename particle_container::const_iterator const_particle_iterator; protected: real_type m_time; ///< Current time. particle_container m_particles; ///< A vector of all particles in the cluster. public: real_type & time() { return m_time; } real_type const & time() const { return m_time; } public: System() : m_time(0.0) {} ~System(){ clear(); }; public: vector3_type min_coord() { using std::min; // TODO: Is it possible to add some lazy evalutation to this? Caching // previous computed value and only re-compute it if particles have // changed? vector3_type min_coord = vector3_type( math::detail::highest<real_type>(),math::detail::highest<real_type>(),math::detail::highest<real_type>() ); particle_iterator p = particle_begin(); particle_iterator end = particle_end(); for(;p!=end;++p) min_coord = min( min_coord, p->position() ); } vector3_type max_coord() { using std::max; // TODO: Is it possible to add some lazy evalutation to this? Caching // previous computed value and only re-compute it if particles have // changed? vector3_type max_coord = vector3_type( math::detail::lowest<real_type>(),math::detail::lowest<real_type>(),math::detail::lowest<real_type>() ); particle_iterator p = particle_begin(); particle_iterator end = particle_end(); for(;p!=end;++p) max_coord = max( max_coord, p->position() ); } public: void clear() { m_particles.clear(); } particle_iterator create_particle(particle_type const & p) { m_particles.push_back(p); particle_iterator particle = m_particles.end()-1; particle->connect ( *this ); return particle; } void erase(particle_iterator p) { p->disconnect(); m_particles.erase(p); } particle_iterator & operator()(unsigned int idx) { return m_particles.begin() + idx; } const_particle_iterator & operator()(unsigned int idx) const { return m_particles.begin() + idx; } particle_iterator particle_begin() { return m_particles.begin(); } particle_iterator particle_end() { return m_particles.end(); } const_particle_iterator particle_begin() const { return m_particles.begin(); } const_particle_iterator particle_end() const { return m_particles.end(); } std::size_t particles_size() const { return m_particles.size(); } }; } // namespace psys } // namespace OpenTissue // OPENTISSUE_DYNAMICS_PSYS_PSYS_SYSTEM_H #endif
32.96875
155
0.623223
[ "vector" ]
7daefd25202278c82edbc23654d6919b0cbd7272
719
h
C
oop2_project/IHandler.h
akivagold/Robbery-in-the-Depths
e4a2a1434dbe13af70635483c9c2098afdc0d93c
[ "Apache-2.0" ]
2
2020-08-19T10:19:22.000Z
2021-08-15T15:29:47.000Z
oop2_project/IHandler.h
akivagold/Robbery-in-the-Depths
e4a2a1434dbe13af70635483c9c2098afdc0d93c
[ "Apache-2.0" ]
null
null
null
oop2_project/IHandler.h
akivagold/Robbery-in-the-Depths
e4a2a1434dbe13af70635483c9c2098afdc0d93c
[ "Apache-2.0" ]
2
2020-10-06T08:42:04.000Z
2020-12-24T11:03:35.000Z
#pragma once //---- include section ------ #include <functional> #include <vector> //---- using section -------- using std::vector; namespace GUI { /* * IHandler interface */ template <class T> class IHandler { public: // type of handler using Listener = std::function<void(T&)>; // remove listeners void removeListeners() { m_ListenerList.clear(); } // listen to event void addListener(Listener listener) { m_ListenerList.push_back(listener); } // call all listeners void callListeners(T& t); private: // vector of functions that listen to event vector<Listener> m_ListenerList; }; template<class T> void IHandler<T>::callListeners(T& t) { for (Listener &listener : m_ListenerList) listener(t); } }
18.921053
76
0.69541
[ "vector" ]
7db120bf143f7dcf4a0f5bdb137a2d5e6dd499e2
1,581
h
C
bistro/runners/LocalRunner.h
jiazerojia/bistro
95c8d9cf9786ff87d845d7732622a46d90de5f58
[ "BSD-3-Clause" ]
1
2021-05-19T23:02:04.000Z
2021-05-19T23:02:04.000Z
bistro/runners/LocalRunner.h
jiazerojia/bistro
95c8d9cf9786ff87d845d7732622a46d90de5f58
[ "BSD-3-Clause" ]
null
null
null
bistro/runners/LocalRunner.h
jiazerojia/bistro
95c8d9cf9786ff87d845d7732622a46d90de5f58
[ "BSD-3-Clause" ]
null
null
null
/* * Copyright (c) 2015-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * */ #pragma once #include <boost/filesystem.hpp> #include "bistro/bistro/if/gen-cpp2/common_types.h" #include "bistro/bistro/processes/TaskSubprocessQueue.h" #include "bistro/bistro/runners/TaskRunner.h" namespace facebook { namespace bistro { class Job; class LogLines; class Node; class TaskStatus; /** * Run a task locally on the current machine. */ class LocalRunner : public TaskRunner { public: LocalRunner( const boost::filesystem::path& cmd, const boost::filesystem::path& dir ); LogLines getJobLogs( const std::string& logtype, const std::vector<std::string>& jobs, const std::vector<std::string>& nodes, int64_t line_id, bool is_ascending, const std::string& regex_filter ) const override; bool canKill() override { return true; } void killTask(const cpp2::RunningTask&, const cpp2::KillRequest&) override; protected: TaskRunnerResponse runTaskImpl( const std::shared_ptr<const Job>& job, const Node& node, cpp2::RunningTask& rt, folly::dynamic& job_args, std::function<void(const cpp2::RunningTask& rt, TaskStatus&& status)> cb) noexcept override; private: TaskSubprocessQueue taskQueue_; boost::filesystem::path cmd_; boost::filesystem::path jobsDir_; }; }}
24.323077
79
0.71284
[ "vector" ]
7db14cdab920b91048712ef9ebb0df7038c9f97a
7,323
h
C
src/xzero/http/HttpResponse.h
pjsaksa/x0
96b69e5a54b006e3d929b9934c2708f7967371bb
[ "MIT" ]
24
2016-07-10T08:05:11.000Z
2021-11-16T10:53:48.000Z
src/xzero/http/HttpResponse.h
pjsaksa/x0
96b69e5a54b006e3d929b9934c2708f7967371bb
[ "MIT" ]
14
2015-04-12T10:45:26.000Z
2016-06-28T22:27:50.000Z
src/xzero/http/HttpResponse.h
pjsaksa/x0
96b69e5a54b006e3d929b9934c2708f7967371bb
[ "MIT" ]
4
2016-10-05T17:51:38.000Z
2020-04-20T07:45:23.000Z
// This file is part of the "x0" project, http://github.com/christianparpart/x0> // (c) 2009-2018 Christian Parpart <christian@parpart.family> // // 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 #pragma once #include <xzero/http/HttpVersion.h> #include <xzero/http/HttpStatus.h> #include <xzero/http/HttpResponseInfo.h> #include <xzero/http/HeaderFieldList.h> #include <xzero/CompletionHandler.h> #include <memory> namespace xzero { class Executor; class FileView; class Filter; class Buffer; class BufferRef; class HugeBuffer; namespace http { class HttpChannel; /** * Represents an HTTP response message. * * Semantic HTTP-protocol headers, such as "Date" will must not be added * as they are added by the HttpGenerator when flushing the response * to the client. * * @note It is not safe to mutate a response from multiple threads concurrently. */ class HttpResponse { private: HttpResponse(HttpResponse&) = delete; HttpResponse& operator=(HttpResponse&) = delete; public: explicit HttpResponse(HttpChannel* channel); Executor* executor() const noexcept; void recycle(); /** * Raw access to the HttpResponseInfo object. */ HttpResponseInfo& info() noexcept { return info_; } /** * Raw access to the HttpResponseInfo object. */ const HttpResponseInfo& info() const noexcept { return info_; } HttpVersion version() const noexcept; void setVersion(HttpVersion version); void setStatus(HttpStatus status); HttpStatus status() const noexcept { return info_.status(); } bool hasStatus() const noexcept { return info_.status() != HttpStatus::Undefined; } const std::string& reason() const noexcept { return info_.reason(); } void setReason(const std::string& val); // high level header support void resetContentLength(); void setContentLength(size_t size); size_t contentLength() const noexcept { return info_.contentLength(); } /** * Number of bytes of response body content already written. */ size_t actualContentLength() const noexcept { return actualContentLength_; } bool hasContentLength() const noexcept { return info_.hasContentLength(); } // headers void addHeader(const std::string& name, const std::string& value); void appendHeader(const std::string& name, const std::string& value, const std::string& delim = ""); void prependHeader(const std::string& name, const std::string& value, const std::string& delim = ""); void setHeader(const std::string& name, const std::string& value); bool hasHeader(const std::string& name) const; void removeHeader(const std::string& name); void removeAllHeaders(); const std::string& getHeader(const std::string& name) const; const HeaderFieldList& headers() const noexcept { return info_.headers(); } HeaderFieldList& headers() noexcept { return info_.headers(); } // trailers //bool isTrailerSupported() const; void registerTrailer(const std::string& name); void appendTrailer(const std::string& name, const std::string& value, const std::string& delim = ""); void setTrailer(const std::string& name, const std::string& value); const HeaderFieldList& trailers() const noexcept { return info_.trailers(); } /** * Installs a callback to be invoked right before serialization of response * headers. */ void onPostProcess(std::function<void()> callback); /** * Installs a callback to be invoked right after the last response message * byte has been fully sent or transmission has been aborted. */ void onResponseEnd(std::function<void()> callback); /** * Invoke to mark this response as complete. * * Further access to this object is undefined. */ void completed(); /** * Invoke to tell the client that it may continue sending the request body. * * You may only invoke this method if and only if the client actually * requested this behaviour via <code>Expect: 100-continue</code> * request header. */ void send100Continue(CompletionHandler onComplete); /** * Responds with an error response message. * * @param code HTTP response status code. * @param message optional custom error message. * * @note This message is considered completed after this call. */ void sendError(HttpStatus code, const std::string& message = ""); bool isCommitted() const noexcept { return committed_; } void setBytesTransmitted(size_t n) { bytesTransmitted_ = n; } size_t bytesTransmitted() const noexcept { return bytesTransmitted_; } /** * Adds a custom output-filter. * * @param filter the output filter to apply to the output body. * * The filter will not take over ownership. Make sure the filter is * available for the whole time the response is generated. */ void addOutputFilter(std::shared_ptr<Filter> filter); /** * Removes all output-filters. */ void removeAllOutputFilters(); /** * Writes given C-string @p cstr to the client. * * @param cstr the null-terminated string that is being copied * into the response body. * @param completed Callback to invoke after completion. * * The C string will be copied into the response body. */ void write(const char* cstr, CompletionHandler&& completed = nullptr); /** * Writes given string @p str to the client. * * @param str the string chunk to write to the client. The string will be * copied. * @param completed Callback to invoke after completion. */ void write(const std::string& str, CompletionHandler&& completed = nullptr); /** * Writes given buffer. * * @param data The data chunk to write to the client. * @param completed Callback to invoke after completion. */ void write(Buffer&& data, CompletionHandler&& completed = nullptr); /** * Writes given buffer. * * @param data The data chunk to write to the client. * @param completed Callback to invoke after completion. * * @note You must ensure the data chunk is available until sending completed! */ void write(const BufferRef& data, CompletionHandler&& completed = nullptr); /** * Writes the data received from the given file descriptor @p file. * * @param file file ref handle * @param completed Callback to invoke after completion. */ void write(FileView&& file, CompletionHandler&& completed = nullptr); /** * Writes the data received from the given HugeBuffer @p file. * * @param file file ref handle * @param completed Callback to invoke after completion. */ void write(HugeBuffer&& content, CompletionHandler&& completed = nullptr); private: friend class HttpChannel; // FIXME: can we get rid of friends? void setCommitted(bool value); /** ensures response wasn't committed yet and thus has mutabale meta info. */ void requireMutableInfo(); /** ensures that channel is not in sending state. */ void requireNotSendingAlready(); private: HttpChannel* channel_; HttpResponseInfo info_; bool committed_; size_t bytesTransmitted_; size_t actualContentLength_; }; } // namespace http } // namespace xzero
30.385892
85
0.699986
[ "object" ]
7db18e4cfee2edd735867ac808bc83ba44b36f1a
2,055
h
C
src/network/network.h
Centaurus99/ArmyChess
04addd848061ddbec485de38f15d93627f92dd57
[ "MIT" ]
null
null
null
src/network/network.h
Centaurus99/ArmyChess
04addd848061ddbec485de38f15d93627f92dd57
[ "MIT" ]
null
null
null
src/network/network.h
Centaurus99/ArmyChess
04addd848061ddbec485de38f15d93627f92dd57
[ "MIT" ]
null
null
null
#ifndef NETWORK_H #define NETWORK_H #include <QDataStream> #include <QObject> #include <QTimer> #include <QtNetWork> #include <vector> class Network : public QObject { typedef int SIZE_TYPE; Q_OBJECT signals: // Successfully connected void SuccessConnection(); // Disconnect void Disconnect(); // Emitted when a complete package received void package_get(const QByteArray&); public slots: // Triggered when a new tcp packet is received void ReadPackage(); void test_package_get(const QByteArray& package) { qDebug() << "[package_get]" << package; } protected: QTcpSocket* socket_ = nullptr; SIZE_TYPE package_size_ = 0; public: Network(); virtual ~Network(); void DisconnectNow(); // Send a QByteArray package void SendPackage(const QByteArray& data); }; class Server : public Network { Q_OBJECT private: QTcpServer* tcp_server_ = nullptr; bool is_connected_ = 0; private slots: void OnConnected() { qDebug() << "[Server]Connected."; } void OnDisconnected() { qDebug() << "[Server]Disconnected."; emit Disconnect(); } // Triggered when a new client connected void SetSocket(); public: Server(); ~Server(); // Get server IP std::vector<QString> GetIP(); // Get server port int GetPort() { return tcp_server_->serverPort(); } }; class Client : public Network { Q_OBJECT private slots: void OnConnected() { qDebug() << "[Client]Connected."; } void OnDisconnected() { qDebug() << "[Client]Disconnected."; qDebug() << "[Client Disconnected]" << socket_->errorString(); emit Disconnect(); } // Check whether connection is ok to emit SuccessConnection void CheckConnect(const QByteArray& package); public: // Connection time limit int timeout_; QTimer* timer; explicit Client(const int& timeout = 5000); ~Client(); // Try to connect void TryConnect(const QString& ip, const int& port); }; #endif // NETWORK_H
21.185567
70
0.646715
[ "vector" ]
7db5c7fa38565c1bb099fd7bbf83beebc4af0d59
9,208
h
C
Source/Runtime/TypeData.h
JoinCAD/CPP-Reflection
61163369b6b3b370c4ce726dbf8e60e441723821
[ "MIT" ]
540
2015-09-18T09:44:57.000Z
2022-03-25T07:23:09.000Z
Source/Runtime/TypeData.h
yangzhengxing/CPP-Reflection
43ec755b7a5c62e3252c174815c2e44727e11e72
[ "MIT" ]
16
2015-09-23T06:37:43.000Z
2020-04-10T15:40:08.000Z
Source/Runtime/TypeData.h
yangzhengxing/CPP-Reflection
43ec755b7a5c62e3252c174815c2e44727e11e72
[ "MIT" ]
88
2015-09-21T15:12:32.000Z
2021-11-30T14:07:34.000Z
/* ---------------------------------------------------------------------------- ** Copyright (c) 2016 Austin Brunkhorst, All Rights Reserved. ** ** TypeData.h ** --------------------------------------------------------------------------*/ #pragma once #include "MetaManager.h" #include "Constructor.h" #include "Destructor.h" #include "Field.h" #include "Global.h" #include "Method.h" #include "Function.h" #include "Enum.h" #include "EnumContainer.h" namespace ursine { namespace meta { class ReflectionDatabase; struct TypeData { bool isEnum : 1; bool isPrimitive : 1; bool isSigned : 1; bool isFloatingPoint : 1; bool isPointer : 1; bool isClass : 1; MetaManager meta; std::string name; // enum type Enum enumeration; // class type Type::Set baseClasses; Type::Set derivedClasses; Constructor arrayConstructor; Destructor destructor; std::unordered_map< InvokableSignature, Constructor > constructors; std::unordered_map< InvokableSignature, Constructor > dynamicConstructors; std::vector<Field> fields; std::vector<Global> staticFields; std::unordered_map< std::string, InvokableOverloadMap<Method> > methods; std::unordered_map< std::string, InvokableOverloadMap<Function> > staticMethods; /////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////// TypeData(void); TypeData(const std::string &name); void LoadBaseClasses( ReflectionDatabase &db, TypeID thisType, const std::initializer_list<Type> &classes ); /////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////// template<typename ClassType, bool IsDynamic, bool IsWrapped, typename ...Args> void AddConstructor( const MetaManager::Initializer &meta ); template<typename ClassType> void SetArrayConstructor(void); const Constructor &GetConstructor( const InvokableSignature &signature ); const Constructor &GetDynamicConstructor( const InvokableSignature &signature ); /////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////// template<typename ClassType> void SetDestructor(void); /////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////// // Method Getter, Method Setter template<typename ClassType, typename FieldType, typename GetterReturnType, typename SetterArgumentType> void AddField( const std::string &name, GetterReturnType (ClassType::*methodGetter)(void), void (ClassType::*methodSetter)(SetterArgumentType), const MetaManager::Initializer &meta ); // Const Method Getter, Method Setter template<typename ClassType, typename FieldType, typename GetterReturnType, typename SetterArgumentType> void AddField( const std::string &name, GetterReturnType (ClassType::*methodGetter)(void) const, void (ClassType::*methodSetter)(SetterArgumentType), const MetaManager::Initializer &meta ); // Method Getter, Field Setter template<typename ClassType, typename FieldType, typename GetterReturnType> void AddField( const std::string &name, GetterReturnType (ClassType::*methodGetter)(void), typename FieldSetter<ClassType, FieldType, false>::Signature fieldSetter, const MetaManager::Initializer &meta ); // Const Method Getter, Field Setter template<typename ClassType, typename FieldType, typename GetterReturnType> void AddField( const std::string &name, GetterReturnType (ClassType::*methodGetter)(void) const, typename FieldSetter<ClassType, FieldType, false>::Signature fieldSetter, const MetaManager::Initializer &meta ); // Field Getter, Method Setter template<typename ClassType, typename FieldType, typename SetterArgumentType> void AddField( const std::string &name, typename FieldGetter<ClassType, FieldType, false>::Signature fieldGetter, void (ClassType::*methodSetter)(SetterArgumentType), const MetaManager::Initializer &meta ); // Field Getter, Field Setter template<typename ClassType, typename FieldType> void AddField( const std::string &name, typename FieldGetter<ClassType, FieldType, false>::Signature fieldGetter, typename FieldSetter<ClassType, FieldType, false>::Signature fieldSetter, const MetaManager::Initializer &meta ); const Field &GetField(const std::string &name) const; /////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////// // Method Getter, Method Setter template<typename ClassType, typename FieldType, typename GetterType, typename SetterType> void AddStaticField( const std::string &name, GetterType getter, SetterType setter, const MetaManager::Initializer &meta ); // Method Getter, Field Setter template<typename ClassType, typename FieldType, typename GetterType> void AddStaticField( const std::string &name, GetterType getter, FieldType *fieldSetter, const MetaManager::Initializer &meta ); // Field Getter, Method Setter template<typename ClassType, typename FieldType, typename SetterType> void AddStaticField( const std::string &name, FieldType *fieldGetter, SetterType setter, const MetaManager::Initializer &meta ); // Field Getter, Field Setter template<typename ClassType, typename FieldType> void AddStaticField( const std::string &name, FieldType *fieldGetter, FieldType *fieldSetter, const MetaManager::Initializer &meta ); const Global &GetStaticField(const std::string &name) const; /////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////// template<typename MethodType> void AddMethod( const std::string &name, MethodType method, const MetaManager::Initializer &meta ); const Method &GetMethod( const std::string &name ); const Method &GetMethod( const std::string &name, const InvokableSignature &signature ); /////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////// template< typename ClassType, typename FunctionType > void AddStaticMethod( const std::string &name, FunctionType function, const MetaManager::Initializer &meta ); const Function &GetStaticMethod( const std::string &name ); const Function &GetStaticMethod( const std::string &name, const InvokableSignature &signature ); /////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////// template<typename EnumType> void SetEnum( const std::string &name, const typename EnumContainer<EnumType>::Initializer &initalizer ); }; } } #include "Impl/TypeData.hpp"
34.230483
116
0.46199
[ "vector" ]
7dba669fcc6fc2136a21df4b9be2ac40409c0cba
2,318
h
C
Infovis/vtkUnivariateStatisticsAlgorithmPrivate.h
garyc618/GitTagBug
0b1cdbf5a6f6b9b23fa03ff1d9f4a84953831864
[ "BSD-3-Clause" ]
1
2019-05-31T06:45:40.000Z
2019-05-31T06:45:40.000Z
Infovis/vtkUnivariateStatisticsAlgorithmPrivate.h
garyc618/GitTagBug
0b1cdbf5a6f6b9b23fa03ff1d9f4a84953831864
[ "BSD-3-Clause" ]
null
null
null
Infovis/vtkUnivariateStatisticsAlgorithmPrivate.h
garyc618/GitTagBug
0b1cdbf5a6f6b9b23fa03ff1d9f4a84953831864
[ "BSD-3-Clause" ]
null
null
null
/*========================================================================= Program: Visualization Toolkit Module: vtkUnivariateStatisticsAlgorithmPrivate.h Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen All rights reserved. See Copyright.txt or http://www.kitware.com/Copyright.htm for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notice for more information. =========================================================================*/ /*------------------------------------------------------------------------- Copyright 2008 Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains certain rights in this software. -------------------------------------------------------------------------*/ // .NAME vtkDescriptiveStatistics - Private implementation for univariate // statistics algorithms. // // .SECTION Description // The main purpose of this class is to avoid exposure of STL container // through the APIs of the vtkStatistics classes APIs // // .SECTION Thanks // Thanks to Philippe Pebay and David Thompson from Sandia National Laboratories // for implementing this class. #ifndef __vtkUnivariateStatisticsAlgorithmPrivate_h #define __vtkUnivariateStatisticsAlgorithmPrivate_h #include "vtkStdString.h" #include <vtkstd/set> // used to iterate over internal organs #if defined( _MSC_VER ) && _MSC_VER < 1300 // Eliminate the following VS60 warning: // warning C4786: // 'Std::pair<Std::_Tree<int,int,Std::set<int,Std::less<int>,Std::allocator<int> >::_Kfn,Std::less<int>,Std::allocator<int> >::const_iterator,Std::_Tree<int,int,Std::set<int,Std::less<int>,Std::allocator<int> >::_Kfn,Std::less<int>,Std::allocator<int> >::const_iterator>' : // identifier was truncated to '255' characters in the debug informationwarning C4611: interaction between '_setjmp' and C++ object # pragma warning ( disable : 4786 ) #endif class vtkUnivariateStatisticsAlgorithmPrivate { public: vtkUnivariateStatisticsAlgorithmPrivate() { } ~vtkUnivariateStatisticsAlgorithmPrivate() { } vtkstd::set<vtkStdString> Selection; }; #endif // __vtkUnivariateStatisticsAlgorithmPrivate_h
38.633333
273
0.673425
[ "object" ]
7dbe737a762b2fb3bd9369ffaa3f47e937c2e809
407
h
C
vision-cpp-gevorderden/Utils.h
yorickr/VisionCPP
60eda392d7b4f234afba7d4e29d746d1ae3c8e1c
[ "MIT" ]
null
null
null
vision-cpp-gevorderden/Utils.h
yorickr/VisionCPP
60eda392d7b4f234afba7d4e29d746d1ae3c8e1c
[ "MIT" ]
null
null
null
vision-cpp-gevorderden/Utils.h
yorickr/VisionCPP
60eda392d7b4f234afba7d4e29d746d1ae3c8e1c
[ "MIT" ]
null
null
null
#ifndef UTILS_H #define UTILS_H #include "includes.h" #include <vector> bool pixelInContour(const std::vector<cv::Point>& contour, cv::Point pixel); template <typename T> bool elementInVector(const std::vector<T> vector, T element); #endif template<typename T> inline bool elementInVector(const std::vector<T> vector, T element) { return find(vector.begin(), vector.end(), element) != vector.end(); }
21.421053
76
0.737101
[ "vector" ]
7dc41892eee3d5899122d1bc93ba88642dc382b2
2,383
h
C
src/CommandQueue.h
daemyung/opencl
e696f8d5dbea3172df129448fe4466f2c36727e2
[ "Apache-2.0" ]
null
null
null
src/CommandQueue.h
daemyung/opencl
e696f8d5dbea3172df129448fe4466f2c36727e2
[ "Apache-2.0" ]
null
null
null
src/CommandQueue.h
daemyung/opencl
e696f8d5dbea3172df129448fe4466f2c36727e2
[ "Apache-2.0" ]
null
null
null
/*********************************************************************************************************************** * Copyright (c) 2022-2022 Daemyung Jang. * * 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 CLMTL_COMMAND_QUEUE_H #define CLMTL_COMMAND_QUEUE_H #include <array> #include <vector> #include <CL/cl_icd.h> #include <Metal/Metal.hpp> #include "Object.h" #ifdef __cplusplus extern "C" { #endif struct _cl_command_queue { cl_icd_dispatch *Dispatch; }; #ifdef __cplusplus } //extern "C" #endif namespace cml { class Context; class Device; class Buffer; class Kernel; class Event; class CommandQueue : public _cl_command_queue, public Object { public: static CommandQueue *DownCast(cl_command_queue commandQueue); public: CommandQueue(Context *context, Device *device); ~CommandQueue() override; void EnqueueReadBuffer(Buffer *srcBuffer, void *dstData, size_t offset, size_t size); void EnqueueWriteBuffer(const void *srcData, Buffer *dstBuffer, size_t offset, size_t size); void EnqueueDispatch(Kernel *kernel, const std::array<size_t, 3> &globalWorkSize); void EnqueueDispatch(Kernel *kernel, const std::array<size_t, 3> &globalWorkSize, const std::array<size_t, 3> &localWorkSize); void EnqueueSignalEvent(Event *event); void EnqueueWaitEvent(Event *event); void Flush(); void WaitIdle(); Context *GetContext() const; Device *GetDevice() const; private: Context *mContext; Device *mDevice; MTL::CommandQueue *mCommandQueue; MTL::CommandBuffer *mCommandBuffer; std::vector<MTL::CommandBuffer *> mCommittedCommandBuffer; void InitCommandQueue(); void InitCommandBuffer(); }; } //namespace cml #endif //CLMTL_COMMAND_QUEUE_H
29.7875
120
0.659673
[ "object", "vector" ]
7dc83b3c62d13f995ddbc7b038766618d0e01f69
1,873
h
C
BlackVision/Applications/LibBVLogic/Source/bvApp.h
black-vision-engine/bv-engine
85089d41bb22afeaa9de070646e12aa1777ecedf
[ "MIT" ]
1
2022-01-28T11:43:47.000Z
2022-01-28T11:43:47.000Z
BlackVision/Applications/LibBVLogic/Source/bvApp.h
black-vision-engine/bv-engine
85089d41bb22afeaa9de070646e12aa1777ecedf
[ "MIT" ]
null
null
null
BlackVision/Applications/LibBVLogic/Source/bvApp.h
black-vision-engine/bv-engine
85089d41bb22afeaa9de070646e12aa1777ecedf
[ "MIT" ]
null
null
null
#pragma once #include "Application/WindowedApplication.h" //pablito #include "LicenseManager.h" #include "VideoCardManager.h" namespace bv { namespace model { class BasicNode; class ModelScene; } class Renderer; class SceneNode; class Camera; class MockFrameReader; class ProcessManager; class BVAppLogic; class BlackVisionApp : public WindowedApplication { protected: BVAppLogic * m_app; public: static bool m_sWindowedApplicationInitialized; public: static void MainInitializer ( int argc, char * argv[] ); static void LoggerInitializer ( int argc, char * argv[] ); static bool RegisterInitializer (); static void RegisterLogicInitializers (); public: BlackVisionApp (); ~BlackVisionApp (); virtual void OnKey ( unsigned char c ) override; virtual void OnMouse ( MouseAction action, int posX, int posY ) override; virtual void OnPreidle () override; virtual bool OnIdle () override; virtual void OnPreMainLoop () override; virtual bool OnInitialize () override; virtual void OnTerminate () override; virtual void OnResize ( int w, int h ) override; protected: void InitializeConsole (); void InitializeProfiling (); void InitializeAppLogic (); void DeinitializeAppLogic (); void InitializeSelfState (); // pablito bool InitializeLicenses (); virtual void PostFrame (); private: virtual BVAppLogic * CreateAppLogic ( bv::Renderer * renderer, audio::AudioRenderer * audioRenderer ) const; }; } //bv
25.310811
121
0.581954
[ "model" ]
7de50739e3589b19440558c8abcbda33e421e8b4
666
h
C
imPewr/mainwindow.h
vadmus/pewr
6ca99974dabcbe190bedfe332c3001da5f431674
[ "BSD-2-Clause-FreeBSD" ]
1
2021-04-27T07:54:32.000Z
2021-04-27T07:54:32.000Z
imPewr/mainwindow.h
vadmus/pewr
6ca99974dabcbe190bedfe332c3001da5f431674
[ "BSD-2-Clause-FreeBSD" ]
null
null
null
imPewr/mainwindow.h
vadmus/pewr
6ca99974dabcbe190bedfe332c3001da5f431674
[ "BSD-2-Clause-FreeBSD" ]
1
2019-01-28T14:44:52.000Z
2019-01-28T14:44:52.000Z
#ifndef MAINWINDOW_H #define MAINWINDOW_H #include <QtGui> //#include <QMainWindow> class QAction; class MainWindow : public QMainWindow { Q_OBJECT public: MainWindow(); private slots: openImageSeries(); //QFileDialog dialog(this); //dialog.setFileMode(QFileDialog::AnyFile); private: // Top toolbar // File menu QMenu *fileMenu; QAction *openDatasetAction; QAction *openImageSeriesAction; QAction *saveDatasetAction; QAction *closeAction; //QLabel *testing; // Image data // vector<ArrayReal *> imageStack; //QFileDialog *filename; void createActions(); QAction *openImageSeriesAction; signals: //private slots: }; #endif
12.109091
44
0.726727
[ "vector" ]
7df423fceebca4cf768de1c25e9800ba0b958d33
812
h
C
core/connections/wim/packets/get_user_last_seen.h
Qt-Widgets/im-desktop-imported
85fed419229597bc10de59de268f5d898f853405
[ "Apache-2.0" ]
524
2016-03-16T10:17:28.000Z
2019-12-29T02:58:56.000Z
core/connections/wim/packets/get_user_last_seen.h
Qt-Widgets/im-desktop-imported-widgets-collection
85fed419229597bc10de59de268f5d898f853405
[ "Apache-2.0" ]
68
2016-03-16T16:23:17.000Z
2019-09-20T22:37:28.000Z
core/connections/wim/packets/get_user_last_seen.h
Qt-Widgets/im-desktop-imported-widgets-collection
85fed419229597bc10de59de268f5d898f853405
[ "Apache-2.0" ]
142
2016-03-16T10:25:03.000Z
2019-12-26T14:08:47.000Z
#pragma once #include "../robusto_packet.h" #include "../chat_info.h" namespace core { namespace tools { class http_request_simple; } } namespace core { namespace wim { class get_user_last_seen: public robusto_packet { virtual int32_t init_request(std::shared_ptr<core::http_request_simple> _request) override; virtual int32_t parse_results(const rapidjson::Value& _node_results) override; std::map<std::string, time_t> result_; std::vector<std::string> aimids_; public: get_user_last_seen(wim_packet_params _params, const std::vector<std::string>& _aimids); virtual ~get_user_last_seen(); const std::map<std::string, time_t>& get_result() const; }; } }
21.368421
103
0.628079
[ "vector" ]
7df9656c6ce9b46f2e39d074ca9b4e971f31c261
20,020
c
C
kernel/kern/bootstrap.c
Prajna/mach
9c2e1a8d77f84256568f604f74311f23ccce2d9e
[ "BSD-4-Clause", "BSD-3-Clause" ]
27
2015-03-06T06:47:58.000Z
2021-11-06T02:01:26.000Z
kernel/kern/bootstrap.c
Prajna/mach
9c2e1a8d77f84256568f604f74311f23ccce2d9e
[ "BSD-4-Clause", "BSD-3-Clause" ]
null
null
null
kernel/kern/bootstrap.c
Prajna/mach
9c2e1a8d77f84256568f604f74311f23ccce2d9e
[ "BSD-4-Clause", "BSD-3-Clause" ]
11
2015-08-16T02:07:39.000Z
2020-06-02T17:42:14.000Z
/* * Mach Operating System * Copyright (c) 1992-1989 Carnegie Mellon University * All Rights Reserved. * * Permission to use, copy, modify and distribute this software and its * documentation is hereby granted, provided that both the copyright * notice and this permission notice appear in all copies of the * software, derivative works or modified versions, and any portions * thereof, and that both notices appear in supporting documentation. * * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. * * Carnegie Mellon requests users of this software to return to * * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU * School of Computer Science * Carnegie Mellon University * Pittsburgh PA 15213-3890 * * any improvements or extensions that they make and grant Carnegie Mellon * the rights to redistribute these changes. */ /* * HISTORY * $Log: bootstrap.c,v $ * Revision 2.31 93/03/26 17:54:41 mrt * Changed boot_map to be palatable to vm_object_page_map(). * ANSIfied (except for varargs functions). * [93/03/23 af] * * Revision 2.30 93/03/09 12:26:38 danner * String protos. * [93/03/07 af] * * Revision 2.29 93/02/05 07:51:14 danner * Alpha like mips, has machdep init flags. * [93/02/04 01:56:09 af] * * 64bit cleanup. Added a magic number to the boot label. * Changed ovbcopy_ints to be quicker where it can. * [92/11/30 af] * * Revision 2.28 92/08/03 17:36:37 jfriedl * removed silly prototypes * [92/08/02 jfriedl] * * Revision 2.27 92/05/21 17:12:55 jfriedl * Removed unused variable 'port' from bootstrap_create(). * Cleanup to quiet gcc warnings. * [92/05/16 jfriedl] * * Revision 2.26 92/05/04 11:26:09 danner * Set load_bootstrap_symbols from bootstrap_symbols option file. * [92/05/03 danner] * * Revision 2.25 92/04/01 19:33:06 rpd * Fixed ovbcopy_ints to handle zero size. * [92/03/13 rpd] * * Revision 2.24 92/02/26 13:12:51 elf * Added protect in copy_bootstrap against zero size bss. * [92/02/26 danner] * * Revision 2.23 92/02/19 16:46:30 elf * Change -a switch into -q switch. * Do not load the default-pager's symtable by default, * it gets in the way of debugging UX. * [92/02/10 17:50:23 af] * * Revision 2.22 92/02/18 18:00:12 elf * Added global load_fault_in_text to force the faulting in of the * bootstrap task text. Useful for debugging. * [92/02/14 danner] * * Revision 2.21 92/01/03 20:13:43 dbg * Move bootstrap code out to user space. * Mac2 and iPSC-dependent code must be moved there also. * [91/12/18 dbg] * * Revision 2.20 91/12/10 16:32:40 jsb * Fixes from Intel * [91/12/10 15:51:50 jsb] * * Revision 2.19 91/11/12 11:51:53 rvb * Added task_insert_send_right. * Changed BOOTSTRAP_MAP_SIZE to 4 meg. * [91/11/12 rpd] * * Revision 2.18 91/09/12 16:37:49 bohman * Made bootstrap task call mac2 machine dependent code before running * 'startup', which is loaded from the UX file system. This needs to * be handled more generally in the future. * [91/09/11 17:07:59 bohman] * * Revision 2.17 91/08/28 11:14:22 jsb * Changed msgh_kind to msgh_seqno. * [91/08/10 rpd] * * Revision 2.16 91/08/03 18:18:45 jsb * Moved bootstrap query earlier. Removed all NORMA specific code. * [91/07/25 18:25:35 jsb] * * Revision 2.15 91/07/31 17:44:14 dbg * Pass host port to boot_load_program and read_emulator_symbols. * [91/07/30 17:02:40 dbg] * * Revision 2.14 91/07/01 08:24:54 jsb * Removed notion of master/slave. Instead, refuse to start up * a bootstrap task whenever startup_name is null. * [91/06/29 16:48:14 jsb] * * Revision 2.13 91/06/19 11:55:57 rvb * Ask for startup program to override default. * [91/06/18 21:39:17 rvb] * * Revision 2.12 91/06/17 15:46:51 jsb * Renamed NORMA conditionals. * [91/06/17 10:49:04 jsb] * * Revision 2.11 91/06/06 17:06:53 jsb * Allow slaves to act as masters (for now). * [91/05/13 17:36:17 jsb] * * Revision 2.10 91/05/18 14:31:32 rpd * Added argument to kernel_thread. * [91/04/03 rpd] * * Revision 2.9 91/05/14 16:40:06 mrt * Correcting copyright * * Revision 2.8 91/02/05 17:25:42 mrt * Changed to new Mach copyright * [91/02/01 16:11:22 mrt] * * Revision 2.7 90/12/14 11:01:58 jsb * Changes to NORMA_BOOT support. Use real device port, not a proxy; * new device forwarding code handles forwarding of requests. * Have slave not bother starting bootstrap task if there is nothing * for it to run. * [90/12/13 21:37:57 jsb] * * Revision 2.6 90/09/28 16:55:30 jsb * Added NORMA_BOOT support. * [90/09/28 14:04:43 jsb] * * Revision 2.5 90/06/02 14:53:39 rpd * Load emulator symbols. * [90/05/11 16:58:37 rpd] * * Made bootstrap_task available externally. * [90/04/05 rpd] * Converted to new IPC. * [90/03/26 22:03:39 rpd] * * Revision 2.4 90/01/11 11:43:02 dbg * Initialize bootstrap print routines. Remove port number * printout. * [89/12/20 dbg] * * Revision 2.3 89/11/29 14:09:01 af * Enlarged the bootstrap task's map to accomodate some unnamed * greedy RISC box. Sigh. * [89/11/07 af] * Made root_name and startup_name non-preallocated, so that * they can be changed at boot time on those machines like * mips and Sun where the boot loader passes command line * arguments to the kernel. * [89/10/28 af] * * Revision 2.2 89/09/08 11:25:02 dbg * Pass root partition name to default_pager_setup. * [89/08/31 dbg] * * Assume that device service has already been created. * Create bootstrap task here and give it the host and * device ports. * [89/08/01 dbg] * * Call default_pager_setup. * [89/07/11 dbg] * * 12-Apr-89 David Golub (dbg) at Carnegie-Mellon University * Removed console_port. * */ /* * Bootstrap the various built-in servers. */ #include <mach_kdb.h> #include <bootstrap_symbols.h> #include <mach/port.h> #include <mach/message.h> #include <mach/vm_param.h> #include <ipc/ipc_port.h> #include <kern/host.h> #include <kern/strings.h> #include <kern/task.h> #include <kern/thread.h> #include <vm/vm_kern.h> #include <device/device_port.h> #include <sys/varargs.h> #include <mach/boot_info.h> #if MACH_KDB #include <machine/db_machdep.h> #include <ddb/db_sym.h> #endif /* * Bootstrap image is moved out of BSS at startup. */ vm_offset_t boot_start = 0; /* pointer to bootstrap image */ vm_size_t boot_size = 0; /* size of bootstrap image */ vm_offset_t load_info_start = 0; /* pointer to bootstrap load info */ vm_size_t load_info_size = 0; /* size of bootstrap load info */ vm_offset_t kern_sym_start = 0; /* pointer to kernel symbols */ vm_size_t kern_sym_size = 0; /* size of kernel symbols */ #if DEBUG load_info_print() { struct loader_info *lp = (struct loader_info *)load_info_start; printf("Load info: text (%#x, %#x, %#x)\n", lp->text_start, lp->text_size, lp->text_offset); printf(" data (%#x, %#x, %#x)\n", lp->data_start, lp->data_size, lp->data_offset); printf(" bss (%#x)\n", lp->bss_size); printf(" syms (%#x, %#x)\n", lp->sym_offset, lp->sym_size); printf(" entry(%#x, %#x)\n", lp->entry_1, lp->entry_2); } #endif /* * Moves kernel symbol table, bootstrap image, and bootstrap * load information out of BSS at startup. Returns the * first unused address. * * PAGE_SIZE must be set. * * On some machines, this code must run before the page * tables are set up, and therefore must be re-created * in assembly language. */ void ovbcopy_ints( vm_offset_t src, vm_offset_t dst, vm_size_t size) { register vm_size_t *srcp; register vm_size_t *dstp; register unsigned int count; srcp = (vm_size_t *)(src + size); dstp = (vm_size_t *)(dst + size); count = size / sizeof(vm_size_t); while (count-- != 0) *--dstp = *--srcp; } extern char edata[]; /* start of BSS */ extern char end[]; /* end of BSS */ vm_offset_t move_bootstrap() { register struct boot_info *bi = (struct boot_info *)edata; /* * Tolerate some "imprecision" in a certain linker */ if (bi->magic_number != MACH_BOOT_INFO_MAGIC) { register vm_size_t *addr, *erange; addr = (vm_size_t *)edata; erange = (vm_size_t *)(edata + PAGE_SIZE); while (addr < erange) { bi = (struct boot_info *) ++addr; if (bi->magic_number == MACH_BOOT_INFO_MAGIC) break; } if (bi->magic_number != MACH_BOOT_INFO_MAGIC) return 0; /* good luck.. */ } kern_sym_start = (vm_offset_t) end; kern_sym_size = bi->sym_size; /* * Align start of bootstrap on page boundary, * to allow mapping into user space. */ boot_start = round_page(kern_sym_start + kern_sym_size); boot_size = bi->boot_size; load_info_start = boot_start + boot_size; load_info_size = bi->load_info_size; ovbcopy_ints((vm_offset_t)bi + sizeof(struct boot_info) + kern_sym_size, boot_start, boot_size + load_info_size); ovbcopy_ints((vm_offset_t)bi + sizeof(struct boot_info), kern_sym_start, kern_sym_size); return boot_start + boot_size + load_info_size; } /* */ mach_port_t boot_device_port; /* local name */ mach_port_t boot_host_port; /* local name */ void user_bootstrap(); /* forward */ extern char *root_name; mach_port_t task_insert_send_right( task_t task, ipc_port_t port) { mach_port_t name; for (name = 1;; name++) { kern_return_t kr; kr = mach_port_insert_right(task->itk_space, name, (ipc_object_t)port, MACH_MSG_TYPE_PORT_SEND); if (kr == KERN_SUCCESS) break; assert(kr == KERN_NAME_EXISTS); } return name; } void bootstrap_create() { task_t bootstrap_task; thread_t bootstrap_thread; if (boot_size == 0) { printf("Not starting bootstrap task.\n"); return; } /* * Create the bootstrap task. */ (void) task_create(TASK_NULL, FALSE, &bootstrap_task); (void) thread_create(bootstrap_task, &bootstrap_thread); /* * Insert send rights to the master host and device ports. */ boot_host_port = task_insert_send_right(bootstrap_task, ipc_port_make_send(realhost.host_priv_self)); boot_device_port = task_insert_send_right(bootstrap_task, ipc_port_make_send(master_device_port)); /* * Start the bootstrap thread. */ thread_start(bootstrap_thread, user_bootstrap); (void) thread_resume(bootstrap_thread); } /* * The following code runs as the kernel mode portion of the * first user thread. */ /* * Convert an unsigned integer to its decimal representation. */ void itoa( char *str, vm_size_t num) { char buf[sizeof(vm_size_t)*2+3]; register char *np; np = buf + sizeof(buf); *--np = 0; do { *--np = '0' + num % 10; num /= 10; } while (num != 0); strcpy(str, np); } /* * Parse the boot flags into an argument string. * Format as a standard flag argument: '-qsdn...' */ #include <sys/reboot.h> static void get_boot_flags( char str[]) /* OUT */ { register char *cp; register int bflag; #if defined(mips) || defined(alpha) extern char *machine_get_boot_flags(); cp = machine_get_boot_flags(str); #else cp = str; *cp++ = '-'; #endif bflag = boothowto; if (bflag & RB_ASKNAME) *cp++ = 'q'; if (bflag & RB_SINGLE) *cp++ = 's'; #if MACH_KDB if (bflag & RB_KDB) *cp++ = 'd'; #endif MACH_KDB if (bflag & RB_INITNAME) *cp++ = 'n'; if (cp == &str[1]) /* no flags */ *cp++ = 'x'; *cp = '\0'; } /* * Copy boot_data (executable) to the user portion of this task. */ boolean_t load_protect_text = TRUE; #if MACH_KDB /* if set, fault in the text segment */ boolean_t load_fault_in_text = TRUE; #endif vm_offset_t boot_map( void * data, /* private data */ vm_offset_t offset) /* offset to map */ { vm_offset_t start_offset = (vm_offset_t) data; return pmap_extract(kernel_pmap, start_offset + offset); } #if BOOTSTRAP_SYMBOLS boolean_t load_bootstrap_symbols = TRUE; #else boolean_t load_bootstrap_symbols = FALSE; #endif void copy_bootstrap( vm_offset_t *entry) { struct loader_info *lp; vm_offset_t text_page_start, text_page_end, data_page_start, bss_start, bss_page_start, bss_page_end; register vm_map_t user_map = current_task()->map; vm_object_t boot_object; vm_size_t bss_size; /* * Point to bootstrap load information. */ lp = (struct loader_info *)load_info_start; /* * We assume that makeboot has aligned the various * pieces of the bootstrap image on page boundaries. */ assert(lp->text_start == trunc_page(lp->text_start)); assert(lp->data_start == trunc_page(lp->data_start)); assert(lp->text_offset == trunc_page(lp->text_offset)); assert(lp->data_offset == trunc_page(lp->data_offset) || lp->data_offset == lp->text_offset + lp->text_size); /* * Find how much virtual space we have to allocate. */ text_page_start = trunc_page(lp->text_start); text_page_end = round_page(lp->text_start + lp->text_size); data_page_start = trunc_page(lp->data_start); bss_start = lp->data_start + lp->data_size; bss_page_start = trunc_page(bss_start); bss_page_end = round_page(bss_start + lp->bss_size); bss_size = bss_page_end - bss_page_start; /* * Create an object that maps the pages in the * bootstrap image. Map only until the end of the last * whole page. */ boot_size = lp->data_offset + bss_page_start - lp->data_start; boot_object = vm_object_allocate(boot_size); vm_object_page_map(boot_object, (vm_offset_t) 0, /* from boot_start */ boot_size, boot_map, (char *)boot_start); /* * Map the text and data from the boot image into * the user task. Map the data area only through * the last whole page of data - the next page of * data is split between data and bss, and must be * partially cleared. */ if (text_page_end >= data_page_start) { /* * One contiguous area for text and data. */ (void) vm_map_enter(user_map, &text_page_start, (vm_size_t) (bss_page_start - text_page_start), (vm_offset_t) 0, FALSE, boot_object, lp->text_offset, FALSE, VM_PROT_READ | VM_PROT_WRITE, VM_PROT_ALL, VM_INHERIT_DEFAULT); } else { /* * Separated text and data areas. */ (void) vm_map_enter(user_map, &text_page_start, (vm_size_t)(text_page_end - text_page_start), (vm_offset_t) 0, FALSE, boot_object, lp->text_offset, FALSE, VM_PROT_READ | VM_PROT_WRITE, VM_PROT_ALL, VM_INHERIT_DEFAULT); (void) vm_map_enter(user_map, &data_page_start, (vm_size_t)(bss_page_start - data_page_start), (vm_offset_t) 0, FALSE, boot_object, lp->data_offset, FALSE, VM_PROT_READ | VM_PROT_WRITE, VM_PROT_ALL, VM_INHERIT_DEFAULT); } /* * Allocate the remainder of the data segment and all * of the BSS. Protect against zero size bss. */ if (bss_size) { (void) vm_allocate(user_map, &bss_page_start, (vm_size_t)(bss_size), FALSE); /* * If the data segment does not end on a VM page boundary, * we copy the end of the data segment onto a new page * so that the bss segment will be zero, and so that * we do not overwrite the bootstrap symbol table. */ if (bss_start > bss_page_start) { (void) copyout((char *) boot_start + lp->data_offset + lp->data_size - (bss_start - bss_page_start), (char *)bss_page_start, bss_start - bss_page_start); } } /* * Protect the text. */ if (load_protect_text) (void) vm_protect(user_map, text_page_start, (vm_size_t)(trunc_page(lp->text_start+lp->text_size) - text_page_start), FALSE, VM_PROT_READ|VM_PROT_EXECUTE); #if MACH_KDB /* * Enter the bootstrap symbol table. */ if (load_bootstrap_symbols) (void) X_db_sym_init( (char*) boot_start+lp->sym_offset, (char*) boot_start+lp->sym_offset+lp->sym_size, "bootstrap", (char *) user_map); if (load_fault_in_text) { vm_offset_t lenp = round_page(lp->text_start+lp->text_size) - trunc_page(lp->text_start); vm_offset_t i = 0; while (i < lenp) { vm_fault(user_map, text_page_start +i, load_protect_text ? VM_PROT_READ|VM_PROT_EXECUTE : VM_PROT_READ|VM_PROT_EXECUTE | VM_PROT_WRITE, 0,0,0); i = round_page (i+1); } } #endif MACH_KDB /* * Return the entry points. */ entry[0] = lp->entry_1; entry[1] = lp->entry_2; } /* * Allocate the stack, and build the argument list. */ extern vm_offset_t user_stack_low(); extern vm_offset_t set_user_regs(); void build_args_and_stack(entry, va_alist) vm_offset_t entry; va_dcl { vm_offset_t stack_base; vm_size_t stack_size; va_list argv_ptr; register char * arg_ptr; int arg_len; int arg_count; register char * arg_pos; int arg_item_len; char * string_pos; char * zero = (char *)0; #define STACK_SIZE (64*1024) /* * Calculate the size of the argument list. */ va_start(argv_ptr); arg_len = 0; arg_count = 0; for (;;) { arg_ptr = va_arg(argv_ptr, char *); if (arg_ptr == 0) break; arg_count++; arg_len += strlen(arg_ptr) + 1; } va_end(argv_ptr); /* * Add space for: * arg count * pointers to arguments * trailing 0 pointer * dummy 0 pointer to environment variables * and align to integer boundary */ arg_len += sizeof(integer_t) + (2 + arg_count) * sizeof(char *); arg_len = (arg_len + sizeof(integer_t) - 1) & ~(sizeof(integer_t)-1); /* * Allocate the stack. */ stack_size = round_page(STACK_SIZE); stack_base = user_stack_low(stack_size); (void) vm_allocate(current_task()->map, &stack_base, stack_size, FALSE); arg_pos = (char *) set_user_regs(stack_base, stack_size, entry, arg_len); /* * Start the strings after the arg-count and pointers */ string_pos = arg_pos + sizeof(integer_t) + arg_count * sizeof(char *) + 2 * sizeof(char *); /* * first the argument count */ (void) copyout((char *)&arg_count, arg_pos, sizeof(integer_t)); arg_pos += sizeof(integer_t); /* * Then the strings and string pointers for each argument */ va_start(argv_ptr); while (--arg_count >= 0) { arg_ptr = va_arg(argv_ptr, char *); arg_item_len = strlen(arg_ptr) + 1; /* include trailing 0 */ /* set string pointer */ (void) copyout((char *)&string_pos, arg_pos, sizeof (char *)); arg_pos += sizeof(char *); /* copy string */ (void) copyout(arg_ptr, string_pos, arg_item_len); string_pos += arg_item_len; } va_end(argv_ptr); /* * last, the trailing 0 argument and a null environment pointer. */ (void) copyout((char *)&zero, arg_pos, sizeof(char *)); arg_pos += sizeof(char *); (void) copyout((char *)&zero, arg_pos, sizeof(char *)); } void user_bootstrap() { vm_offset_t entry[2]; char host_string[12]; char device_string[12]; char flag_string[12]; /* * Copy the bootstrap code from boot_data to the user task. */ copy_bootstrap(entry); /* * Convert the host and device ports to strings, * to put in the argument list. */ itoa(host_string, boot_host_port); itoa(device_string, boot_device_port); /* * Get the boot flags, also */ get_boot_flags(flag_string); /* * Build the argument list and insert in the user task. * Argument list is * "bootstrap -<boothowto> <host_port> <device_port> <root_name>" */ build_args_and_stack(entry, "bootstrap", flag_string, host_string, device_string, root_name, (char *)0); /* * Exit to user thread. */ thread_bootstrap_return(); /*NOTREACHED*/ }
24.474328
75
0.662138
[ "object" ]
7dfc71c726509e522b118e9bc0ff7badcdfe3857
1,546
h
C
lib/jxl/enc_entropy_coder.h
zond/libjxl
04267a8780d1600d2bc9a79d161d7f769b5db93c
[ "BSD-3-Clause" ]
453
2021-05-25T15:53:07.000Z
2022-03-30T05:32:31.000Z
lib/jxl/enc_entropy_coder.h
zond/libjxl
04267a8780d1600d2bc9a79d161d7f769b5db93c
[ "BSD-3-Clause" ]
659
2021-05-25T16:33:46.000Z
2022-03-31T14:59:34.000Z
lib/jxl/enc_entropy_coder.h
zond/libjxl
04267a8780d1600d2bc9a79d161d7f769b5db93c
[ "BSD-3-Clause" ]
105
2021-05-25T16:11:10.000Z
2022-03-29T09:52:09.000Z
// Copyright (c) the JPEG XL Project Authors. All rights reserved. // // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. #ifndef LIB_JXL_ENC_ENTROPY_CODER_H_ #define LIB_JXL_ENC_ENTROPY_CODER_H_ #include <stddef.h> #include <stdint.h> #include <stdlib.h> #include <string.h> #include <sys/types.h> #include <memory> #include <utility> #include <vector> #include "lib/jxl/ac_context.h" // BlockCtxMap #include "lib/jxl/ac_strategy.h" #include "lib/jxl/enc_ans.h" #include "lib/jxl/field_encodings.h" #include "lib/jxl/frame_header.h" // YCbCrChromaSubsampling #include "lib/jxl/image.h" // Entropy coding and context modeling of DC and AC coefficients, as well as AC // strategy and quantization field. namespace jxl { // Generate DCT NxN quantized AC values tokens. // Only the subset "rect" [in units of blocks] within all images. // See also DecodeACVarBlock. void TokenizeCoefficients(const coeff_order_t* JXL_RESTRICT orders, const Rect& rect, const int32_t* JXL_RESTRICT* JXL_RESTRICT ac_rows, const AcStrategyImage& ac_strategy, YCbCrChromaSubsampling cs, Image3I* JXL_RESTRICT tmp_num_nzeroes, std::vector<Token>* JXL_RESTRICT output, const ImageB& qdc, const ImageI& qf, const BlockCtxMap& block_ctx_map); } // namespace jxl #endif // LIB_JXL_ENC_ENTROPY_CODER_H_
32.893617
79
0.666882
[ "vector" ]
b4040169907eed5accbb8f64f8a262394db55240
280
h
C
crc32.h
malaterre/charls-tools
fc17bb3bb255cabcaeb10bac0699aff1bf1ee57d
[ "BSD-3-Clause" ]
null
null
null
crc32.h
malaterre/charls-tools
fc17bb3bb255cabcaeb10bac0699aff1bf1ee57d
[ "BSD-3-Clause" ]
1
2022-02-13T18:15:04.000Z
2022-02-24T13:19:08.000Z
crc32.h
malaterre/charls-tools
fc17bb3bb255cabcaeb10bac0699aff1bf1ee57d
[ "BSD-3-Clause" ]
null
null
null
// Copyright (c) Mathieu Malaterre // SPDX-License-Identifier: BSD-3-Clause #pragma once #include <cstdint> #include <string> #include <vector> namespace jlst { class crc32 { public: static std::string compute(std::vector<uint8_t> const& buffer); }; } // end namespace jlst
17.5
67
0.717857
[ "vector" ]
b4179ea92a55725bf9a9f17f559cbc8143a0b0cc
772
h
C
Socket.h
IncredibleReticulation/stimpy
d15732c3179b5bf68d8a2930bdaced6f816b7dbd
[ "WTFPL" ]
1
2015-04-14T22:21:01.000Z
2015-04-14T22:21:01.000Z
Socket.h
IncredibleReticulation/stimpy
d15732c3179b5bf68d8a2930bdaced6f816b7dbd
[ "WTFPL" ]
null
null
null
Socket.h
IncredibleReticulation/stimpy
d15732c3179b5bf68d8a2930bdaced6f816b7dbd
[ "WTFPL" ]
null
null
null
//Socket class header file //Course: 4050-212-02 //Authors: Alex Buie, Luke Matarazzo, Jackson Sadowski, Steven Tucker //Filename: Socket.h #ifndef SOCKET_H #define SOCKET_H #include <iostream> #include <string> #include <vector> #include <sstream> #include "WinSock2.h" using namespace std; class Socket { protected: WSADATA wsaData; SOCKET mySocket; SOCKET myBackup; SOCKET acceptSocket; sockaddr_in myAddress; public: Socket(); //default constructor ~Socket(); //default destructor //communication methods bool sendData(string); bool sendData(int); int recvData(string&); void closeConnection(); int split(vector<string>*, string, string); }; #endif
20.315789
69
0.648964
[ "vector" ]
b4189e4c3980dc135afb05d212c5c0a8d0b8d8a0
2,074
h
C
simplejson_test/srilm-1.7.2/include/ProductVocab.h
rahman-mahmudur/PyART
36591cd10b2b7a560bbcb47a6cf744b72466f92a
[ "Apache-2.0" ]
3
2019-10-24T07:50:29.000Z
2020-05-06T13:08:42.000Z
PyART/srilm-1.7.2/flm/src/ProductVocab.h
PYART0/PyART-demo
9a889662fb2610b7be2687a8304620855e7c76de
[ "Apache-2.0" ]
null
null
null
PyART/srilm-1.7.2/flm/src/ProductVocab.h
PYART0/PyART-demo
9a889662fb2610b7be2687a8304620855e7c76de
[ "Apache-2.0" ]
null
null
null
/* * ProductVocab.h -- * Interface to a product vocabulary for factored language model * A product vocab is a vocabulary consists of words that are the product of * factors. Adding a product word to a product vocab will factor the word * into its factors, add it to its factored vocab, and store the result. * * Copyright (c) 2003 SRI International. All Rights Reserved. * * @(#)$Header: /home/srilm/CVS/srilm/flm/src/ProductVocab.h,v 1.9 2006/08/11 20:47:15 stolcke Exp $ * */ #ifndef _ProductVocab_h_ #define _ProductVocab_h_ #include "Vocab.h" #include "FactoredVocab.h" #include "LHash.h" #include "Array.h" class ProductNgram; class ProductVocab: public Vocab { friend class ProductNgram; public: ProductVocab(VocabIndex start = 0, VocabIndex end = Vocab_None-1); // tie parameters to fvocab virtual VocabIndex &unkIndex() { return fvocab.unkIndex(); }; virtual VocabIndex &ssIndex() { return fvocab.ssIndex(); }; virtual VocabIndex &seIndex() { return fvocab.seIndex(); }; virtual VocabIndex &pauseIndex() { return fvocab.pauseIndex(); }; virtual Boolean &unkIsWord() { return fvocab.unkIsWord(); }; virtual Boolean &toLower() { return fvocab.toLower(); }; virtual VocabString &metaTag() { return fvocab.metaTag(); }; virtual Boolean &nullIsWord() { return fvocab.nullIsWord(); }; /* * Modified Vocab methods */ virtual VocabIndex addWord(VocabString name); virtual VocabString getWord(VocabIndex index); virtual VocabIndex getIndex(VocabString name, VocabIndex unkIndex = Vocab_None); virtual inline Boolean isNonEvent(VocabIndex word) const { return Vocab::isNonEvent(word); } virtual void memStats(MemStats &stats) const; Boolean loadWidFactors(VocabIndex word, VocabIndex *factors); protected: FactoredVocab fvocab; // a map from the ID of a product we have encountered (i.e., in Vocab) // to a vector of ids for each corresponding factor. LHash<VocabIndex, Array<VocabIndex> > productIdToFactorIds; }; #endif /* _ProductVocab_h_ */
30.955224
100
0.711668
[ "vector", "model" ]
b41add54c3d8b1f90b400dd9435cc3e63b46f1fc
2,373
h
C
Descending Europa/Temp/StagingArea/Data/il2cppOutput/UnityEngine_UnityEngine_AssetBundleRequest2154290273MethodDeclarations.h
screwylightbulb/europa
3dcc98369c8066cb2310143329535206751c8846
[ "MIT" ]
11
2016-07-22T19:58:09.000Z
2021-09-21T12:51:40.000Z
Descending Europa/Temp/StagingArea/Data/il2cppOutput/UnityEngine_UnityEngine_AssetBundleRequest2154290273MethodDeclarations.h
screwylightbulb/europa
3dcc98369c8066cb2310143329535206751c8846
[ "MIT" ]
1
2018-05-07T14:32:13.000Z
2018-05-08T09:15:30.000Z
iOS/Classes/Native/UnityEngine_UnityEngine_AssetBundleRequest2154290273MethodDeclarations.h
mopsicus/unity-share-plugin-ios-android
3ee99aef36034a1e4d7b156172953f9b4dfa696f
[ "MIT" ]
null
null
null
#pragma once #include "il2cpp-config.h" #ifndef _MSC_VER # include <alloca.h> #else # include <malloc.h> #endif #include <stdint.h> #include <assert.h> #include <exception> // UnityEngine.AssetBundleRequest struct AssetBundleRequest_t2154290273; // UnityEngine.Object struct Object_t3071478659; // UnityEngine.Object[] struct ObjectU5BU5D_t1015136018; struct AssetBundleRequest_t2154290273_marshaled_pinvoke; struct AssetBundleRequest_t2154290273_marshaled_com; #include "codegen/il2cpp-codegen.h" // System.Void UnityEngine.AssetBundleRequest::.ctor() extern "C" void AssetBundleRequest__ctor_m1736261360 (AssetBundleRequest_t2154290273 * __this, const MethodInfo* method) IL2CPP_METHOD_ATTR; // UnityEngine.Object UnityEngine.AssetBundleRequest::get_asset() extern "C" Object_t3071478659 * AssetBundleRequest_get_asset_m1874521436 (AssetBundleRequest_t2154290273 * __this, const MethodInfo* method) IL2CPP_METHOD_ATTR; // UnityEngine.Object[] UnityEngine.AssetBundleRequest::get_allAssets() extern "C" ObjectU5BU5D_t1015136018* AssetBundleRequest_get_allAssets_m2335877586 (AssetBundleRequest_t2154290273 * __this, const MethodInfo* method) IL2CPP_METHOD_ATTR; // Methods for marshaling struct AssetBundleRequest_t2154290273; struct AssetBundleRequest_t2154290273_marshaled_pinvoke; extern "C" void AssetBundleRequest_t2154290273_marshal_pinvoke(const AssetBundleRequest_t2154290273& unmarshaled, AssetBundleRequest_t2154290273_marshaled_pinvoke& marshaled); extern "C" void AssetBundleRequest_t2154290273_marshal_pinvoke_back(const AssetBundleRequest_t2154290273_marshaled_pinvoke& marshaled, AssetBundleRequest_t2154290273& unmarshaled); extern "C" void AssetBundleRequest_t2154290273_marshal_pinvoke_cleanup(AssetBundleRequest_t2154290273_marshaled_pinvoke& marshaled); // Methods for marshaling struct AssetBundleRequest_t2154290273; struct AssetBundleRequest_t2154290273_marshaled_com; extern "C" void AssetBundleRequest_t2154290273_marshal_com(const AssetBundleRequest_t2154290273& unmarshaled, AssetBundleRequest_t2154290273_marshaled_com& marshaled); extern "C" void AssetBundleRequest_t2154290273_marshal_com_back(const AssetBundleRequest_t2154290273_marshaled_com& marshaled, AssetBundleRequest_t2154290273& unmarshaled); extern "C" void AssetBundleRequest_t2154290273_marshal_com_cleanup(AssetBundleRequest_t2154290273_marshaled_com& marshaled);
49.4375
180
0.870206
[ "object" ]
f1d011693d3be10b5d91588fe4f28359a3b4c4d1
1,650
h
C
Engine/Modules/Render/Include/DirectX/DxWindowManager.h
wanghaiwei/VisReal
e60158e65bae2ee838e73e5009d68c26da84ae74
[ "MIT" ]
1
2020-11-24T09:28:20.000Z
2020-11-24T09:28:20.000Z
Engine/Modules/Render/Include/DirectX/DxWindowManager.h
wanghaiwei/VisReal
e60158e65bae2ee838e73e5009d68c26da84ae74
[ "MIT" ]
null
null
null
Engine/Modules/Render/Include/DirectX/DxWindowManager.h
wanghaiwei/VisReal
e60158e65bae2ee838e73e5009d68c26da84ae74
[ "MIT" ]
null
null
null
/** * Created by rayfalling on 2020/8/29. * * DirectX window manager * Singleton mode to avoid multi window * */ #pragma once #ifndef VISREAL_DX_WINDOW_MANAGER_H #define VISREAL_DX_WINDOW_MANAGER_H #include "IRender/IRenderManager.h" #include "Object/ISingletonObject.h" #include "Platform/Windows/WindowsCore.h" #include "Screen/Screen.h" namespace Engine::Render::DirectX { class DxWindowManager final : public Core::ISingletonObject<DxWindowManager>, public Interface::IRenderManager { // ReSharper disable once CppRedundantQualifier friend class Engine::Core::ISingletonObject<DxWindowManager>; public: void Init() override; void RegisterEvent() override; void SetWindowSize(Screen& screen) override; void SetCursor(bool visible) override; void SetFullScreen(bool full) override; void Shutdown() override; Screen GetFullWindowSize() override; float GetWindowDpi() override; IRenderManager* GetRenderManager() override; Screen& GetScreen(); /* private methods */ private: DxWindowManager(); void CreateAppWindow(Screen& screen); /* set process unaware dpi scale */ static void SetDpiUnaware(); /* set process aware dpi scale */ static void SetDpiAware(); protected: /* Set window size and position */ void FullScreen(); public: /* window message loop */ static void MessageLoop(); /* data member */ private: HINSTANCE _hInstance{}; HWND _hwnd{}; Screen _screen; /* use for stop message loop */ bool _quit = false; }; } static LRESULT CALLBACK MessageProcess(HWND hwnd, UINT uMessage, WPARAM wParam, LPARAM lParam); #endif
21.428571
113
0.720606
[ "render", "object" ]
f1d7ec372282e0bfeb614668a4778e58eeb9c158
2,123
c
C
src/operators/ai.onnx/Softmax/11/prepare_operator__ai_onnx__softmax__11.c
nopeslide/cONNXr
bba7fec8a44892ea546c6407195af635798cab18
[ "MIT" ]
112
2020-01-22T14:59:32.000Z
2022-03-26T15:36:58.000Z
src/operators/ai.onnx/Softmax/11/prepare_operator__ai_onnx__softmax__11.c
nopeslide/cONNXr
bba7fec8a44892ea546c6407195af635798cab18
[ "MIT" ]
83
2020-02-18T12:50:47.000Z
2022-03-11T12:03:34.000Z
src/operators/ai.onnx/Softmax/11/prepare_operator__ai_onnx__softmax__11.c
nopeslide/cONNXr
bba7fec8a44892ea546c6407195af635798cab18
[ "MIT" ]
20
2020-01-14T07:30:20.000Z
2021-09-07T09:29:42.000Z
//this file was generated by ../../../../../../scripts/onnx_generator/OperatorTemplate.py #include "operator__ai_onnx__softmax__11.h" #include "tracing.h" #include "utils.h" operator_status prepare_operator__ai_onnx__softmax__11( node_context *ctx ) { TRACE_ENTRY(1); TRACE_NODE(2, true, ctx->onnx_node); /* UNCOMMENT AS NEEDED */ Onnx__TensorProto *i_input = searchInputByName(ctx, 0); TRACE_TENSOR(2, true, i_input); Onnx__AttributeProto *a_axis = searchAttributeNyName(ctx->onnx_node->n_attribute,ctx->onnx_node->attribute,"axis"); TRACE_ATTRIBUTE(2, a_axis, a_axis); Onnx__TensorProto *o_output = searchOutputByName(ctx, 0); /* ALLOCATE AND INITIALIZE CONTEXT HERE IF NEEDED */ int64_t default_axis = 1; context_operator__ai_onnx__softmax__11 *op_ctx = NULL; op_ctx = malloc(sizeof(context_operator__ai_onnx__softmax__11)); TRACE_FATAL(0 , !op_ctx, "could not allocate executer_context"); op_ctx->axis = a_axis?a_axis->i:default_axis; //wrap axis if negative if (op_ctx->axis < 0) { op_ctx->axis += i_input->n_dims; } op_ctx->N = 1; op_ctx->D = 1; TRACE_VAR(2, true, op_ctx->axis, "%" PRId64); /* INITIALIZE OUTPUTS DATA_TYPE AND SHAPE HERE */ o_output->has_raw_data = 0; o_output->data_type = i_input->data_type; o_output->n_dims = i_input->n_dims; o_output->dims = ARRAYDUP(i_input->dims, i_input->n_dims); for (int i = 0; i < i_input->n_dims; i++) { if (i < op_ctx->axis) { op_ctx->N *= i_input->dims[i]; } else { op_ctx->D *= i_input->dims[i]; } o_output->dims[i] = i_input->dims[i]; } /* MALLOC OUTPUT TENSORS HERE */ mallocTensorData(o_output); TRACE_TENSOR(2, true, o_output); /* CHOOSE EXECUTER AND CONTEXT HERE */ /* YOU MAY USE THE GENERATED RESOLVER */ ctx->executer = resolve_operator__ai_onnx__softmax__11(ctx); ctx->executer_context = op_ctx; TRACE_EXIT(1); /* CHANGE RETURN CODE IF THIS PREPARER IS VALID */ // return OP_ENOSYS; return OP_OK; }
27.217949
119
0.652379
[ "shape" ]
f1d8e8d0f7e4a9b34682dc498ae65051016e1464
1,638
h
C
algorithms/medium/1257. Smallest Common Region.h
MultivacX/letcode2020
f86289f8718237303918a7705ae31625a12b68f6
[ "MIT" ]
null
null
null
algorithms/medium/1257. Smallest Common Region.h
MultivacX/letcode2020
f86289f8718237303918a7705ae31625a12b68f6
[ "MIT" ]
null
null
null
algorithms/medium/1257. Smallest Common Region.h
MultivacX/letcode2020
f86289f8718237303918a7705ae31625a12b68f6
[ "MIT" ]
null
null
null
// 1257. Smallest Common Region // https://leetcode.com/problems/smallest-common-region/ // Runtime: 168 ms, faster than 39.80% of C++ online submissions for Smallest Common Region. // Memory Usage: 57.2 MB, less than 5.10% of C++ online submissions for Smallest Common Region. class Solution { struct Node { Node() {} Node(const string& n) : name(n) {} Node* parent = nullptr; string name; unordered_map<string, Node*> children; }; unordered_map<string, Node*> nodes; Node* getNode(const string& n, Node* parent = nullptr) { Node* node = nullptr; if (nodes.count(n) == 0) { node = new Node(n); nodes.insert({n, node}); } else { node = nodes[n]; } if (parent) node->parent = parent; return node; } public: string findSmallestRegion(vector<vector<string>>& regions, string region1, string region2) { for (const auto& v : regions) { auto node = getNode(v[0]); for (int i = 1; i < v.size(); ++i) node->children[v[i]] = getNode(v[i], node); } unordered_set<string> s; auto n1 = nodes[region1]; auto n2 = nodes[region2]; while (n1 || n2) { if (n1) { if (!s.insert(n1->name).second) return n1->name; n1 = n1->parent; } if (n2) { if (!s.insert(n2->name).second) return n2->name; n2 = n2->parent; } } return ""; } };
30.333333
96
0.495116
[ "vector" ]
f1dd6e88af91d4b5f89b532a3024b0d1324e3f29
50,270
h
C
libOTe/Tools/LDPC/Mtx.h
WeDPR-Team/libOTe
9dc5edb16085f70211e196046fd670812ad7aa46
[ "Unlicense" ]
null
null
null
libOTe/Tools/LDPC/Mtx.h
WeDPR-Team/libOTe
9dc5edb16085f70211e196046fd670812ad7aa46
[ "Unlicense" ]
null
null
null
libOTe/Tools/LDPC/Mtx.h
WeDPR-Team/libOTe
9dc5edb16085f70211e196046fd670812ad7aa46
[ "Unlicense" ]
1
2022-01-19T01:04:52.000Z
2022-01-19T01:04:52.000Z
#pragma once #include <vector> #include <array> #include "cryptoTools/Common/Defines.h" #include "cryptoTools/Common/BitIterator.h" #include "cryptoTools/Common/Log.h" #include "cryptoTools/Common/Matrix.h" #include "cryptoTools/Crypto/RandomOracle.h" #include <cassert> #include <algorithm> #include <set> #include <iostream> namespace osuCrypto { struct Point { u64 mRow, mCol; }; class SparseMtx; struct PointList { PointList(const PointList&) = default; PointList(PointList&&) = default; PointList(u64 r, u64 c) : mRows(r), mCols(c) {} PointList(u64 r, u64 c, span<const Point> pp) : mRows(r), mCols(c) { for (auto p : pp) push_back(p); } using iterator = std::vector<Point>::iterator; u64 mRows, mCols; std::vector<Point> mPoints; #ifndef NDEBUG std::set<std::pair<u64, u64>> ss; #endif void push_back(const Point& p) { if (p.mRow >= mRows) { std::cout << "row out of bounds " << p.mRow << " / " << mRows << std::endl; throw RTE_LOC; } if (p.mCol >= mCols) { std::cout << "col out of bounds " << p.mCol << " / " << mCols << std::endl; throw RTE_LOC; } #ifndef NDEBUG if (ss.insert({ p.mRow , p.mCol }).second == false) { std::cout << "duplicate (" << p.mRow << ", " << p.mCol << ") " << std::endl; throw RTE_LOC; } #endif mPoints.push_back(p); } operator span<Point>() { return mPoints; } iterator begin() { return mPoints.begin(); } iterator end() { return mPoints.end(); } }; class DenseMtx; template<typename T> class Vec { public: std::vector<T> mData; Vec() = default; Vec(const Vec&) = default; Vec(Vec&&) = default; Vec& operator=(const Vec&) = default; Vec& operator=(Vec&&) = default; Vec(u64 size) : mData(size) {} void resize(u64 size) { mData.resize(size); } u64 size() const { return mData.size(); } Vec subVec(u64 offset, u64 size) { Vec v; v.mData.insert(v.mData.end(), mData.begin() + offset, mData.begin() + offset + size); return v; } Vec operator+(const Vec& o) const { if (size() != o.size()) throw RTE_LOC; Vec v = o; for (u64 i = 0; i < size(); ++i) v.mData[i] = v.mData[i] ^ mData[i]; return v; } T& operator[](u64 i) { return mData[i]; } const T& operator[](u64 i)const { return mData[i]; } bool operator==(const Vec<T>& o) const { return mData == o.mData; } bool operator!=(const Vec<T>& o) const { return mData != o.mData; } }; //template<typename T> inline std::ostream& operator<<(std::ostream& o, const Vec<block>& v) { for (u64 i = 0; i < v.size(); ++i) { o << (v[i].as<u64>()[0] &1) << " "; } return o; } class SparseMtx { public: class Row : public span<u64> { public: Row() = default; Row(const Row& r) = default; Row& operator=(const Row& r) = default; explicit Row(const span<u64>& r) { (span<u64>&)* this = r; } //Row& operator=(const span<u64>& r) { (span<u64>&)* this = r; return *this; } }; class Col : public span<u64> { public: Col() = default; Col(const Col& r) = default; Col& operator=(const Col& r) = default; explicit Col(const span<u64>& r) { (span<u64>&)* this = r; } //Col& operator=(const span<u64>& r) { (span<u64>&)* this = r; return *this; } }; class ConstRow : public span<const u64> { public: ConstRow() = default; ConstRow(const ConstRow&) = default; ConstRow(const Row& r) : span<const u64>(r) { }; ConstRow& operator=(const ConstRow&) = default; ConstRow& operator=(const Row& r) { (span<const u64>&)* this = r; return *this; }; }; class ConstCol : public span<const u64> { public: ConstCol() = default; ConstCol(const ConstCol&) = default; ConstCol(const Col& r) : span<const u64>(r) { }; ConstCol& operator=(const ConstCol&) = default; ConstCol& operator=(const Col& c) { (span<const u64>&)* this = c; return *this; }; }; SparseMtx() = default; SparseMtx(const SparseMtx&) = default; SparseMtx(SparseMtx&&) = default; SparseMtx& operator=(const SparseMtx&) = default; SparseMtx& operator=(SparseMtx&&) = default; SparseMtx(PointList& list) { init(list); } SparseMtx(u64 rows, u64 cols, span<Point> points) { init(rows, cols, points); } std::vector<u64> mDataRow, mDataCol; std::vector<Row> mRows; std::vector<Col> mCols; operator PointList() const { return PointList(mRows.size(), mCols.size(), points()); } u64 rows() const { return mRows.size(); } u64 cols() const { return mCols.size(); } Row& row(u64 i) { return mRows[i]; } Col& col(u64 i) { return mCols[i]; } ConstRow row(u64 i) const { return mRows[i]; } ConstCol col(u64 i) const { return mCols[i]; } bool operator()(u64 i, u64 j) const { if (i >= mRows.size() || j >= mCols.size()) throw RTE_LOC; auto iter = std::find(mRows[i].begin(), mRows[i].end(), j); return iter != mRows[i].end(); } block hash() const { oc::RandomOracle ro(sizeof(block)); for (u64 i = 0; i < rows(); ++i) { for (auto j : row(i)) { ro.Update(j); } ro.Update(i); u64 jj = -1; ro.Update(jj); } block b; ro.Final<block>(b); return b; } void init(PointList& list) { init(list.mRows, list.mCols, list.mPoints); } void init(u64 rows, u64 cols, span<Point> points) { std::vector<u64> rowSizes(rows); std::vector<u64> colSizes(cols); #define INSERT_DEBUG #ifdef INSERT_DEBUG std::set<std::pair<u64, u64>> set; #endif // !NDEBUG for (u64 i = 0; i < u64(points.size()); ++i) { #ifdef INSERT_DEBUG auto s = set.insert({ points[i].mRow , points[i].mCol }); if (!s.second) { std::cout << "dup " << points[i].mRow << " " << points[i].mCol << std::endl; abort(); } if (points[i].mRow >= rows) { std::cout << "row out of bounds " << points[i].mRow << " " << rows << std::endl; abort(); } if (points[i].mCol >= cols) { std::cout << "col out of bounds " << points[i].mCol << " " << cols << std::endl; abort(); } #endif ++rowSizes[points[i].mRow]; ++colSizes[points[i].mCol]; } mRows.resize(rows); mCols.resize(cols); mDataRow.resize(points.size()); mDataCol.resize(points.size()); auto iter = mDataRow.data(); for (u64 i = 0; i < rows; ++i) { mRows[i] = Row(span<u64>(iter, iter + rowSizes[i])); iter += rowSizes[i]; rowSizes[i] = 0; } iter = mDataCol.data(); for (u64 i = 0; i < cols; ++i) { mCols[i] = Col(span<u64>(iter, iter + colSizes[i])); iter += colSizes[i]; colSizes[i] = 0; } for (u64 i = 0; i < u64(points.size()); ++i) { auto r = points[i].mRow; auto c = points[i].mCol; auto j = rowSizes[r]++; mRows[r][j] = c; auto k = colSizes[c]++; mCols[c][k] = r; } for (u64 i = 0; i < rows; ++i) { std::sort(row(i).begin(), row(i).end()); } for (u64 i = 0; i < cols; ++i) { std::sort(col(i).begin(), col(i).end()); } #ifndef NDEBUG for (u64 i = 0; i < u64(points.size()); ++i) { auto row = mRows[points[i].mRow]; auto col = mCols[points[i].mCol]; assert(std::find(row.begin(), row.end(), points[i].mCol) != row.end()); assert(std::find(col.begin(), col.end(), points[i].mRow) != col.end()); } #endif } template<typename IdxType> SparseMtx getCols(span<const IdxType> idx) const { PointList pnts(mRows.size(), idx.size()); for (u64 i = 0; i < idx.size(); ++i) { for (auto r : mCols[idx[i]]) { pnts.push_back({ r,i }); } } return pnts; } bool isSet(u64 row, u64 col) { assert(row < rows()); assert(col < cols()); auto iter = std::lower_bound( mCols[col].begin(), mCols[col].end(), row); return iter != mCols[col].end() && *iter == row; } bool validate() { std::vector<span<u64>::iterator> colIters(cols()); for (u64 i = 0; i < cols(); ++i) { colIters[i] = mCols[i].begin(); } for (u64 i = 0; i < rows(); ++i) { if (!std::is_sorted(mRows[i].begin(), mRows[i].end())) return false; for (auto cc : mRows[i]) { if (cc >= cols()) return false; if (colIters[cc] == mCols[cc].end()) return false; if (*colIters[cc] != i) return false; ++colIters[cc]; } } return true; } SparseMtx vConcat(const SparseMtx& o) const { if (cols() != o.cols()) throw RTE_LOC; PointList pPnts = *this; pPnts.mRows += o.rows(); for (auto p : o.points()) { pPnts.push_back({ p.mRow + rows(), p.mCol }); } return pPnts; } SparseMtx subMatrix(u64 row, u64 col, u64 rowCount, u64 colCount) { if (rowCount == 0 || colCount == 0) return {}; SparseMtx R; auto rEnd = row + rowCount; auto cEnd = col + colCount; assert(rows() > row); assert(rows() >= rEnd); assert(cols() > col); assert(cols() >= cEnd); u64 total = 0; std::vector<std::array<span<u64>::iterator, 2>> rowIters(rEnd - row); std::vector<std::array<span<u64>::iterator, 2>> colIters(cEnd - col); for (u64 i = row, ii = 0; i < rEnd; ++i, ++ii) { auto& rowi = mRows[i]; auto iter = std::lower_bound(rowi.begin(), rowi.end(), col); auto end = std::lower_bound(iter, rowi.end(), cEnd); rowIters[ii][0] = iter; rowIters[ii][1] = end; #ifndef NDEBUG for (auto c : span<u64>(iter, end)) { assert(c < cols()); assert(c - col < colCount); } #endif total += end - iter; } for (u64 i = col, ii = 0; i < cEnd; ++i, ++ii) { auto& coli = mCols[i]; auto iter = std::lower_bound(coli.begin(), coli.end(), row); auto end = std::lower_bound(iter, coli.end(), rEnd); colIters[ii][0] = iter; colIters[ii][1] = end; #ifndef NDEBUG for (auto r : span<u64>(iter, end)) { assert(r < rows()); assert(r - row < rowCount); } #endif } R.mDataRow.resize(total); R.mDataCol.resize(total); R.mRows.resize(rEnd - row); R.mCols.resize(cEnd - col); auto iter = R.mDataRow.begin(); for (u64 i = 0; i < rowIters.size(); ++i) { u64 size = (u64)std::distance(rowIters[i][0], rowIters[i][1]); //std::transform(rowIters[i][0], rowIters[i][1], iter, [&](const auto& src) {return src - col; }); for (u64 j = 0; j < size; ++j) { auto& cc = *(rowIters[i][0] + j); auto& dd = *(iter + j); dd = cc - col; assert(dd < colCount); } if (size) R.mRows[i] = Row(span<u64>(&*iter, size)); iter += size; } iter = R.mDataCol.begin(); for (u64 i = 0; i < colIters.size(); ++i) { auto size = (u64)std::distance(colIters[i][0], colIters[i][1]); //std::transform(colIters[i][0], colIters[i][1], iter, [&](const auto& src) {return src - row; }); for (u64 j = 0; j < size; ++j) { auto rr = *(colIters[i][0] + j); *(iter + j) = rr - row; assert(*(iter + j) < rowCount); } if (size) R.mCols[i] = Col(span<u64>(&*iter, size)); iter += size; } assert(R.validate()); return R; } DenseMtx dense() const; std::vector<u8> mult(span<const u8> x) const { std::vector<u8> y(rows()); multAdd(x, y); return y; } template<typename T> Vec<T> mult(const Vec<T>& x) const { Vec<T> y(rows()); multAdd(x, y); return y; } void multAdd(span<const u8> x, span<u8> y) const { assert(cols() == x.size()); assert(y.size() == rows()); for (u64 i = 0; i < rows(); ++i) { for (auto c : row(i)) { assert(c < cols()); y[i] ^= x[c]; } } } template<typename T> void multAdd(const Vec<T>& x, Vec<T>& y) const { assert(cols() == x.size()); assert(y.size() == rows()); for (u64 i = 0; i < rows(); ++i) { for (auto c : row(i)) { assert(c < cols()); y[i] = y[i] ^ x[c]; } } } std::vector<u8> operator*(span<const u8> x) const { return mult(x); } template<typename T> Vec<T> operator*(const Vec<T>& x) const { return mult(x); } void mult(std::vector<u64>& dest, const ConstRow& src) { //assert(src.size() == rows()); //assert(dest.size() == cols()); assert(0); dest.clear(); for (u64 i = 0; i < cols(); ++i) { u64 bit = 0; auto mIter = col(i).begin(); auto mEnd = col(i).end(); auto xIter = src.begin(); auto xEnd = src.end(); while (mIter != mEnd && xIter != xEnd) { if (*mIter < *xIter) ++mIter; else if (*xIter < *mIter) ++xIter; else { bit ^= 1; ++xIter; ++mIter; } } if (bit) dest.push_back(i); } } void mult(std::vector<u64>& dest, const ConstCol& src) { //assert(src.size() == rows()); //assert(dest.size() == cols()); assert(0); dest.clear(); for (u64 i = 0; i < cols(); ++i) { u64 bit = 0; auto mIter = row(i).begin(); auto mEnd = row(i).end(); auto xIter = src.begin(); auto xEnd = src.end(); while (mIter != mEnd && xIter != xEnd) { if (*mIter < *xIter) ++mIter; else if (*xIter < *mIter) ++xIter; else { bit ^= 1; ++xIter; ++mIter; } } if (bit) dest.push_back(i); } } SparseMtx mult(const SparseMtx& X) const { assert(cols() == X.rows()); //SparseMtx y; std::vector<Point> points; //std::vector<u64> res; for (u64 i = 0; i < rows(); ++i) { auto r = this->row(i); for (u64 j = 0; j < X.cols(); ++j) { auto c = X.col(j); u64 bit = 0; span<const u64>::iterator mIter = r.begin(); span<const u64>::iterator mEnd = r.end(); span<const u64>::iterator xIter = c.begin(); span<const u64>::iterator xEnd = c.end(); while (mIter != mEnd && xIter != xEnd) { if (*mIter < *xIter) ++mIter; else if (*xIter < *mIter) ++xIter; else { bit ^= 1; ++xIter; ++mIter; } } if (bit) { points.push_back({ i,j }); } } } return SparseMtx(rows(), X.cols(), points); } SparseMtx operator*(const SparseMtx& X) const { return mult(X); } SparseMtx operator+(const SparseMtx& X) const { return add(X); } bool operator==(const SparseMtx& X) const { return rows() == X.rows() && cols() == X.cols() && mDataCol.size() == X.mDataCol.size() && mDataCol == X.mDataCol; } bool operator!=(const SparseMtx& X) const { return !(*this == X); } SparseMtx add(const SparseMtx& p) const { assert(rows() == p.rows()); assert(cols() == p.cols()); SparseMtx r; r.mDataCol.reserve( p.mDataCol.size() + mDataCol.size()); r.mRows.resize(rows()); r.mCols.resize(cols()); u64 prev = 0; for (u64 i = 0; i < cols(); ++i) { auto c0 = col(i); auto c1 = p.col(i); auto b0 = c0.begin(); auto b1 = c1.begin(); auto e0 = c0.end(); auto e1 = c1.end(); // push the non-zero loctions in order. // skip when they are equal, i.e. 1+1=0 while (b0 != e0 && b1 != e1) { if (*b0 < *b1) r.mDataCol.push_back(*b0++); else if (*b0 > *b1) r.mDataCol.push_back(*b1++); else { ++b0; ++b1; } } // push any extra while (b0 != e0) r.mDataCol.push_back(*b0++); while (b1 != e1) r.mDataCol.push_back(*b1++); r.mCols[i] = Col(span<u64>( r.mDataCol.begin() + prev, r.mDataCol.end())); prev = r.mDataCol.size(); } r.mDataRow.reserve(r.mDataCol.size()); prev = 0; for (u64 i = 0; i < rows(); ++i) { auto c0 = row(i); auto c1 = p.row(i); auto b0 = c0.begin(); auto b1 = c1.begin(); auto e0 = c0.end(); auto e1 = c1.end(); while (b0 != e0 && b1 != e1) { if (*b0 < *b1) r.mDataRow.push_back(*b0++); else if (*b0 > *b1) r.mDataRow.push_back(*b1++); else { ++b0; ++b1; } } while (b0 != e0) r.mDataRow.push_back(*b0++); while (b1 != e1) r.mDataRow.push_back(*b1++); r.mRows[i] = Row(span<u64>( r.mDataRow.begin() + prev, r.mDataRow.end())); prev = r.mDataRow.size(); } return r; } SparseMtx& operator+=(const SparseMtx& p) { *this = add(p); return *this; } SparseMtx invert() const; std::vector<Point> points() const { std::vector<Point> p; p.reserve(mDataCol.size()); for (u64 i = 0; i < rows(); ++i) { for (auto c : row(i)) p.push_back({ i,c }); } return p; } }; inline std::ostream& operator<<(std::ostream& o, const SparseMtx& H) { for (u64 i = 0; i < H.rows(); ++i) { auto row = H.row(i); for (u64 j = 0, jj = 0; j < H.cols(); ++j) { if (jj != (u64)row.size() && j == row[jj]) { if (&o == &std::cout) o << oc::Color::Green << "1 " << oc::Color::Default; else o << "1 "; ++jj; } else o << "0 "; } o << "\n"; } return o; } class DenseMtx { public: // column major. Matrix<block> mData; u64 mRows = 0; DenseMtx() = default; DenseMtx(const DenseMtx&) = default; DenseMtx(DenseMtx&&) = default; DenseMtx& operator=(const DenseMtx&) = default; DenseMtx& operator=(DenseMtx&&) = default; DenseMtx(u64 rows, u64 cols) { resize(rows, cols); } void resize(u64 rows, u64 cols) { mRows = rows; mData.resize(cols, (rows + 127) / 128); } u64 rows() const { return mRows; } u64 cols() const { return mData.rows(); } oc::BitReference operator()(u64 row, u64 col) const { assert(row < rows()); assert(col < cols()); return oc::BitReference((u8*)&mData(col, 0), row); } bool operator==(const DenseMtx& m) const { return rows() == m.rows() && cols() == m.cols() && std::memcmp(mData.data(), m.mData.data(), mData.size() * sizeof(oc::block)) == 0; } struct Row { u64 mIdx; DenseMtx& mMtx; void swap(const Row& r) { assert(mMtx.cols() == r.mMtx.cols()); for (u64 colIdx = 0; colIdx < mMtx.cols(); ++colIdx) { u8 bit = r.mMtx(r.mIdx, colIdx); r.mMtx(r.mIdx, colIdx) = mMtx(mIdx, colIdx); mMtx(mIdx, colIdx) = bit; } } bool isZero() const { for (u64 colIdx = 0; colIdx < mMtx.cols(); ++colIdx) { u8 bit = mMtx(mIdx, colIdx); if (bit) return false; } return true; } void operator^=(const Row& r) { for (u64 colIdx = 0; colIdx < mMtx.cols(); ++colIdx) { mMtx(mIdx, colIdx) ^= r.mMtx(r.mIdx, colIdx); } } }; void colIndexSet(u64 c, std::vector<u64>& set)const { set.clear(); oc::BitIterator iter((u8*)col(c).data()); for (u64 i = 0; i < rows(); ++i) { if (*iter) set.push_back(i); ++iter; } } Row row(u64 i) const { return Row{ i, (DenseMtx&)*this }; } DenseMtx selectColumns(span<u64> perm) { DenseMtx r(rows(), perm.size()); for (u64 i = 0; i < (u64)perm.size(); ++i) { auto d = r.col(i); auto s = col(perm[i]); std::copy(s.begin(), s.end(), d.begin()); } return r; } span<block> col(u64 i) { return mData[i]; } span<const block> col(u64 i) const { return mData[i]; } void setZero() { memset(mData.data(), 0, mData.size() * sizeof(oc::block)); } void rowSwap(u64 i, u64 j) { if (i != j) { row(i).swap(row(j)); } } SparseMtx sparse() const { std::vector<Point> points; for (u64 i = 0; i < rows(); ++i) { for (u64 j = 0; j < cols(); ++j) { if ((*this)(i, j)) points.push_back({ i,j }); } } SparseMtx s; s.init(rows(), cols(), points); return s; } DenseMtx mult(const DenseMtx& m) { assert(cols() == m.rows()); DenseMtx ret(rows(), m.cols()); for (u64 i = 0; i < ret.rows(); ++i) { for (u64 j = 0; j < ret.cols(); ++j) { u8 v = 0; for (u64 k = 0; k < cols(); ++k) { v = v ^ ((*this)(i, k) & m(k, j)); } ret(i, j) = v; } } return ret; } DenseMtx add(DenseMtx& m) { assert(rows() == m.rows() && cols() == m.cols()); auto ret = *this; for (u64 i = 0; i < mData.size(); ++i) ret.mData(i) = ret.mData(i) ^ m.mData(i); return ret; } DenseMtx operator+(DenseMtx& m) { return add(m); } DenseMtx operator*(const DenseMtx& m) { return mult(m); } static DenseMtx Identity(u64 n) { DenseMtx I(n, n); for (u64 i = 0; i < n; ++i) I(i, i) = 1; return I; } DenseMtx upperTriangular() const { auto& mtx = *this; auto rows = mtx.rows(); auto cols = mtx.cols(); u64 colIdx = 0ull; for (u64 i = 0; i < rows; ++i) { while (mtx(i, colIdx) == 0) { for (u64 j = i + 1; j < rows; ++j) { if (mtx(j, colIdx) == 1) { mtx.row(i).swap(mtx.row(j)); --colIdx; break; } } ++colIdx; if (colIdx == cols) return mtx; } for (u64 j = i + 1; j < rows; ++j) { if (mtx(j, colIdx)) { for (u64 k = 0; k < cols; ++k) { mtx(j, k) ^= mtx(i, k); } } } } return mtx; } DenseMtx gausianElimination() const { auto& mtx = *this; auto rows = mtx.rows(); auto cols = mtx.cols(); u64 colIdx = 0ull; for (u64 i = 0; i < rows; ++i) { while (mtx(i, colIdx) == 0) { for (u64 j = i + 1; j < rows; ++j) { if (mtx(j, colIdx) == 1) { mtx.row(i).swap(mtx.row(j)); --colIdx; break; } } ++colIdx; if (colIdx == cols) return mtx; } for (u64 j = 0; j < rows; ++j) { if (j != i && mtx(j, colIdx)) { for (u64 k = 0; k < cols; ++k) { mtx(j, k) ^= mtx(i, k); } } } } return mtx; } DenseMtx invert() const; DenseMtx transpose() const { DenseMtx R(cols(), rows()); for (u64 i = 0; i < rows(); ++i) { for (u64 j = 0; j < cols(); ++j) { R(j, i) = (*this)(i, j); } } return R; } DenseMtx subMatrix(u64 row, u64 col, u64 rowCount, u64 colCount) { DenseMtx ret(rowCount, colCount); for (u64 i = 0, ii = row; i < rowCount; ++i, ++ii) { for (u64 j = 0, jj = col; j < colCount; ++j, ++jj) { ret(i, j) = (*this)(ii, jj); } } return ret; } }; inline std::ostream& operator<<(std::ostream& o, const DenseMtx& H) { for (u64 i = 0; i < H.rows(); ++i) { for (u64 j = 0; j < H.cols(); ++j) { if (H(i, j)) { if (&o == &std::cout) o << oc::Color::Green << "1 " << oc::Color::Default; else o << "1 "; } else o << "0 "; } o << "\n"; } return o; } inline DenseMtx DenseMtx::invert() const { assert(rows() == cols()); auto mtx = *this; auto n = this->rows(); auto Inv = Identity(n); for (u64 i = 0; i < n; ++i) { if (mtx(i, i) == 0) { for (u64 j = i + 1; j < n; ++j) { if (mtx(j, i) == 1) { mtx.row(i).swap(mtx.row(j)); Inv.row(i).swap(Inv.row(j)); break; } } if (mtx(i, i) == 0) { //std::cout << mtx << std::endl; return {}; } } for (u64 j = 0; j < n; ++j) { if (j != i && mtx(j, i)) { for (u64 k = 0; k < n; ++k) { mtx(j, k) ^= mtx(i, k); Inv(j, k) ^= Inv(i, k); } } } } return Inv; } inline DenseMtx SparseMtx::dense() const { DenseMtx mtx(rows(), cols()); for (u64 i = 0; i < rows(); ++i) { for (auto j : row(i)) mtx(i, j) = 1; } return mtx; } inline SparseMtx SparseMtx::invert() const { auto d = dense(); d = d.invert(); return d.sparse(); } struct VecSortSet { std::vector<u64> mData; using iterator = std::vector<u64>::iterator; using constIerator = std::vector<u64>::const_iterator; iterator begin() { return mData.begin(); } iterator end() { return mData.end(); } iterator find(u64 i) { auto iter = lowerBound(i); if (iter != end() && *iter != i) iter = end(); return iter; } iterator lowerBound(u64 i) { return std::lower_bound(begin(), end(), i); } constIerator begin() const { return mData.begin(); } constIerator end()const { return mData.end(); } constIerator find(u64 i)const { auto iter = lowerBound(i); if (iter != end() && *iter != i) iter = end(); return iter; } constIerator lowerBound(u64 i)const { return std::lower_bound(begin(), end(), i); } void clear() { mData.clear(); } template<class Iter> void insert(Iter b, Iter e) { auto s = e - b; mData.reserve(mData.size() + s); while (b != e) { if (size() == 0 || *b > mData.back()) mData.push_back(*b); else insert(*b); ++b; } } void insert(u64 i) { auto iter = lowerBound(i); implInsert(i, iter); } void insertHint(u64 i, iterator iter) { assert(lowerBound(i) == iter); implInsert(i, iter); } void implInsert(u64 i, iterator iter) { if (iter == end()) { mData.push_back(i); } else if (*iter > i) { auto p = iter - begin(); mData.emplace_back(); iter = begin() + p; while (iter != end()) { std::swap(i, *iter); ++iter; } } } void erase(u64 i) { auto iter = lowerBound(i); assert(iter != end()); erase(iter); } void erase(iterator iter) { auto e = end() - 1; while (iter < e) { *iter = *(iter + 1); ++iter; } mData.pop_back(); } u64 size() const { return mData.size(); } u64& operator[](u64 i) { return mData[i]; } void operator ^=(const VecSortSet& o) { u64 i0 = 0; u64 i1 = 0; while (i0 != size() && i1 != o.size()) { if (mData[i0] < o.mData[i1]) { ++i0; } else if (mData[i0] == o.mData[i1]) { erase(begin() + i0); ++i1; } else { insertHint(o.mData[i1], begin() + i0); ++i1; ++i0; } } insert(o.begin() + i1, o.end()); } }; struct VecSet { std::vector<u64> mData; using iterator = std::vector<u64>::iterator; using constIerator = std::vector<u64>::const_iterator; iterator begin() { return mData.begin(); } iterator end() { return mData.end(); } iterator find(u64 i) { auto iter = std::find(mData.begin(), mData.end(), i); return iter; } //iterator lowerBound(u64 i) //{ // return std::lower_bound(begin(), end(), i); //} constIerator begin() const { return mData.begin(); } constIerator end()const { return mData.end(); } constIerator find(u64 i)const { auto iter = std::find(mData.begin(), mData.end(), i); return iter; } //constIerator lowerBound(u64 i)const //{ // return std::lower_bound(begin(), end(), i); //} void clear() { mData.clear(); } template<class Iter> void insert(Iter b, Iter e) { auto s = e - b; mData.reserve(mData.size() + s); while (b != e) { if (size() == 0 || *b > mData.back()) mData.push_back(*b); else insert(*b); ++b; } } void insert(u64 i) { assert(find(i) == end()); mData.push_back(i); //auto iter = lowerBound(i); //implInsert(i, iter); } //void insertHint(u64 i, iterator iter) //{ // assert(lowerBound(i) == iter); // implInsert(i, iter); //} //void implInsert(u64 i, iterator iter) //{ // if (iter == end()) // { // mData.push_back(i); // } // else if (*iter > i) // { // auto p = iter - begin(); // mData.emplace_back(); // iter = begin() + p; // while (iter != end()) // { // std::swap(i, *iter); // ++iter; // } // } //} void erase(u64 i) { auto iter = find(i); assert(iter != end()); erase(iter); } void erase(iterator iter) { auto e = end() - 1; while (iter < e) { *iter = *(iter + 1); ++iter; } mData.pop_back(); } u64 size() const { return mData.size(); } u64& operator[](u64 i) { return mData[i]; } void operator ^=(const VecSortSet& o) { u64 i0 = 0; u64 i1 = 0; while (i0 != size() && i1 != o.size()) { if (mData[i0] < o.mData[i1]) { ++i0; } else if (mData[i0] == o.mData[i1]) { erase(begin() + i0); ++i1; } else { insert(o.mData[i1]); ++i1; ++i0; } } insert(o.begin() + i1, o.end()); } }; struct DynSparseMtx { std::vector<VecSortSet> mRows;// , mCols; std::vector<VecSortSet> mCols; DynSparseMtx() = default; DynSparseMtx(const DynSparseMtx&) = default; DynSparseMtx(DynSparseMtx&&) = default; DynSparseMtx(const SparseMtx& m) { resize(m.rows(), m.cols()); for (u64 i = 0; i < rows(); ++i) { auto r = m.row(i); row(i).insert(r.begin(), r.end()); } for (u64 i = 0; i < cols(); ++i) { auto c = m.col(i); col(i).insert(c.begin(), c.end()); } } void operator=(const SparseMtx& m) { resize(m.rows(), m.cols()); for (u64 i = 0; i < rows(); ++i) { auto r = m.row(i); row(i).clear(); row(i).insert(r.begin(), r.end()); } for (u64 i = 0; i < cols(); ++i) { auto c = m.col(i); col(i).clear(); col(i).insert(c.begin(), c.end()); } } void operator=(const DenseMtx& m) { resize(m.rows(), m.cols()); for (u64 i = 0; i < rows(); ++i) { row(i).clear(); } for (u64 i = 0; i < cols(); ++i) { //auto c = m.col(i); col(i).clear(); } for (u64 i = 0; i < rows(); ++i) { for (u64 j = 0; j < cols(); ++j) { if (m(i, j)) { col(j).insert(i); row(i).insert(j); } } } } DynSparseMtx& operator=(const DynSparseMtx&) = default; DynSparseMtx& operator=(DynSparseMtx&&) = default; VecSortSet& row(u64 i) { return mRows[i]; } VecSortSet& col(u64 i) { //std::sort(mCols[i].begin(), mCols[i].end()); return mCols[i]; } const VecSortSet& row(u64 i)const { return mRows[i]; } const VecSortSet& col(u64 i)const { return mCols[i]; } u64 rows()const { return mRows.size(); } u64 cols()const { return mCols.size(); } void resize(u64 rows, u64 cols) { if (mRows.size() < rows) { for (u64 i = mRows.size() - 1; i <= rows; --i) clearRow(i); } if (mCols.size() < cols) { for (u64 i = mCols.size() - 1; i <= cols; --i) clearCol(i); } mRows.resize(rows); mCols.resize(cols); } void reserve(u64 rows, u64 cols) { mRows.reserve(rows); mCols.reserve(cols); } void clearRow(u64 i) { assert(i < mRows.size()); for (auto c : mRows[i]) { mCols[c].erase(i); } } void clearCol(u64 i) { assert(i < mCols.size()); for (auto r : mCols[i]) { mRows[r].erase(i); } } void pushBackCol(const VecSortSet& col) { pushBackCol(span<const u64>(col.mData)); } void pushBackCol(span<const u64> col) { auto c = mCols.size(); mCols.emplace_back(); mCols.back().insert(col.begin(), col.end()); for (u64 i = 0; i < (u64)col.size(); ++i) { mRows[col[i]].insert(c); } } void pushBackRow(const VecSortSet& row) { pushBackRow(row.mData); } void pushBackRow(span<const u64> row) { auto r = mRows.size(); mRows.emplace_back(); mRows.back().insert(row.begin(), row.end()); for (u64 i = 0; i < (u64)row.size(); ++i) { mCols[row[i]].insert(r); } } void rowAdd(u64 r0, u64 r1) { u64 i0 = 0; u64 i1 = 0; auto& rr0 = row(r0); auto& rr1 = row(r1); while (i0 != rr0.size() && i1 != rr1.size()) { auto colIdx0 = rr0.mData[i0]; auto colIdx1 = rr1.mData[i1]; if (colIdx0 < colIdx1) { ++i0; } else if (colIdx0 == colIdx1) { col(colIdx0).erase(r0); rr0.erase(rr0.begin() + i0); ++i1; } else { col(colIdx1).insert(r0); rr0.insertHint(colIdx1, rr0.begin() + i0); ++i1; ++i0; } } rr0.insert(rr1.begin() + i1, rr1.end()); while (i1 != rr1.size()) { auto colIdx = rr1.mData[i1]; col(colIdx).insert(r0); ++i1; } validate(); } void rowSwap(u64 r0, u64 r1) { validate(); assert(r0 < rows()); assert(r1 < rows()); if (r0 == r1) return; u64 col0 = 0; u64 col1 = 0; auto& rr0 = mRows[r0]; auto& rr1 = mRows[r1]; while (col0 != rr0.size() && col1 != rr1.size()) { if (rr0[col0] < rr1[col1]) { auto& c0 = mCols[rr0[col0]]; c0.erase(r0); c0.insert(r1); ++col0; } else if (rr0[col0] > rr1[col1]) { auto& c1 = mCols[rr1[col1]]; c1.erase(r1); c1.insert(r0); ++col1; } else { ++col1; ++col0; } } while (col0 != rr0.size()) { auto& c0 = mCols[rr0[col0]]; c0.erase(r0); c0.insert(r1); ++col0; } while (col1 != rr1.size()) { auto& c1 = mCols[rr1[col1]]; c1.erase(r1); c1.insert(r0); ++col1; } std::swap(mRows[r0], mRows[r1]); validate(); } bool operator()(u64 r, u64 c) const { return mRows[r].find(c) != mRows[r].end(); } void validate() { for (u64 i = 0; i < rows(); ++i) { for (auto j : mRows[i]) { if (mCols[j].find(i) == mCols[j].end()) throw RTE_LOC; } } for (u64 i = 0; i < cols(); ++i) { for (auto j : mCols[i]) { if(mRows[j].find(i) == mRows[j].end()) throw RTE_LOC; } } } DynSparseMtx selectColumns(span<u64> perm)const { DynSparseMtx r; r.mRows.resize(rows()); for (u64 i = 0; i < (u64)perm.size(); ++i) { r.pushBackCol(col(perm[i])); } return r; } SparseMtx sparse() const { std::vector<Point> points; for (u64 i = 0; i < rows(); ++i) { for (auto j : row(i)) points.push_back({ i,j }); } SparseMtx s; s.init(rows(), cols(), points); return s; } }; inline std::ostream& operator<<(std::ostream& o, const DynSparseMtx& H) { for (u64 i = 0; i < H.rows(); ++i) { auto row = H.row(i); for (u64 j = 0, jj = 0; j < H.cols(); ++j) { if (jj != row.size() && j == row[jj]) { if (&o == &std::cout) o << oc::Color::Green << "1 " << oc::Color::Default; else o << "1 "; ++jj; } else o << "0 "; } o << "\n"; } return o; } namespace tests { void Mtx_make_test(); void Mtx_add_test(); void Mtx_mult_test(); void Mtx_invert_test(); void Mtx_block_test(); } }
24.800197
114
0.34997
[ "vector", "transform" ]
f1e278ac6cddb4bfa7c8c89c01f584dad8a406f2
17,854
h
C
Hekateros/include/Hekateros/hekKin.h
roadnarrows-robotics/rnr-sdk
aee20c65b49fb3eedf924c5c2ec9f19f4f1a1b29
[ "MIT" ]
null
null
null
Hekateros/include/Hekateros/hekKin.h
roadnarrows-robotics/rnr-sdk
aee20c65b49fb3eedf924c5c2ec9f19f4f1a1b29
[ "MIT" ]
null
null
null
Hekateros/include/Hekateros/hekKin.h
roadnarrows-robotics/rnr-sdk
aee20c65b49fb3eedf924c5c2ec9f19f4f1a1b29
[ "MIT" ]
null
null
null
//////////////////////////////////////////////////////////////////////////////// // // Package: Hekateros // // Library: libhekateros // // File: hekKin.h // /*! \file * * $LastChangedDate: 2015-05-15 12:50:46 -0600 (Fri, 15 May 2015) $ * $Rev: 3988 $ * * \brief The Hekateros kinematics and dynamics class interface. * * The class instance starts a kinematics thread to sense kinematic chain * dynamics, control forward geometry kinematics, and monitor servo health. * * The kinematics includes all physical kinematic chains. The individual chains * are controlled by the higher-level interfaces such as MoveIt! * * The kinematics thread performs several functions: * \li Position, velocity, acceleration (future), and torque monitoring. * \li Goal joint position and velocity PID control. * \li Torque limiting override control. * \li Servo health monitoring. * * There are two alternative kinematics thread execution algorithms. * * \par Individual Move Execution Cycle * \ref HEK_KIN_EXEC_ALG_INDIV * \verbatim * get next task * if task is a joint task * sense() * sense dynamics (3 dynabus reads) * act() * control movement (1+ dynabus writes) * limit torque if necessary (1+ dynabus writes) * else if task is to monitor * monitor() * health of one servo (3 dynabus reads) * block wait for next task time * \endverbatim * * \par Sync Move Execution Cycle * \ref HEK_KIN_EXEC_ALG_SYNC * \verbatim * sense() * for each joint * sense dynamics (3 dynabus reads) * react() * for each joint * stop motion if necessary (1 dynabus write) * limit torque if necessary (1+ dynabus writes) * plan() * for each joint * plan motion and add to synchronous write messages * act() * sync write (1 or 2 dynabus messages) * monitor() * health of one servo (3 dynabus reads) * block wait for next cycle time * \endverbatim * * \author Robin Knight (robin.knight@roadnarrows.com) * * \copyright * \h_copy 2014-2017. RoadNarrows LLC.\n * http://www.roadnarrows.com\n * All Rights Reserved */ /* * @EulaBegin@ * * Unless otherwise stated explicitly, all materials contained are copyrighted * and may not be used without RoadNarrows LLC's written consent, * except as provided in these terms and conditions or in the copyright * notice (documents and software) or other proprietary notice provided with * the relevant materials. * * IN NO EVENT SHALL THE AUTHOR, ROADNARROWS LLC, OR ANY * MEMBERS/EMPLOYEES/CONTRACTORS OF ROADNARROWS OR DISTRIBUTORS OF THIS SOFTWARE * BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR * CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS * DOCUMENTATION, EVEN IF THE AUTHORS OR ANY OF THE ABOVE PARTIES HAVE BEEN * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * THE AUTHORS AND ROADNARROWS LLC SPECIFICALLY DISCLAIM ANY WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN * "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE NO OBLIGATION TO * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. * * @EulaEnd@ */ //////////////////////////////////////////////////////////////////////////////// #ifndef _HEK_KIN_H #define _HEK_KIN_H #include <sys/time.h> #include <time.h> #include <pthread.h> #include <vector> #include <map> #include "rnr/rnrconfig.h" #include "rnr/log.h" #include "Dynamixel/Dynamixel.h" #include "Dynamixel/DynaError.h" #include "Dynamixel/DynaServo.h" #include "Dynamixel/DynaChain.h" #include "Hekateros/hekateros.h" #include "Hekateros/hekTune.h" #include "Hekateros/hekJoint.h" #include "Hekateros/hekTraj.h" #include "Hekateros/hekKinJoint.h" #include "Hekateros/hekUtils.h" namespace hekateros { // --------------------------------------------------------------------------- // HekKinematics Class // --------------------------------------------------------------------------- /*! * Hekateros kinematics class. * * The HekKinematics class supports background control and monitoring of * registered joints and servos. */ class HekKinematics { public: /*! * \brief Kinematics thread states. */ enum ThreadState { ThreadStateUninit, ///< thread created but unitialized ThreadStateReady, ///< thread created and ready to run ThreadStateRunning, ///< thread running ThreadStateExit ///< thread exiting/exited }; /*! * \brief Associative Map of kinematic joints. */ typedef map<std::string, HekKinJoint *> KinChain; /*! * \brief Order list of tasks. */ typedef vector<std::string> TaskList; /*! * \brief Default initializer constructor. * * \param dynaChain Bound Dynamixel chain of all motors (servos). * \param kinJointDesc Joint descriptions in kinematic chain to control. * \param tunes Hekateros tuning parameters. */ HekKinematics(DynaChain &dynaChain, MapRobotJoints &kinJointDesc, const HekTunes &tunes); /*! * \brief Desctructor. */ virtual ~HekKinematics(); /*! * \brief Build ordered list of tasks to execute. * * \todo TODO: Currently this list is hard coded to the Hekateros family * of arms and end effectors. How to generalize? */ virtual void buildTaskList(); /*! * \brief Reload configuration tuning parameters for all joints. * * \param tunes Hekateros tuning parameters. */ virtual void reload(const HekTunes &tunes); /*! * \brief Get the current instantaneous joint position and velocity. * * \param [in] strJointName Joint name. * \param [out] fJointCurPos Current joint position (radians). * \param [out] fJointCurVel Current joint velocity (radians/second). */ virtual void getJointCurPosVel(const std::string &strJointName, double &fJointCurPos, double &fJointCurVel); /*! * \brief Get the smoothed (filtered) current joint position and velocity. * * \param [in] strJointName Joint name. * \param [out] fJointCurPos Current joint position (radians). * \param [out] fJointCurVel Current joint velocity (radians/second). */ virtual void getFilteredJointCurPosVel(const std::string &strJointName, double &fJointCurPos, double &fJointCurVel); /*! * \brief Get the current servo position and speed. * * \param [in] strJointName Joint name. * \param [out] nServoCurPos Current servo position (odometer ticks). * \param [out] nServoCurSpeed Current servo velocity (raw unitless). */ void getServoCurPosSpeed(const std::string &strJointName, int &nServoCurPos, int &nServoCurSpeed); /*! * \brief Convert joint position to the equivalent servo position. * * \param strJointName Joint name. * \param fPos Joint position (radians). * * \return Equivalent servo position (odometer ticks). */ int jointPosToServoPos(const std::string &strJointName, const double fPos); /*! * \brief Convert servo position to the equivalent joint position. * * \param strJointName Joint name. * \param nOdPos Servo position (odometer ticks). * * \return Equivalent joint position (radians). */ double servoPosToJointPos(const std::string &strJointName, const int nOdPos); /*! * \brief Test if joint is moving. * * \param strJointName Joint name. * * \return Returns true if stopped, false otherwise. */ virtual bool isStopped(const std::string &strJointName); /*! * \brief Test if joint is in an over torque condition. * * \param strJointName Joint name. * * \return Returns true if in condition, false otherwise. */ virtual bool hasOverTorqueCondition(const std::string &strJointName); /*! * \brief Reset all joints' master servos odometers to the current * respective encoder positions. * * \par Context: * Calling thread. * * \return Number of joint servos reset. */ virtual int resetServoOdometersForAllJoints(); /*! * \brief Reset joint's master servo odometer to the current encoder * position. * * \par Context: * Calling thread. * * \param strJointName Name of joint with master servo to reset. * * \copydoc doc_return_std */ virtual int resetServoOdometer(const std::string &strJointName); /*! * \brief Emergency stop the kinematics chain. * * All servos will stop driving, so chain may fall. * * \par Context: * Calling thread. */ virtual void estop(); /*! * \brief Freeze kinematics chain at the current position. * * The joint servos are still being driven. However, all active joint * motion control will cease. * * \par Context: * Calling thread. */ virtual void freeze(); /*! * \brief Release kinematics chain. * * Servos will stop driving, so the chain may fall. This call is assumed to * be under control, so recalibration is not required. Typically, the chain * is released during manual repositioning or teaching. * * All active joint motion control will cease. * * \par Context: * Calling thread. */ virtual void release(); /*! * \brief Stop kinematics chain at the current position. * * The joint servos are still being driven. However, all active joint * motion control will cease. * * \par Context: * Calling thread. * * \return Number of joints stopped. */ virtual int stop(); /*! * \brief Stop the set of joints at the current position. * * The joint servos are still being driven. However, all active joint * motion control will cease. * * \par Context: * Calling thread. * * \param vecJointName Vector list of joint names to stop. * * \return Number of joints stopped. */ virtual int stop(const std::vector<std::string> &vecJointNames); /*! * \brief Stop one joint at the current position. * * The joint servos are still being driven. However, all active joint * motion control will cease. * * \par Context: * Calling thread. * * \param strJointName Name of joint. * * \copydoc doc_return_std */ virtual int stop(const std::string &strJointName); /*! * \brief Wait for all joints to stop. * * \par Context: * Calling thread. * * \param fSeconds Maximum number of seconds to wait. * * \copydoc doc_return_std */ virtual int waitForAllStop(double fSeconds); /*! * \brief Move kinematic chain through a trajectory point. * * \par Context: * Calling thread. * * \param trajectoryPoint Trajectory end point. * * \return Number of joints with new move initiated. */ virtual int move(HekJointTrajectoryPoint &trajectoryPoint); /*! * \brief Move single joint. * * \par Context: * Calling thread. * * \param strJointName Joint name. * \param fJointGoalPos Joint goal position (radians). * \param fJointGoalVel Joint goal velocity (radians/second). * * \copydoc doc_std_return */ virtual int move(const std::string &strJointName, const double fJointGoalPos, const double fJointGoalVel); /*! * \brief Set thread run rate and ancillary data. * * \param fHZ Thread run rate (Hertz). */ virtual void setHz(const double fHz); /*! * \brief Run the kinematics thread. * * \par Valid Current State: * \ref ThreadStateReady * * \par New State: * \ref ThreadStateRunning * * \par Context: * Calling thread. * * \param fHZ Thread run rate (Hertz). * * \copydoc doc_std_return */ int runThread(const double fHz = HekTuneKinHzDft); /*! * \brief Wait one full cycle. * * \par Context: * Calling thread. */ void waitOneCycle(); protected: // thread, state, and synchronization ThreadState m_eState; ///< thread state pthread_mutex_t m_mutexSync; ///< synchonization mutex pthread_cond_t m_condSync; ///< synchonization condition pthread_t m_thread; ///< pthread identifier // the kinematics and dynamics DynaChain &m_dynaChain; ///< dynamixel chain KinChain m_kinChain; ///< kinematic chain int m_nNumJoints; ///< number of joints to control int m_nNumServos; ///< number of servos to monitor // scheduler double m_fHz; ///< thread run rate (Hertz) double m_fTExec; ///< task execution period (seconds) struct timespec m_tsExecPeriod; ///< task execution period (converted) struct timespec m_tsSched; ///< working scheduler time stamp // tasks bool m_bIsControlling; ///< [not] actively controlling joints TaskList m_taskList; ///< list of tasks to exec per cycle #ifdef HEK_KIN_EXEC_ALG_SYNC SyncMoveMsgs m_msgs; ///< dynachain synchronous messages bool m_bWaitOneCycle; ///< caller is [not] waiting 1 exec cycle #else // HEK_KIN_EXEC_ALG_INDIV TaskList::iterator m_iterTask; ///< task iterator std::string m_strTaskOneCycle;///< task name one cycle away #endif // HEK_KIN_EXEC_ALG_SYNC int m_iterHealth; ///< servo health iterator int m_nHealthServoId; ///< health monitoring servo id /*! * \brief Lock the kinematics thread. * * The calling thread will block while waiting for the mutex to become * available. Once locked, the kinematics thread will block. * * The lock()/unlock() primitives provide a safe mechanism to modify the * registered vServo data. * * \par Context: * Any. */ void lock() { pthread_mutex_lock(&m_mutexSync); } /*! * \brief Unlock the kinematics thread. * * The kinematics thread will be available to run. * * \par Context: * Any. */ void unlock() { pthread_mutex_unlock(&m_mutexSync); } /*! * \brief Sense the state of all joints. * * \par Context: * Kinematics thread. */ virtual void sense(); /*! * \brief React to any necessary time-critical joint events. * * \par Context: * Kinematics thread. */ virtual void react(); /*! * \brief Sense-react the state of all joints. * * \par Context: * Kinematics thread. */ virtual void sense_react(); /*! * \brief Plan motions for all joints. * * \par Context: * Kinematics thread. */ virtual void plan(); /*! * \brief Move all joints. * * \par Context: * Kinematics thread. */ virtual int act(); /*! * \brief Monitor servo health thread task. * * \par Context: * Kinematics thread. */ virtual void monitorHealth(); /*! * \brief Execute kinematics task(s). * * \par Context: * Kinematic thread. */ virtual void exec(); /*! * \brief The kinematics thread. * * \param pArg Thread argument (point to HekKinematics object). * * \return Returns NULL on thread exit. */ static void *thread(void *pArg); /*! * \brief Create the kinematics thread. * * The thread remains blocked in the ready state until runThread() is * called. * * \par Context: * Calling thread. */ void createThread(); /*! * \brief Terminate the kinematics thread. * * This function does not return until the thread actually terminates. * * \par Context: * Calling thread. */ void terminateThread(); /*! * \brief Change the kinematics thread state. * * The thread, if blocked, will be immediately woken up. * * \param eNewState New state. * * \par Context: * Calling thread or kinematics thread. */ void changeState(ThreadState eNewState) { m_eState = eNewState; pthread_cond_signal(&m_condSync); } /*! * \brief Wait indefinitely while in the ready state. * * \par Context: * Calling thread or kinematics thread. */ void readyWait(); /*! * \brief Timed wait until state change or time out. * * \param lMicroSec Maximum wait duration (microseconds). * * \par Context: * Calling thread or kinematics thread. */ void timedWait(const struct timespec &tsTimeout); /*! * \brief Block kinematics thread until the next subcycle task is to be run. * * \par Context: * Kinematics thread. */ void schedWait(); }; } // namespace hekateros #endif // _HEK_KIN_H
28.160883
80
0.59953
[ "geometry", "object", "vector" ]
f1eb519b0c1f784bb023becee9acb18542381cc4
865
h
C
TestPinb/OOP/Output.h
cafiorin/PinballOOP
1f8fc5a18bfa186daf3cdc719af9fb79aa42abfa
[ "BSD-3-Clause" ]
1
2019-01-08T10:04:44.000Z
2019-01-08T10:04:44.000Z
TestPinb/OOP/Output.h
cafiorin/PinballOOP
1f8fc5a18bfa186daf3cdc719af9fb79aa42abfa
[ "BSD-3-Clause" ]
null
null
null
TestPinb/OOP/Output.h
cafiorin/PinballOOP
1f8fc5a18bfa186daf3cdc719af9fb79aa42abfa
[ "BSD-3-Clause" ]
null
null
null
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * BSD 3-Clause License /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * Code by Cassius Fiorin - cafiorin@gmail.com http://pinballhomemade.blogspot.com.br * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #if !defined(Output__INCLUDED_) #define Output__INCLUDED_ #include "defines.h" #include "Utils.h" #include "Port.h" #include "Timer.h" class Multiplex; class Output : public Port { public: Output(uint8_t portNumber); virtual ~Output(); bool IsTurnOn(){return m_turnOn;} void TurnOn(); void TurnOnByTimer(long time=TIME_COIL_ON); void TurnOff(); virtual bool Init(); virtual bool NotifyEvent(Object *sender, uint8_t event, uint8_t value); protected: bool m_turnOn; private: Timer *m_TimerOn; }; #endif // !defined(EA_A5DC726B_BD74_4c6c_8409_19F521E789F5__INCLUDED_)
22.763158
72
0.60578
[ "object" ]
f1ef4f2450bad2f6e933d4292091b118714a9d8b
1,633
h
C
include/CoreKeywords.h
jonverrier/MBrs
1d8f54a361de91bd7f2deb14fb42c3fb92545335
[ "MIT" ]
null
null
null
include/CoreKeywords.h
jonverrier/MBrs
1d8f54a361de91bd7f2deb14fb42c3fb92545335
[ "MIT" ]
null
null
null
include/CoreKeywords.h
jonverrier/MBrs
1d8f54a361de91bd7f2deb14fb42c3fb92545335
[ "MIT" ]
null
null
null
///////////////////////////////////////// // CoreKeywords.h // Copyright (c) 2020 TXPCo Ltd ///////////////////////////////////////// #ifndef COREKEYWORDS_INCLUDED #define COREKEYWORDS_INCLUDED #include "Common.h" #include "Host.h" #include "HostException.h" #include "HostLocks.h" #include "Core.h" /////////////////////////////////////////////////////////////////////////////// // CoreCategoryKeywords /////////////////////////////////////////////////////////////////////////////// class CORE_API CoreCategoryKeywords { public: // Constructors CoreCategoryKeywords(const HString& category); CoreCategoryKeywords(const CoreCategoryKeywords& copyMe); ~CoreCategoryKeywords(void); // Attributes HString category() const; std::vector<HString> keywords() const; bool hasKeyword(const HString& test) const; // Operations bool addKeyword(const HString& add); bool removeKeyword(const HString& remove); bool removeAllKeywords(); CoreCategoryKeywords& operator=(const CoreCategoryKeywords& copyMe); // Comparison Operators bool operator==(const CoreCategoryKeywords& rhs) const; bool operator!=(const CoreCategoryKeywords& rhs) const; static const HString peopleKey (); static const HString placesKey (); static const HString timesKey (); protected: private: CoreCategoryKeywords() = delete; // Cannot create without a category std::vector<HString> readKeywords(const HString& category); void writeKeywords(const HString& category, std::vector<HString>& keywords); HString m_category; std::vector<HString> m_keywords; }; #endif // COREKEYWORDS_INCLUDED
27.216667
79
0.634415
[ "vector" ]
7b04232c9c23c6d8e55d37bf842e418208dc5b19
1,823
c
C
Conversions/SimpleDCTL.nmbr73.c
nmbr73/Fetch-n-Fuse
3ca8c786e161eeb25650885e35dc7665465142c0
[ "MIT" ]
null
null
null
Conversions/SimpleDCTL.nmbr73.c
nmbr73/Fetch-n-Fuse
3ca8c786e161eeb25650885e35dc7665465142c0
[ "MIT" ]
10
2022-01-13T22:11:34.000Z
2022-01-29T11:10:03.000Z
Conversions/SimpleDCTL.nmbr73.c
nmbr73/Fetch-n-Fuse
3ca8c786e161eeb25650885e35dc7665465142c0
[ "MIT" ]
null
null
null
/* Shader Inputs uniform vec3 iResolution; // viewport resolution (in pixels) uniform float iTime; // shader playback time (in seconds) uniform float iTimeDelta; // render time (in seconds) uniform int iFrame; // shader playback frame uniform float iChannelTime[4]; // channel playback time (in seconds) uniform vec3 iChannelResolution[4]; // channel resolution (in pixels) uniform vec4 iMouse; // mouse pixel coords. xy: current (if MLB down), zw: click uniform samplerXX iChannel0..3; // input channel. XX = 2D/Cube uniform vec4 iDate; // (year, month, day, time in seconds) uniform float iSampleRate; // sound sample rate (i.e., 44100) */ __KERNEL__ void SimpleDCTLFuse( float4 fragColor, float2 fragCoord, float iChannelTime [ ], float iTime , float2 iResolution, float4 iMouse, float2 * iChannelResolution ) { CONNECT_COLOR0(Farbenspiel,1.0f,0.5f,0.3f,0.9f); // Name der 'float4' Variable - wird nachher fuer das Control in der Fuse verwendet CONNECT_SLIDER0(Ich_mach_Blau,0.0f,1.0f,0.5f); // Name der 'float' Variable, Min, Max, und Default-Wert (Default wird hier nicht, aber spaeter in der Fuse verwendet) CONNECT_SLIDER1(slider,0.0f,1.0f,0.5f); CONNECT_INTSLIDER9(WasAuchImmer,1,1920,500); CONNECT_CHECKBOX4(EinCheckboxDings,false); float red = iMouse.x/WasAuchImmer; // rot klebe ich mal an die Maus float green = Farbenspiel.y; // gruen haengt am Gruen des Color0-Sliders float blue = Ich_mach_Blau; // blue haengt am 0ten TinySlider float alpha = slider; // alpha haengt am TinySlider 1 fragColor=to_float4(red,green,blue,alpha); SetFragmentShaderComputedColor(fragColor); }
38.787234
167
0.667581
[ "render" ]
7b07b388d823ee49941a4deb7922f9b35aa8e7d2
1,642
h
C
src/game/tile.h
dyedgreen/sdl_game
d6fd2510d8ecd71d4d7c6745fed6ac058ee6c284
[ "CC-BY-3.0" ]
null
null
null
src/game/tile.h
dyedgreen/sdl_game
d6fd2510d8ecd71d4d7c6745fed6ac058ee6c284
[ "CC-BY-3.0" ]
null
null
null
src/game/tile.h
dyedgreen/sdl_game
d6fd2510d8ecd71d4d7c6745fed6ac058ee6c284
[ "CC-BY-3.0" ]
null
null
null
#pragma once #include "../frameworks.h" typedef enum { Grass=0, GrassLightWoods=1, GrassWoods=2, GrassStones=3, GrassStonesWoods=4, Mountain=5, Water=6, WaterDeep=7, WaterSwamp=15, WaterIce=21, GrassVillage=8, GrassTown=9, GrassCastle=10, GrassCrops=11, SwampWoods=12, Swamp=13, SwampGrass=14, Snow=16, SnowLightWoods=17, SnowWoods=18, SnowStones=19, SnowStonesWoods=20, SnowVilage=22, SnowCastle=23, Sand=24, SandStones=25, SandDunes=26, SandMountain=27, SandOasis=28, SandVillage=29, SandCity=30, SandCastle=31, Jungle=32, PortLeft=36, PortRight=37, Lighthouse=38, Ruins=39, Cemetery=40, } TileType; typedef struct { // Tile type and render stuff TileType type; int cave; // Tile game properties TODO int player; // Player who owns the tile (-1 -> no owner) int ignore_in_update; // 0 -> NO; 1 -> YES //int resource_wood; //int resource_food; //int population; } Tile; // Create a tile Tile* createTile(TileType type, int cave); // Destroy a tile void destroyTile(Tile* tile); // Determine a tile type based on height-maps TileType determineTileType(float biome, float height, float nature); // Render a tile (needs a valid tile structure + target + renderer) void renderTile(Tile* tile, SDL_Texture* tileset, SDL_Renderer* renderer, SDL_Rect* target_rect); void renderTileRoad(TileType road_type, SDL_Texture* tileset, SDL_Renderer* renderer, SDL_Rect* target_rect); // Tile helper function (for during the game) int tileHasWood(Tile* tile); int tileDecreaseWood(Tile* tile); int tileHasWater(Tile* tile); int tileHasBuilding(Tile* tile);
22.189189
109
0.718027
[ "render" ]
7b0b6865a48f279d2857245aefa4d41948f22e9f
7,687
c
C
hacks/glx/bubble3d.c
MBrassey/xscreensaver_BlueMatrix
2152a79ec08a676d940158735700087323d4a556
[ "CC0-1.0" ]
2
2020-07-15T07:40:50.000Z
2020-09-01T05:51:36.000Z
hacks/glx/bubble3d.c
luc1dLife/xscreensaver_BlueMatrix
2152a79ec08a676d940158735700087323d4a556
[ "CC0-1.0" ]
null
null
null
hacks/glx/bubble3d.c
luc1dLife/xscreensaver_BlueMatrix
2152a79ec08a676d940158735700087323d4a556
[ "CC0-1.0" ]
null
null
null
/* -*- Mode: C; tab-width: 4 -*- */ /* bubble3d.c - 3D bubbles */ #if 0 static const char sccsid[] = "@(#)bubble3d.c 4.11 98/06/16 xlockmore"; #endif /*- * BUBBLE3D (C) 1998 Richard W.M. Jones. * Permission to use, copy, modify, and distribute this software and its * documentation for any purpose and without fee is hereby granted, * provided that the above copyright notice appear in all copies and that * both that copyright notice and this permission notice appear in * supporting documentation. * * This file is provided AS IS with no warranties of any kind. The author * shall have no liability with respect to the infringement of copyrights, * trade secrets or any patents by this file or any part thereof. In no * event will the author be liable for any lost revenue or profits or * other special, indirect and consequential damages. * * Revision History: * 16-Jun-98: Written. * * bubble.c: This code is responsible for creating and managing * bubbles over their lifetime. * The bubbles may be drawn inside out. */ #include "bubble3d.h" typedef struct bubble { GLfloat *contributions; /* List of contributions from each * nudge to each vertex. This list has * length nr_vertices * nr_nudge_axes. */ GLfloat x, y, z; /* (x,y,z) location of the bubble. */ GLfloat scale; /* Scaling factor applied to bubble. */ GLfloat y_incr, scale_incr; /* Change in y and scale each frame. */ GLfloat rotx, roty, rotz; /* Current rotation. */ GLfloat rotx_incr, roty_incr, rotz_incr; /* Amount by which we increase * rotation each step. */ GLfloat *nudge_angle; /* Current angle (radians) of each * nudge. This list has length nr_nudge_axes. */ GLfloat *nudge_angle_incr; /* Amount by which we increase each nudge * angle in each frame. */ GLfloat color[4]; } bubble; /* Should be taken care of already... but just in case */ #if !defined( __GNUC__ ) && !defined(__cplusplus) && !defined(c_plusplus) #undef inline #define inline /* */ #endif static inline void normalize(GLfloat v[3]) { GLfloat d = (GLfloat) sqrt((double) (v[0] * v[0] + v[1] * v[1] + v[2] * v[2])); if (d != 0) { v[0] /= d; v[1] /= d; v[2] /= d; } else { v[0] = v[1] = v[2] = 0; } } static inline GLfloat dotprod(GLfloat * v1, GLfloat * v2) { return v1[0] * v2[0] + v1[1] * v2[1] + v1[2] * v2[2]; } static inline GLfloat max(GLfloat a, GLfloat b) { return a > b ? a : b; } /* Create a new bubble. */ void * glb_bubble_new(glb_data *d, GLfloat x, GLfloat y, GLfloat z, GLfloat scale, GLfloat y_incr, GLfloat scale_incr) { int i, j; /* GLfloat axes [glb_config.nr_nudge_axes][3]; */ GLfloat axes[5][3]; /* HARD CODED for SunCC */ int nr_vertices; glb_vertex *vertices = glb_sphere_get_vertices(d, &nr_vertices); bubble *b = (bubble *) malloc(sizeof *b); if (b == 0) return 0; if (glb_config.bubble_colour[0] == -1.0) { b->color[0] = ((float) (NRAND(100)) / 100.0); b->color[1] = ((float) (NRAND(100)) / 100.0); b->color[2] = ((float) (NRAND(100)) / 100.0); } else { b->color[0] = glb_config.bubble_colour[0]; b->color[1] = glb_config.bubble_colour[1]; b->color[2] = glb_config.bubble_colour[2]; } b->color[3] = glb_config.bubble_colour[3]; b->contributions = (GLfloat *) malloc(sizeof (GLfloat) * nr_vertices * glb_config.nr_nudge_axes); if (b->contributions == 0) { free(b); return 0; } b->nudge_angle = (GLfloat *) malloc(sizeof (GLfloat) * glb_config.nr_nudge_axes); if (b->nudge_angle == 0) { free(b->contributions); free(b); return 0; } b->nudge_angle_incr = (GLfloat *) malloc(sizeof (GLfloat) * glb_config.nr_nudge_axes); if (b->nudge_angle_incr == 0) { free(b->nudge_angle); free(b->contributions); free(b); return 0; } /* Initialize primitive elements. */ b->x = x; b->y = y; b->z = z; b->scale = scale; b->y_incr = y_incr; b->scale_incr = scale_incr; b->rotx = b->roty = b->rotz = 0; b->rotx_incr = glb_drand() * glb_config.rotation_factor * 2 - glb_config.rotation_factor; b->roty_incr = glb_drand() * glb_config.rotation_factor * 2 - glb_config.rotation_factor; b->rotz_incr = glb_drand() * glb_config.rotation_factor * 2 - glb_config.rotation_factor; /* Initialize the nudge angle arrays. */ for (i = 0; i < glb_config.nr_nudge_axes; ++i) { b->nudge_angle[i] = 0; b->nudge_angle_incr[i] = glb_drand() * glb_config.nudge_angle_factor; } /* Choose some random nudge axes. */ for (i = 0; i < glb_config.nr_nudge_axes; ++i) { axes[i][0] = glb_drand() * 2 - 1; axes[i][1] = glb_drand() * 2 - 1; axes[i][2] = glb_drand() * 2 - 1; normalize(axes[i]); } /* Calculate the contribution that each nudge axis has on each vertex. */ for (i = 0; i < nr_vertices; ++i) for (j = 0; j < glb_config.nr_nudge_axes; ++j) b->contributions[i * glb_config.nr_nudge_axes + j] = max(0, dotprod(vertices[i], axes[j])); return (void *) b; } /* Delete a bubble and free up all memory. */ void glb_bubble_delete(void *bb) { bubble *b = (bubble *) bb; if (b != NULL) { if (b->nudge_angle_incr) { free(b->nudge_angle_incr); b->nudge_angle_incr = NULL; } if (b->nudge_angle) { free(b->nudge_angle); b->nudge_angle = NULL; } if (b->contributions) { free(b->contributions); b->contributions = NULL; } free(b); b = NULL; } } /* Rotate and wobble a bubble by a single step. */ void glb_bubble_step(void *bb) { int i; bubble *b = (bubble *) bb; /* Update the rotation. */ b->rotx += b->rotx_incr; b->roty += b->roty_incr; b->rotz += b->rotz_incr; /* Update the nudge angles. */ for (i = 0; i < glb_config.nr_nudge_axes; ++i) b->nudge_angle[i] += b->nudge_angle_incr[i]; /* Move it upwards & outwards. */ b->y += b->y_incr; b->scale += b->scale_incr; } /* Draw a bubble. */ void glb_bubble_draw(glb_data *d, void *bb) { int i, j; bubble *b = (bubble *) bb; int nr_vertices; glb_vertex *vertices = glb_sphere_get_vertices(d, &nr_vertices); int nr_triangles; glb_triangle *triangles = glb_sphere_get_triangles(d, &nr_triangles); glb_vertex *new_vertices; new_vertices = (glb_vertex *) malloc(sizeof (glb_vertex) * nr_vertices); /* Calculate the vertices of this bubble, factoring in each nudge axis. */ for (i = 0; i < nr_vertices; ++i) { GLfloat s = 0; for (j = 0; j < glb_config.nr_nudge_axes; ++j) s += ((GLfloat) cos((double) (b->nudge_angle[j])) * glb_config.nudge_factor - glb_config.nudge_factor / 2) * b->contributions[i * glb_config.nr_nudge_axes + j]; new_vertices[i][0] = vertices[i][0] * (s + 1); new_vertices[i][1] = vertices[i][1] * (s + 1); new_vertices[i][2] = vertices[i][2] * (s + 1); } glPushMatrix(); /* Apply translation, rotation and scalings. */ glTranslatef(b->x, b->y, b->z); glRotatef(b->rotx, 1, 0, 0); glRotatef(b->roty, 0, 1, 0); glRotatef(b->rotz, 0, 0, 1); glScalef(b->scale, b->scale, b->scale); /* Draw the bubble. */ glFrontFace(GL_CW); glBegin(GL_TRIANGLES); glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, b->color); for (i = 0; i < nr_triangles; ++i) { glNormal3fv(new_vertices[triangles[i][0]]); glVertex3fv(new_vertices[triangles[i][0]]); glNormal3fv(new_vertices[triangles[i][1]]); glVertex3fv(new_vertices[triangles[i][1]]); glNormal3fv(new_vertices[triangles[i][2]]); glVertex3fv(new_vertices[triangles[i][2]]); } glEnd(); glPopMatrix(); free(new_vertices); glb_config.polygon_count += nr_triangles; } /* Return y value. */ GLfloat glb_bubble_get_y(void *bb) { bubble *b = (bubble *) bb; return b->y; }
27.258865
87
0.63822
[ "3d" ]
7b0e6636a0ecb00d262ce66d010ca05fbcf0ed83
2,887
h
C
include/device_matrix/base.h
Enet4/device_matrix
cff67f9d8ddbce5e6a340ac80f7940c82f332087
[ "MIT" ]
9
2018-02-23T11:10:48.000Z
2021-03-12T03:45:05.000Z
include/device_matrix/base.h
Enet4/device_matrix
cff67f9d8ddbce5e6a340ac80f7940c82f332087
[ "MIT" ]
null
null
null
include/device_matrix/base.h
Enet4/device_matrix
cff67f9d8ddbce5e6a340ac80f7940c82f332087
[ "MIT" ]
2
2018-02-25T17:31:21.000Z
2018-10-18T14:39:16.000Z
#ifndef DEVICE_MATRIX_BASE_H #define DEVICE_MATRIX_BASE_H #include <iomanip> #include <iterator> #include <ostream> #include <vector> namespace cuda { typedef unsigned short uint16; typedef long int32; typedef unsigned long uint32; typedef long long int64; typedef unsigned long long uint64; typedef float float32; typedef double float64; template <typename T> inline std::ostream& operator<<(std::ostream& os, const std::vector<T>& v) { os << std::setprecision(20) << "["; copy(v.begin(), v.end(), std::ostream_iterator<T>(os, ", ")); os << "]"; return os; } template <typename T> inline std::ostream& operator<<(std::ostream& os, const std::vector<std::vector<T>>& v) { os << "["; for (const auto& e : v) { os << e << ", "; } os << "]"; return os; } } // namespace cuda // Makes class instantiations non-copyable. // // From StackOverflow. #define DISALLOW_COPY_AND_ASSIGN(TypeName) \ TypeName(const TypeName&); \ void operator=(const TypeName&) #define CCE(x) checkCudaErrors(x) #define LAUNCH_KERNEL(...)\ CCE(cudaGetLastError()); \ VLOG(2) << "Launching " << #__VA_ARGS__ << "."; \ __VA_ARGS__; \ CCE(cudaGetLastError()) #define CHECK_DIMENSIONS_EQUAL(FIRST, SECOND) \ CHECK_EQ((FIRST).getRows(), (SECOND).getRows());\ CHECK_EQ((FIRST).getCols(), (SECOND).getCols()) #define CHECK_DIMENSIONS_MULT_COMPATIBLE(FIRST, SECOND) \ CHECK_EQ((FIRST).getCols(), (SECOND).getRows()) #define CHECK_DIMENSIONS(MATRIX, NUM_ROWS, NUM_COLUMNS) \ CHECK((MATRIX).getRows() == NUM_ROWS && \ (MATRIX).getCols() == NUM_COLUMNS) \ << "Tensor " << #MATRIX << " has shape " \ << (MATRIX).getRows() << "-by-" << (MATRIX).getCols() << " " \ << "instead of expected shape " << NUM_ROWS << "-by-" << NUM_COLUMNS << "."; #define MAKE_MATRIX_NULL(MATRIX) (MATRIX).fillwith((MATRIX).getStream(), 0.0); #if __DEVICE_MATRIX_DEBUG>0 #pragma message("Debug mode is enabled; everything will be slow!") #define CHECK_MATRIX_FINITE(MATRIX) \ cudaDeviceSynchronize();\ CHECK(isfinite((MATRIX)))\ << "Tensor " << #MATRIX << " is not finite."; \ CHECK(isfinite_slow(MATRIX))\ << "Tensor " << #MATRIX << " is not finite." #define PRINT_MATRIX(MATRIX) cudaDeviceSynchronize(); VLOG(3) << #MATRIX; print_matrix((MATRIX)) #define PRINT_VECTOR(VECTOR) cudaDeviceSynchronize(); VLOG(3) << #VECTOR; print_vector((VECTOR)) #define CHECK_MATRIX_NORM(MATRIX)\ LOG_IF(INFO, l2_norm((MATRIX)) < std::numeric_limits<float32>::epsilon()) \ << "Matrix " << #MATRIX << " has zero l2 norm." #else #define CHECK_MATRIX_FINITE(matrix) #define PRINT_MATRIX(matrix) #define PRINT_VECTOR(vector) #define CHECK_MATRIX_NORM(matrix) #endif #define CHECK_MATRIX(matrix) CHECK_MATRIX_FINITE(matrix); PRINT_MATRIX(matrix) #endif /* DEVICE_MATRIX_BASE_H */
28.303922
96
0.658123
[ "shape", "vector" ]
7b23f0e4101857096d0bea0de1d0c5bfdd03a98d
8,350
h
C
Examples/include/Aspose.Pdf.Cpp/Presentation/Graphics/Core/SizeF.h
kashifiqb/Aspose.PDF-for-C
13d49bba591c5704685820185741e64a462a5bdc
[ "MIT" ]
null
null
null
Examples/include/Aspose.Pdf.Cpp/Presentation/Graphics/Core/SizeF.h
kashifiqb/Aspose.PDF-for-C
13d49bba591c5704685820185741e64a462a5bdc
[ "MIT" ]
null
null
null
Examples/include/Aspose.Pdf.Cpp/Presentation/Graphics/Core/SizeF.h
kashifiqb/Aspose.PDF-for-C
13d49bba591c5704685820185741e64a462a5bdc
[ "MIT" ]
null
null
null
#pragma once // Copyright (c) 2001-2019 Aspose Pty Ltd. All Rights Reserved. #include <system/string.h> #include <system/shared_ptr.h> #include <system/object.h> #include <cstdint> #include "aspose_pdf_api_defs.h" namespace Aspose { namespace Pdf { namespace Engine { namespace Presentation { namespace Graphics { class PointF; } } } } } namespace Aspose { namespace Pdf { namespace Engine { namespace Presentation { namespace Graphics { class Size; } } } } } namespace Aspose { namespace Pdf { namespace Engine { namespace Presentation { namespace Graphics { /// <summary> /// Stores an ordered pair of floating-point numbers, typically the width and height of a rectangle. /// </summary> class ASPOSE_PDF_SHARED_API SizeF : public System::Object { typedef SizeF ThisType; typedef System::Object BaseType; typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo; RTTI_INFO_DECL(); FRIEND_FUNCTION_System_MakeObject; friend ASPOSE_PDF_SHARED_API SizeF operator +(SizeF size1, SizeF size2); friend ASPOSE_PDF_SHARED_API SizeF operator -(SizeF size1, SizeF size2); friend ASPOSE_PDF_SHARED_API bool operator ==(SizeF const &size1, SizeF const &size2); friend ASPOSE_PDF_SHARED_API bool operator !=(SizeF const &size1, SizeF const &size2); public: /// <summary> /// Gets a new instance of the <see cref="Aspose::Pdf::Engine::Presentation::Graphics::SizeF"/> structure that has <see cref="Aspose::Pdf::Engine::Presentation::Graphics::SizeF::Width"/> and <see cref="Aspose::Pdf::Engine::Presentation::Graphics::SizeF::Height"/> values set to zero. /// </summary> static SizeF get_Empty(); /// <summary> /// Gets a value indicating whether this <see cref="Aspose::Pdf::Engine::Presentation::Graphics::SizeF"/> has zero width and height. /// </summary> /// <returns>This property returns true when this <see cref="Aspose::Pdf::Engine::Presentation::Graphics::SizeF"/> has both a width and height of zero; otherwise, false.</returns> bool get_IsEmpty(); /// <summary> /// Gets the horizontal component of this <see cref="Aspose::Pdf::Engine::Presentation::Graphics::SizeF"/>. /// </summary> /// <returns>The horizontal component of this <see cref="Aspose::Pdf::Engine::Presentation::Graphics::SizeF"/>, typically measured in pixels.</returns> float get_Width() const; /// <summary> /// Sets the horizontal component of this <see cref="Aspose::Pdf::Engine::Presentation::Graphics::SizeF"/>. /// </summary> /// <param name="value">The horizontal component of this <see cref="Aspose::Pdf::Engine::Presentation::Graphics::SizeF"/>, typically measured in pixels.</param> void set_Width(float value); /// <summary> /// Gets the vertical component of this <see cref="Aspose::Pdf::Engine::Presentation::Graphics::SizeF"/>. /// </summary> /// <returns>The vertical component of this <see cref="Aspose::Pdf::Engine::Presentation::Graphics::SizeF"/>, typically measured in pixels.</returns> float get_Height() const; /// <summary> /// Sets the vertical component of this <see cref="Aspose::Pdf::Engine::Presentation::Graphics::SizeF"/>. /// </summary> /// <param name="value">The vertical component of this <see cref="Aspose::Pdf::Engine::Presentation::Graphics::SizeF"/>, typically measured in pixels.</param> void set_Height(float value); /// <summary> /// Initializes a new instance of the <see cref="Aspose::Pdf::Engine::Presentation::Graphics::SizeF"/> structure from the specified <see cref="Aspose::Pdf::Engine::Presentation::Graphics::SizeF"/>. /// </summary> /// <param name="size">The <see cref="Aspose::Pdf::Engine::Presentation::Graphics::SizeF"/> from which to create the new <see cref="Aspose::Pdf::Engine::Presentation::Graphics::SizeF"/>.</param> SizeF(SizeF const &size); /// <summary> /// Initializes a new instance of the <see cref="Aspose::Pdf::Engine::Presentation::Graphics::SizeF"/> structure from the specified <see cref="Aspose::Pdf::Engine::Presentation::Graphics::PointF"/>. /// </summary> /// <param name="point">The <see cref="Aspose::Pdf::Engine::Presentation::Graphics::PointF"/> from which to initialize this <see cref="Aspose::Pdf::Engine::Presentation::Graphics::SizeF"/>.</param> SizeF(PointF point); /// <summary> /// Initializes a new instance of the <see cref="Aspose::Pdf::Engine::Presentation::Graphics::SizeF"/> structure from the specified dimensions. /// </summary> /// <param name="width">The width component of the new <see cref="Aspose::Pdf::Engine::Presentation::Graphics::SizeF"/>.</param> /// <param name="height">The height component of the new <see cref="Aspose::Pdf::Engine::Presentation::Graphics::SizeF"/>.</param> SizeF(float width, float height); static PointF to_PointF(SizeF size); /// <summary> /// Adds the width and height of one <see cref="Aspose::Pdf::Engine::Presentation::Graphics::SizeF"/> structure to the width and height of another <see cref="Aspose::Pdf::Engine::Presentation::Graphics::SizeF"/> structure. /// </summary> /// <param name="size1">The first <see cref="Aspose::Pdf::Engine::Presentation::Graphics::SizeF"/> to add.</param> /// <param name="size2">The second <see cref="Aspose::Pdf::Engine::Presentation::Graphics::SizeF"/> to add.</param> /// <returns>A <see cref="Aspose::Pdf::Engine::Presentation::Graphics::SizeF"/> structure that is the result of the addition operation.</returns> static SizeF Add(SizeF size1, SizeF size2); /// <summary> /// Subtracts the width and height of one <see cref="Aspose::Pdf::Engine::Presentation::Graphics::SizeF"/> structure from the width and height of another <see cref="Aspose::Pdf::Engine::Presentation::Graphics::SizeF"/> structure. /// </summary> /// <param name="size1">The <see cref="Aspose::Pdf::Engine::Presentation::Graphics::SizeF"/> structure on the left side of the subtraction operator.</param> /// <param name="size2">The <see cref="Aspose::Pdf::Engine::Presentation::Graphics::SizeF"/> structure on the right side of the subtraction operator.</param> /// <returns>The <see cref="Aspose::Pdf::Engine::Presentation::Graphics::SizeF"/> that is a result of the subtraction operation.</returns> static SizeF Subtract(SizeF size1, SizeF size2); /// <summary> /// Converts a <see cref="Aspose::Pdf::Engine::Presentation::Graphics::SizeF"/> to a <see cref="Aspose::Pdf::Engine::Presentation::Graphics::PointF"/>. /// </summary> /// <returns>Returns a <see cref="Aspose::Pdf::Engine::Presentation::Graphics::PointF"/> structure.</returns> PointF ToPointF(); /// <summary> /// Converts a <see cref="Aspose::Pdf::Engine::Presentation::Graphics::SizeF"/> to a <see cref="Aspose::Pdf::Engine::Presentation::Graphics::Size"/> structure with truncated size values. /// </summary> /// <returns>Returns a <see cref="Aspose::Pdf::Engine::Presentation::Graphics::Size"/> structure.</returns> Size ToSize(); /// <summary> /// Returns a hash code for this <see cref="Aspose::Pdf::Engine::Presentation::Graphics::Size"/> structure. /// </summary> /// <returns>An integer value that specifies a hash value for this <see cref="Aspose::Pdf::Engine::Presentation::Graphics::Size"/> structure.</returns> virtual int32_t GetHashCode() const; /// <summary> /// Creates a human-readable string that represents this <see cref="Aspose::Pdf::Engine::Presentation::Graphics::SizeF"/>. /// </summary> /// <returns>A string that represents this <see cref="Aspose::Pdf::Engine::Presentation::Graphics::SizeF"/>.</returns> virtual System::String ToString() const; SizeF(); private: static SizeF empty; float width; float height; static struct __StaticConstructor__ { __StaticConstructor__(); } s_constructor__; }; ASPOSE_PDF_SHARED_API SizeF operator +(SizeF size1, SizeF size2); ASPOSE_PDF_SHARED_API SizeF operator -(SizeF size1, SizeF size2); ASPOSE_PDF_SHARED_API bool operator ==(SizeF const &size1, SizeF const &size2); ASPOSE_PDF_SHARED_API bool operator !=(SizeF const &size1, SizeF const &size2); } // namespace Graphics } // namespace Presentation } // namespace Engine } // namespace Pdf } // namespace Aspose
55.298013
287
0.692335
[ "object" ]
7b298a2c2b603b1b8d3ab72a1c8de0e23a5d8fd0
5,336
h
C
Common/CoordinateSystem/CoordSysOneGrid.h
achilex/MgDev
f7baf680a88d37659af32ee72b9a2046910b00d8
[ "PHP-3.0" ]
2
2017-04-19T01:38:30.000Z
2020-07-31T03:05:32.000Z
Common/CoordinateSystem/CoordSysOneGrid.h
achilex/MgDev
f7baf680a88d37659af32ee72b9a2046910b00d8
[ "PHP-3.0" ]
null
null
null
Common/CoordinateSystem/CoordSysOneGrid.h
achilex/MgDev
f7baf680a88d37659af32ee72b9a2046910b00d8
[ "PHP-3.0" ]
1
2021-12-29T10:46:12.000Z
2021-12-29T10:46:12.000Z
// // Copyright (C) 2004-2011 by Autodesk, Inc. // // This library is free software; you can redistribute it and/or // modify it under the terms of version 2.1 of the GNU Lesser // General Public License as published by the Free Software Foundation. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // // 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA // #ifndef _CCOORDINATESYSTEMGRIDBASE_H_ #define _CCOORDINATESYSTEMGRIDBASE_H_ namespace CSLibrary { /////////////////////////////////////////////////////////////////////////////// // CCoordinateSystemOneGrid // // An object which encapsulates the functionality of a single grid; a single // grid being a grid based on one grid coordinate system and one viewport // coordinate system. // // While a generic grid will always consist of a single instance of an object // of this type, an MGRS grid (for example) may require several instances of // this object, using different grid coordinate systems, to accurately // represent the actual overall grid. Thus, we encapsulate most basic grid // functionality in this object. // // The object includes a STRING data member which can carry a label which users // may use at their convenience. This object does nothing with the label // other than enable the user to set it and retrieve it. class CCoordinateSystemOneGrid : public MgGuardDisposable { public: static const INT32 MaxCurvePoints; CCoordinateSystemOneGrid (INT64 gridLineMemoryThreshold, INT64 gridTickMemoryThreshold); CCoordinateSystemOneGrid (MgCoordinateSystemGridBoundary* frameBoundary, MgCoordinateSystem* gridCRS, MgCoordinateSystem* frameCRS, INT64 gridLineMemoryThreshold, INT64 gridTickMemoryThreshold); ~CCoordinateSystemOneGrid (void); void SetUp (MgCoordinateSystemGridBoundary* frameBoundary, MgCoordinateSystem* gridCRS, MgCoordinateSystem* frameCRS); // Returns true if the grid coordinate system is geographic; use this to // determine if this is a graticule (as opposed to a grid). bool GridFrameCrsAreTheSame (); bool IsGeographic (void); INT32 GetUserID (void); STRING GetLabel (void); void SetUserID (INT32 userID); void SetLabel (CREFSTRING label); MgCoordinate* ConvertToGrid (MgCoordinate* frameCoordinate); MgCoordinate* ConvertToFrame (MgCoordinate* gridCoordinate); MgCoordinateSystemGridLineCollection* GetGridLines (MgCoordinateSystemGridSpecification* specs); CCoordinateSystemGridTickCollection* GetBoundaryTicks (MgCoordinateSystemGridSpecification* specs); INT32 ApproxGridLineMemoryUsage (MgCoordinateSystemGridSpecification* specification); INT32 ApproxGridTickMemoryUsage (MgCoordinateSystemGridSpecification* specification); void ResetGridLineMemoryThreshold(INT64 memThreshold); void ResetGridTickMemoryThreshold(INT64 memThreshold); protected: MgCoordinateSystemGridBoundary* GetFrameBoundary (void); MgCoordinateSystemGridBoundary* GetGridBoundary (void); MgCoordinateSystem* GetFrameCRS (void); MgCoordinateSystem* GetGridCRS (void); MgCoordinateSystemTransform* GetGridToFrameXform (void); MgCoordinateSystemTransform* GetFrameToGridXform (void); void GenerateGridBoundary (double boundaryPrecision); void GetGeographicExtents (double& longMin,double& longMax,double& latMin,double& latMax,double precision = 1.0E-05); void GetGridExtents (double& eastMin,double& eastMax,double& northMin,double& northMax,double precision = 0.25); void Dispose (void); bool m_GridFrameCrsSame; INT32 m_UserID; // For user convenience (i.e. UTM zone) INT32 m_MaxCurvePoints; STRING m_Label; // For user conveinence (i.e. MGRS) INT64 m_GridLineMemoryThreshold; INT64 m_GridTickMemoryThreshold; Ptr<MgCoordinateSystem> m_GridCRS; // The grid coordinate system Ptr<MgCoordinateSystem> m_FrameCRS; // The frame coordinate system Ptr<MgCoordinateSystemTransform> m_ToFrameXform; // Converts grid coordinates to frame coordinates Ptr<MgCoordinateSystemTransform> m_ToGridXform; // Converts frame coordinates to grid coordinates double m_BoundaryPrecision; // Precision at which the boundary conversion was performed Ptr<MgCoordinateSystemGridBoundary> m_FrameBoundary; // Grid boundary in frame coordinates Ptr<MgCoordinateSystemGridBoundary> m_GridBoundary; // Grid boundary in grid coordinates private: // Not implemented CCoordinateSystemOneGrid (const CCoordinateSystemOneGrid& source); CCoordinateSystemOneGrid& operator= (const CCoordinateSystemOneGrid& rhs); }; } /* namespace CSLibrary */ #endif /* _CCOORDINATESYSTEMGRIDBASE_H_ */
47.221239
121
0.722639
[ "object" ]
7b2c1097d23e3299a4f30bbe6e58d568e6b1cf9b
2,419
h
C
components/m8rscript/Program.h
cmarrin/m8rscript
4e24800e1be2c2c5e2ec1b7b52aa6df787e6460c
[ "MIT" ]
1
2018-01-30T19:37:27.000Z
2018-01-30T19:37:27.000Z
components/m8rscript/Program.h
cmarrin/m8rscript
4e24800e1be2c2c5e2ec1b7b52aa6df787e6460c
[ "MIT" ]
null
null
null
components/m8rscript/Program.h
cmarrin/m8rscript
4e24800e1be2c2c5e2ec1b7b52aa6df787e6460c
[ "MIT" ]
3
2017-04-01T23:41:35.000Z
2019-12-14T23:26:24.000Z
/*------------------------------------------------------------------------- This source file is a part of m8rscript For the latest info, see http:www.marrin.org/ Copyright (c) 2018-2019, Chris Marrin All rights reserved. Use of this source code is governed by the MIT license that can be found in the LICENSE file. -------------------------------------------------------------------------*/ #pragma once #include "Atom.h" #include "Function.h" #include "Global.h" namespace m8rscript { class Program : public Function { public: Program(); ~Program(); virtual void gcMark() override { Function::gcMark(); } virtual m8r::String toString(ExecutionUnit* eu, bool typeOnly = false) const override { return typeOnly ? m8r::String("Program") : Function::toString(eu, false); } const char* stringFromAtom(const m8r::Atom& atom) const { return _atomTable.stringFromAtom(atom); } m8r::Atom atomizeString(const char* s) const { return _atomTable.atomizeString(s); } StringLiteral startStringLiteral() { return StringLiteral(StringLiteral::Raw(static_cast<uint32_t>(_stringLiteralTable.size()))); } void addToStringLiteral(char c) { _stringLiteralTable.push_back(c); } void endStringLiteral() { _stringLiteralTable.push_back('\0'); } StringLiteral addStringLiteral(const char* s) { size_t length = strlen(s); size_t index = _stringLiteralTable.size(); _stringLiteralTable.resize(index + length + 1); memcpy(&(_stringLiteralTable[index]), s, length + 1); return StringLiteral(StringLiteral::Raw(static_cast<uint32_t>(index))); } const char* stringFromStringLiteral(const StringLiteral& id) const { return &(_stringLiteralTable[id.raw()]); } StringLiteral stringLiteralFromString(const char* s) { const char* table = &_stringLiteralTable[0]; size_t size = _stringLiteralTable.size(); for (size_t i = 0; i < size; ) { // Find the next string if (strcmp(s, table + i) == 0) { return StringLiteral(StringLiteral::Raw(static_cast<uint32_t>(i))); } i += strlen(table + i) + 1; } // Not found, add it return addStringLiteral(s); } private: m8r::AtomTable _atomTable; m8r::Vector<char> _stringLiteralTable; }; }
33.597222
167
0.603969
[ "vector" ]
7e298d7167363ffeede4e52f0093cc3892fd4245
1,242
c
C
Source/hud.c
MasterQ32/SQEditor
723d0ac417a65400a68cb9feeb2cf0f1a316e82a
[ "MIT" ]
3
2020-09-10T16:05:51.000Z
2021-12-29T01:06:05.000Z
Source/hud.c
MasterQ32/SQEditor
723d0ac417a65400a68cb9feeb2cf0f1a316e82a
[ "MIT" ]
null
null
null
Source/hud.c
MasterQ32/SQEditor
723d0ac417a65400a68cb9feeb2cf0f1a316e82a
[ "MIT" ]
null
null
null
#ifndef _HUD_C_ #define _HUD_C_ #define HUD_DEFAULT 0 #define HUD_USE 1 #define HUD_LOOK 2 BMAP *hudCrosshairDefault = "crosshair.tga"; BMAP *hudCrosshairHand = "hand_grab.tga"; BMAP *hudCrosshairEye = "eye.tga"; BMAP *hudCrosshairHealth = "crosshair_life.tga"; PANEL *panCrosshair = { bmap = hudCrosshairDefault; flags = SHOW; layer = 1; } PANEL *panCrosshairHealth = { bmap = hudCrosshairHealth; flags = SHOW | LIGHT; red = 255; layer = 2; } var hud_health = 0; var hud_mode = 0; function hud_init() { while(1) { panCrosshair->pos_x = 0.5 * screen_size.x - 16; panCrosshair->pos_y = 0.5 * screen_size.y - 16; panCrosshairHealth->pos_x = 0.5 * screen_size.x - 16; panCrosshairHealth->pos_y = 0.5 * screen_size.y - 16; vec_lerp(&panCrosshairHealth->blue, vector(0, 0, 255), vector(0, 255, 0), 0.01 * hud_health); reset(panCrosshairHealth, SHOW); if(hud_mode == HUD_DEFAULT) { panCrosshair->bmap = hudCrosshairDefault; set(panCrosshairHealth, SHOW); } else if(hud_mode == HUD_USE) { panCrosshair->bmap = hudCrosshairHand; } else if(hud_mode == HUD_LOOK) { panCrosshair->bmap = hudCrosshairEye; } wait(1); } } #endif
20.7
96
0.652979
[ "vector" ]
7e2c00ab4b1b147513aa28288daddfc13321635a
2,369
h
C
VFS/RenderPass/Clipmap/VoxelizationPass.h
Snowapril/VFS
a366f519c1382cfa2669b56346b67737513d6099
[ "MIT" ]
2
2022-02-14T16:34:39.000Z
2022-02-25T06:11:42.000Z
VFS/RenderPass/Clipmap/VoxelizationPass.h
Snowapril/vk_voxel_cone_tracing
a366f519c1382cfa2669b56346b67737513d6099
[ "MIT" ]
null
null
null
VFS/RenderPass/Clipmap/VoxelizationPass.h
Snowapril/vk_voxel_cone_tracing
a366f519c1382cfa2669b56346b67737513d6099
[ "MIT" ]
null
null
null
// Author : Jihong Shin (snowapril) #if !defined(VFS_VOXELIZATION_PASS_H) #define VFS_VOXELIZATION_PASS_H #include <pch.h> #include <Util/EngineConfig.h> #include <RenderPass/RenderPassBase.h> #include <RenderPass/Clipmap/ClipmapRegion.h> #include <Counter.h> #include <BoundingBox.h> #include <array> namespace vfs { class Voxelizer; class VoxelizationPass : public RenderPassBase { public: explicit VoxelizationPass(CommandPoolPtr cmdPool, uint32_t voxelResolution); explicit VoxelizationPass(CommandPoolPtr cmdPool, uint32_t voxelResolution, uint32_t voxelExtentLevel0, const DescriptorSetLayoutPtr& globalDescLayout); ~VoxelizationPass(); public: bool initialize (uint32_t voxelResolution, uint32_t voxelExtentLevel0, const DescriptorSetLayoutPtr& globalDescLayout); VoxelizationPass& createVoxelClipmap (uint32_t extentLevel0); VoxelizationPass& createDescriptors (void); VoxelizationPass& createPipeline (const DescriptorSetLayoutPtr& globalDescLayout); void createOpacityVoxelSlice(void); void updateOpacityVoxelSlice(void); void drawGUI (void) override; void drawDebugInfo (void) override; private: void onBeginRenderPass (const FrameLayout* frameLayout) override; void onEndRenderPass (const FrameLayout* frameLayout) override; void onUpdate (const FrameLayout* frameLayout) override; glm::ivec3 calculateChangeDelta (const uint32_t clipLevel, const BoundingBox<glm::vec3>& cameraBB); void fillRevoxelizationRegions(const uint32_t clipLevel, const BoundingBox<glm::vec3>& boundingBox); private: Voxelizer* _voxelizer { nullptr }; Image* _voxelOpacity { nullptr }; ImageView* _voxelOpacityView { nullptr }; Sampler* _voxelSampler { nullptr }; DescriptorPoolPtr _descriptorPool; DescriptorSetPtr _descriptorSet; DescriptorSetLayoutPtr _descriptorLayout; std::array<ClipmapRegion, DEFAULT_CLIP_REGION_COUNT> _clipmapRegions; std::array<std::vector<ClipmapRegion>, DEFAULT_CLIP_REGION_COUNT> _revoxelizationRegions; std::array<int32_t, DEFAULT_CLIP_REGION_COUNT> _clipMinChange{ 2, 2, 2, 2, 2, 1 }; uint32_t _voxelResolution; bool _fullRevoxelization { true }; std::vector<std::pair<ImagePtr, ImageViewPtr>> _opacitySlice; std::vector<VkDescriptorSet> _opacitySliceDescSet; SamplerPtr _opacitySliceSampler; }; }; #endif
35.358209
103
0.77881
[ "vector" ]
7e3df80136f30664ac80efa532ac4d8653a6c7d3
6,483
h
C
wav/include/tencentcloud/wav/v20210129/model/TagGroup.h
suluner/tencentcloud-sdk-cpp
a56c73cc3f488c4d1e10755704107bb15c5e000d
[ "Apache-2.0" ]
43
2019-08-14T08:14:12.000Z
2022-03-30T12:35:09.000Z
wav/include/tencentcloud/wav/v20210129/model/TagGroup.h
suluner/tencentcloud-sdk-cpp
a56c73cc3f488c4d1e10755704107bb15c5e000d
[ "Apache-2.0" ]
12
2019-07-15T10:44:59.000Z
2021-11-02T12:35:00.000Z
wav/include/tencentcloud/wav/v20210129/model/TagGroup.h
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. */ #ifndef TENCENTCLOUD_WAV_V20210129_MODEL_TAGGROUP_H_ #define TENCENTCLOUD_WAV_V20210129_MODEL_TAGGROUP_H_ #include <string> #include <vector> #include <map> #include <tencentcloud/core/utils/rapidjson/document.h> #include <tencentcloud/core/utils/rapidjson/writer.h> #include <tencentcloud/core/utils/rapidjson/stringbuffer.h> #include <tencentcloud/core/AbstractModel.h> #include <tencentcloud/wav/v20210129/model/TagDetailInfo.h> namespace TencentCloud { namespace Wav { namespace V20210129 { namespace Model { /** * 标签组信息 */ class TagGroup : public AbstractModel { public: TagGroup(); ~TagGroup() = default; void ToJsonObject(rapidjson::Value &value, rapidjson::Document::AllocatorType& allocator) const; CoreInternalOutcome Deserialize(const rapidjson::Value &value); /** * 获取企微标签组id * @return GroupId 企微标签组id */ std::string GetGroupId() const; /** * 设置企微标签组id * @param GroupId 企微标签组id */ void SetGroupId(const std::string& _groupId); /** * 判断参数 GroupId 是否已赋值 * @return GroupId 是否已赋值 */ bool GroupIdHasBeenSet() const; /** * 获取标签组业务id * @return BizGroupId 标签组业务id */ std::string GetBizGroupId() const; /** * 设置标签组业务id * @param BizGroupId 标签组业务id */ void SetBizGroupId(const std::string& _bizGroupId); /** * 判断参数 BizGroupId 是否已赋值 * @return BizGroupId 是否已赋值 */ bool BizGroupIdHasBeenSet() const; /** * 获取企微标签组名称,不能超过15个字符 * @return GroupName 企微标签组名称,不能超过15个字符 */ std::string GetGroupName() const; /** * 设置企微标签组名称,不能超过15个字符 * @param GroupName 企微标签组名称,不能超过15个字符 */ void SetGroupName(const std::string& _groupName); /** * 判断参数 GroupName 是否已赋值 * @return GroupName 是否已赋值 */ bool GroupNameHasBeenSet() const; /** * 获取标签组次序值。sort值大的排序靠前。有效的值范围是[0, 2^32) * @return Sort 标签组次序值。sort值大的排序靠前。有效的值范围是[0, 2^32) */ uint64_t GetSort() const; /** * 设置标签组次序值。sort值大的排序靠前。有效的值范围是[0, 2^32) * @param Sort 标签组次序值。sort值大的排序靠前。有效的值范围是[0, 2^32) */ void SetSort(const uint64_t& _sort); /** * 判断参数 Sort 是否已赋值 * @return Sort 是否已赋值 */ bool SortHasBeenSet() const; /** * 获取标签组创建时间,单位为秒 * @return CreateTime 标签组创建时间,单位为秒 */ uint64_t GetCreateTime() const; /** * 设置标签组创建时间,单位为秒 * @param CreateTime 标签组创建时间,单位为秒 */ void SetCreateTime(const uint64_t& _createTime); /** * 判断参数 CreateTime 是否已赋值 * @return CreateTime 是否已赋值 */ bool CreateTimeHasBeenSet() const; /** * 获取标签组内的标签列表, 上限为20 * @return Tags 标签组内的标签列表, 上限为20 */ std::vector<TagDetailInfo> GetTags() const; /** * 设置标签组内的标签列表, 上限为20 * @param Tags 标签组内的标签列表, 上限为20 */ void SetTags(const std::vector<TagDetailInfo>& _tags); /** * 判断参数 Tags 是否已赋值 * @return Tags 是否已赋值 */ bool TagsHasBeenSet() const; private: /** * 企微标签组id */ std::string m_groupId; bool m_groupIdHasBeenSet; /** * 标签组业务id */ std::string m_bizGroupId; bool m_bizGroupIdHasBeenSet; /** * 企微标签组名称,不能超过15个字符 */ std::string m_groupName; bool m_groupNameHasBeenSet; /** * 标签组次序值。sort值大的排序靠前。有效的值范围是[0, 2^32) */ uint64_t m_sort; bool m_sortHasBeenSet; /** * 标签组创建时间,单位为秒 */ uint64_t m_createTime; bool m_createTimeHasBeenSet; /** * 标签组内的标签列表, 上限为20 */ std::vector<TagDetailInfo> m_tags; bool m_tagsHasBeenSet; }; } } } } #endif // !TENCENTCLOUD_WAV_V20210129_MODEL_TAGGROUP_H_
31.935961
116
0.427271
[ "vector", "model" ]
7e70dbf2e4a3a6a346ba8388918926079ab11b84
4,902
h
C
Source/FactoryGame/RailroadNavigation.h
iam-Legend/Project-Assembly
1ff3587704232d5e330515bc0d2aceb64ff09a7f
[ "MIT" ]
null
null
null
Source/FactoryGame/RailroadNavigation.h
iam-Legend/Project-Assembly
1ff3587704232d5e330515bc0d2aceb64ff09a7f
[ "MIT" ]
null
null
null
Source/FactoryGame/RailroadNavigation.h
iam-Legend/Project-Assembly
1ff3587704232d5e330515bc0d2aceb64ff09a7f
[ "MIT" ]
null
null
null
// Copyright 2016 Coffee Stain Studios. All Rights Reserved. #pragma once #include "Array.h" #include "UObject/Class.h" #include "FactoryGame.h" #include "Buildables/FGBuildableRailroadTrack.h" #include "RailroadNavigation.generated.h" /** Pathfinding result. */ UENUM() enum class ERailroadPathFindingResult : uint8 { RNQR_Error = 0 UMETA( DisplayName = "Error" ), RNQR_Unreachable = 1 UMETA( DisplayName = "Unreachable" ), RNQR_Success = 2 UMETA( DisplayName = "Success" ) }; USTRUCT(BlueprintType) struct FRailroadPathPoint { GENERATED_BODY() public: /** Ctor */ FRailroadPathPoint(); public: /** * Object along the path, may be a connection, switch, stop, signal, sign etc. * Must implement IFGRailroadInterface. */ UPROPERTY( BlueprintReadOnly ) UObject* Object; //@todo This is UPROPERTY but I've gotten a dynamic cast crash from blueprint on this... /** The distance this object is from the end. 0 for the last point. */ UPROPERTY( BlueprintReadOnly ) float Distance; }; /** * A navigation path used by the trains to get to a destination. */ struct FRailroadPath { /** Path points to follow to the destination. */ TArray< FRailroadPathPoint > PathPoints; }; typedef TSharedPtr< struct FRailroadPath > FRailroadPathSharedPtr; typedef TWeakPtr< struct FRailroadPath > FRailroadPathWeakPtr; /** * A navigation result. */ USTRUCT(BlueprintType) struct FRailroadPathFindingResult { GENERATED_BODY() public: /** Ctor */ FRailroadPathFindingResult(); public: /** Shared pointer to the path. */ FRailroadPathSharedPtr Path; /** Is the path valid, partial or invalid. */ UPROPERTY( BlueprintReadOnly ) ERailroadPathFindingResult Result; }; /** * A path point along a trains route. */ struct FRailroadGraphAStarPathPoint { /** Default constructor, epic passes INDEX_NONE when creating a "null" point. */ FRailroadGraphAStarPathPoint( int32 unused = INDEX_NONE ); FRailroadGraphAStarPathPoint( const FRailroadGraphAStarPathPoint& point ); /** Compare two nodes. */ FORCEINLINE friend bool operator==( const FRailroadGraphAStarPathPoint& nodeA, const FRailroadGraphAStarPathPoint& nodeB ) { return nodeA.TrackConnection == nodeB.TrackConnection; } FORCEINLINE friend bool operator!=( const FRailroadGraphAStarPathPoint& nodeA, const FRailroadGraphAStarPathPoint& nodeB ) { return !( nodeA == nodeB ); } /** Provide hashing for this type so it can be used as a key in TMap. */ friend inline uint32 GetTypeHash( const FRailroadGraphAStarPathPoint& point ) { uint32 Hash = 0; Hash = HashCombine( Hash, GetTypeHash( point.TrackConnection ) ); return Hash; } public: /** When navigating though a rail network, we only need to know the next connection to go to. */ UFGRailroadTrackConnectionComponent* TrackConnection; }; /** * @see FGraphAStar */ struct FRailroadGraphAStarHelper { typedef FRailroadGraphAStarPathPoint FNodeRef; /** @return number of neighbours that the graph node identified with nodeRef has. */ int32 GetNeighbourCount( const FRailroadGraphAStarPathPoint& nodeRef ) const; /** @return whether given node identification is correct. */ bool IsValidRef( const FRailroadGraphAStarPathPoint& nodeRef ) const; /** @return neighbour ref. */ FRailroadGraphAStarPathPoint GetNeighbour( const FRailroadGraphAStarPathPoint& nodeRef, const int32 neighbourIndex ) const; /** * Helper used when starting up the algorithm, the start and end locations are track positions and this returns the neighbouring path point (track connection). * * @param position Arbitrary location along a track segment. * * @return The next path point on the current track segment given the position and forward direction. * If position is invalid this returns an invalid path point. */ FRailroadGraphAStarPathPoint GetNeighbour( const FRailroadTrackPosition& position ) const; }; /** * Evaluation filter for the pathfinding algorithm. */ struct FRailroadGraphAStarFilter { /** ctor */ FRailroadGraphAStarFilter(); /** Used as GetHeuristicCost's multiplier. */ float GetHeuristicScale() const; /** Estimate of cost from startNodeRef to endNodeRef. */ float GetHeuristicCost( const FRailroadGraphAStarPathPoint& startNodeRef, const FRailroadGraphAStarPathPoint& endNodeRef ) const; /** Real cost of traveling from startNodeRef directly to endNodeRef */ float GetTraversalCost( const FRailroadGraphAStarPathPoint& startNodeRef, const FRailroadGraphAStarPathPoint& endNodeRef ) const; /** Whether traversing given edge is allowed. */ bool IsTraversalAllowed( const FRailroadGraphAStarPathPoint& nodeA, const FRailroadGraphAStarPathPoint& nodeB ) const; /** Whether to accept solutions that do not reach the goal. */ bool WantsPartialSolution() const; public: /** true if a partial solution is valid; false if we only want a path if the goal is reachable. */ bool AcceptsPartialSolution; };
30.6375
160
0.759282
[ "object" ]
7e71ba32d85fcae473eaaa0880a0d8f38e56ac3a
923
h
C
CCKit/CCModelDelegate.h
cliq/CCKit
250c42621b904a411ef28669abb499d9d99f86a1
[ "MIT" ]
null
null
null
CCKit/CCModelDelegate.h
cliq/CCKit
250c42621b904a411ef28669abb499d9d99f86a1
[ "MIT" ]
null
null
null
CCKit/CCModelDelegate.h
cliq/CCKit
250c42621b904a411ef28669abb499d9d99f86a1
[ "MIT" ]
null
null
null
// // CCModelDelegate.h // CCKit // // Created by Leonardo Lobato on 12/2/12. // Copyright (c) 2012 Cliq Consulting. All rights reserved. // #import <Foundation/Foundation.h> @protocol CCModel; @protocol CCModelDelegate <NSObject> @optional - (void)modelDidStartLoad:(id<CCModel>)model; - (void)modelDidFinishLoad:(id<CCModel>)model; - (void)model:(id<CCModel>)model didFailLoadWithError:(NSError*)error; - (void)modelDidCancelLoad:(id<CCModel>)model; - (void)modelDidChange:(id<CCModel>)model; - (void)model:(id<CCModel>)model didUpdateObjects:(NSArray *)objects atIndexPaths:(NSArray *)indexPaths; - (void)model:(id<CCModel>)model didInsertObjects:(NSArray *)objects atIndexPaths:(NSArray *)indexPaths; - (void)model:(id<CCModel>)model didDeleteObjects:(NSArray *)objects atIndexPaths:(NSArray *)indexPaths; - (void)modelDidBeginUpdates:(id<CCModel>)model; - (void)modelDidEndUpdates:(id<CCModel>)model; @end
29.774194
104
0.751896
[ "model" ]
7e7354f6a99ca95f9092adcc1cb25516ebf14bd2
2,989
h
C
pcraster/pcraster-4.2.0/pcraster-4.2.0/source/pcraster_aguila/ag_RangeLegendBody.h
quanpands/wflow
b454a55e4a63556eaac3fbabd97f8a0b80901e5a
[ "MIT" ]
null
null
null
pcraster/pcraster-4.2.0/pcraster-4.2.0/source/pcraster_aguila/ag_RangeLegendBody.h
quanpands/wflow
b454a55e4a63556eaac3fbabd97f8a0b80901e5a
[ "MIT" ]
null
null
null
pcraster/pcraster-4.2.0/pcraster-4.2.0/source/pcraster_aguila/ag_RangeLegendBody.h
quanpands/wflow
b454a55e4a63556eaac3fbabd97f8a0b80901e5a
[ "MIT" ]
null
null
null
#ifndef INCLUDED_AG_RANGELEGENDBODY #define INCLUDED_AG_RANGELEGENDBODY #include <boost/noncopyable.hpp> #include "ag_LegendBody.h" class QwtScaleMap; namespace ag { class DataGuide; class DataObject; class RangeDrawProps; } namespace ag { //! The RangeLegendBody class is for body widgets for RangeLegend s. /*! */ class RangeLegendBody: private boost::noncopyable, public LegendBody { private: //! Nr of objects created. static size_t _nrCreated; //! Key box offset from upper left corner of body. static QSize _keyBoxOffset; //! Maximum key box height. static int _maxKeyBoxHeight; RangeDrawProps const& _drawProperties; RangeDrawProps const& drawProperties () const; int keyBoxHeight () const; int width () const; int height () const; int maxLengthLabel () const; void paintLineLegend (); void paintKeyLegend (); void paintVectorLegend (); void paintLabels (QPainter& painter, QwtScaleMap const& map, std::vector<double> const& borders, bool drawTics=true) const; QString label (size_t id) const; protected: void paintEvent (QPaintEvent* event); void showEvent (); public: //---------------------------------------------------------------------------- // CREATORS //---------------------------------------------------------------------------- RangeLegendBody (DataObject const& object, DataGuide const& guide, ViewerType type, QWidget* parent = 0); /* virtual */ ~RangeLegendBody (); //---------------------------------------------------------------------------- // MANIPULATORS //---------------------------------------------------------------------------- //---------------------------------------------------------------------------- // ACCESSORS //---------------------------------------------------------------------------- static QSize const& keyBoxOffset (); }; //------------------------------------------------------------------------------ // INLINE FUNCIONS //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ // FREE OPERATORS //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ // FREE FUNCTIONS //------------------------------------------------------------------------------ } // namespace ag #endif
24.702479
80
0.354968
[ "object", "vector" ]
7e7a141b56b17fbb68d402a51c6be8f5da4fd8dd
2,375
h
C
KnightEngine.h
tzhenghao/KnightBoard
d11e70119e62f2bd37ea2c8847f41e991c381ac8
[ "MIT" ]
null
null
null
KnightEngine.h
tzhenghao/KnightBoard
d11e70119e62f2bd37ea2c8847f41e991c381ac8
[ "MIT" ]
null
null
null
KnightEngine.h
tzhenghao/KnightBoard
d11e70119e62f2bd37ea2c8847f41e991c381ac8
[ "MIT" ]
null
null
null
#ifndef KNIGHTENGINE_H #define KNIGHTENGINE_H #include <iostream> #include <vector> #include <queue> #include <unordered_set> #include <unordered_map> #include "KnightBoard.h" using namespace std; // The eight possible moves that the knight can take from its current position. enum Moves { LEFTUP, LEFTDOWN, RIGHTUP, RIGHTDOWN, UPLEFT, UPRIGHT, DOWNLEFT, DOWNRIGHT }; class KnightEngine { private: vector <Position> path; // Stores the path that the program will take int countPath = 0; KnightBoard knightBoard; // REQUIRES: A map of nodes which they came from and the current node. // EFFECTS: Builds the current order of path from start to end positions. void buildPath(unordered_map<int, Position> &fromNodes, Position &currentNode); // REQUIRES: The two points. // EFFECTS: Calculates the heuristic cost via two points. // Returns 0 if teleportation is enabled. // Returns abs distance if teleportation is disabled. int calculateHeuristicCost(const Position &from, const Position &to); // REQUIRES: // EFFECTS: Generates neighbors for the current position. void generateNeighbor(Position &neighbor, const Position &pos, Moves i); // REQUIRES: The move to be valid. // EFFECTS: Returns the total travel cost to move to neighbor. int calculateTravelCost(Moves i, const Position &neighbor); // REQUIRES: The current state of the knight board and xy values of the board to check. // EFFECTS: Returns true if the terrain is valid. bool isTerrainValid(int x, int y); // REQUIRES: The position that we are moving into. // EFFECTS: Calculates the terrain cost for entering the specified position. int calculateTerrainCost(int x, int y); // REQUIRES: The current state of the knight board and a sequence of moves. // EFFECTS: Returns true if the sequence contains all valid knight moves. bool isMoveValid(const Position &knightPosition, const Position& position); public: KnightEngine(const Position &start, const Position &stop, const char *inputFile); // EFFECTS: Finds the best path from the given start and end points. // Returns a non-negative number for the cost of the path, // Returns -1 if it fails to find a path. int findBestPath(const Position &start, Position &stop); // EFFECTS: Prints the path. void printPath(); void task1(); void knightTour(); }; #endif
31.25
90
0.735158
[ "vector" ]
7e7c06c40ef34178193dd2b632a094b7b6ff239d
7,507
h
C
src/xtd.forms/include/xtd/forms/style_sheets/border_color.h
leanid/xtd
2e1ea6537218788ca08901faf8915d4100990b53
[ "MIT" ]
1
2022-02-25T16:53:06.000Z
2022-02-25T16:53:06.000Z
src/xtd.forms/include/xtd/forms/style_sheets/border_color.h
leanid/xtd
2e1ea6537218788ca08901faf8915d4100990b53
[ "MIT" ]
null
null
null
src/xtd.forms/include/xtd/forms/style_sheets/border_color.h
leanid/xtd
2e1ea6537218788ca08901faf8915d4100990b53
[ "MIT" ]
null
null
null
/// @file /// @brief Contains xtd::forms::style_sheets::border_color class. /// @copyright Copyright (c) 2022 Gammasoft. All rights reserved. #pragma once #include <xtd/iequatable.h> #include <xtd/ustring.h> #include <xtd/drawing/color.h> #include "../../forms_export.h" /// @brief The xtd namespace contains all fundamental classes to access Hardware, Os, System, and more. namespace xtd { /// @brief The xtd::forms namespace contains classes for creating Windows-based applications that take full advantage of the rich user interface features available in the Microsoft Windows operating system, Apple macOS and Linux like Ubuntu operating system. namespace forms { /// @brief The xtd::forms::style_sheets namespace contains various properties, states, and subcontrols that make it possible to customize the look of control. namespace style_sheets { /// @brief The xtd::forms::style_sheets::border_color is used to set the color of the borders. /// @code /// class forms_export_ border_color : public xtd::iequatable<border_color>, public xtd::object /// @endcode /// @par Inheritance /// xtd::object → xtd::forms::style_sheets::border_color /// @par Implements /// xtd::iequatable <> /// @par Namespace /// xtd::forms::style_sheets /// @par Library /// xtd.forms /// @ingroup xtd_forms style_sheets class forms_export_ border_color : public xtd::iequatable<border_color>, public xtd::object { public: /// @name Fields /// @{ /// @brief Provides an empty xtd::forms::style_sheets::border_color object. static const border_color empty; /// @} /// @name Constructors /// @{ /// @brief Initializes a new instance of the xtd::forms::style_sheets::border_color class. border_color() = default; /// @brief Initializes a new instance of the xtd::forms::style_sheets::border_color class using the supplied border_color for all edges. /// @param all The xtd::forms::style_sheets::color_data to be used for border_color for all edges. /// @remarks This constructor sets the right, left, bottom, top and all properties to the value of the all parameter. border_color(const xtd::drawing::color& all); /// @brief Initializes a new instance of the xtd::forms::style_sheets::border_color class using a separate border_color for each edge. /// @param left The border_color for the left edge. /// @param top The border_color for the top edge. /// @param right The border_color for the right edge. /// @param bottom The border_color for the bottom edge. /// @remarks If all of the parameter values are equal, then the all property will reflect this common value. border_color(const xtd::drawing::color& left, const xtd::drawing::color& top, const xtd::drawing::color& right, const xtd::drawing::color& bottom); /// @} /// @cond border_color(const border_color&) = default; border_color& operator=(const border_color&) = default; /// @endcond /// @name Peorperties /// @{ /// @brief Gets the xtd::forms::style_sheets::border_color value for all the edges. /// @return The xtd::forms::style_sheets::border_color for all edges if the same; otherwise, xtd::forms::style_sheets::color_data::empty. /// @remarks When retrieving this property, if all the edges use the same border_color value, then this common value is returned. Otherwise, xtd::forms::style_sheets::color_data::empty is returned to indicate that all the xtd::forms::style_sheets::border_color values are not equal. const xtd::drawing::color& all() const noexcept; /// @brief Sets the xtd::forms::style_sheets::border_color value for all the edges. /// @param all The xtd::forms::style_sheets::border_color for all edges if the same; otherwise, xtd::forms::style_sheets::color_data::empty. /// @remarks When retrieving this property, if all the edges use the same border_color value, then this common value is returned. Otherwise, xtd::forms::style_sheets::color_data::empty is returned to indicate that all the xtd::forms::style_sheets::border_color values are not equal. void all(const xtd::drawing::color& all) noexcept; /// @brief Gets the xtd::forms::style_sheets::border_color value for the bottom edge. /// @return The xtd::forms::style_sheets::border_color for the bottom edge. /// @remarks Setting this value can also alter the all property. const xtd::drawing::color& bottom() const noexcept; /// @brief Sets the xtd::forms::style_sheets::border_color value for the bottom edge. /// @param bottom The xtd::forms::style_sheets::border_color for the bottom edge. /// @remarks Setting this value can also alter the all property. void bottom(const xtd::drawing::color& bottom) noexcept; /// @brief Gets the xtd::forms::style_sheets::border_color value for the left edge. /// @return The xtd::forms::style_sheets::border_color for the left edge. /// @remarks Setting this value can also alter the all property. const xtd::drawing::color& left() const noexcept; /// @brief Sets the xtd::forms::style_sheets::border_color value for the left edge. /// @param left The xtd::forms::style_sheets::border_color for the left edge. /// @remarks Setting this value can also alter the all property. void left(const xtd::drawing::color& left) noexcept; /// @brief Gets the xtd::forms::style_sheets::border_color value for the right edge. /// @return The xtd::forms::style_sheets::border_color for the right edge. /// @remarks Setting this value can also alter the all property. const xtd::drawing::color& right() const noexcept; /// @brief Sets the xtd::forms::style_sheets::border_color value for the right edge. /// @param right The xtd::forms::style_sheets::border_color for the right edge. /// @remarks Setting this value can also alter the all property. void right(const xtd::drawing::color& right) noexcept; /// @brief Gets the xtd::forms::style_sheets::border_color value for the top edge. /// @return The xtd::forms::style_sheets::border_color for the top edge. /// @remarks Setting this value can also alter the all property. const xtd::drawing::color& top() const noexcept; /// @brief Sets the xtd::forms::style_sheets::border_color value for the top edge. /// @param top The xtd::forms::style_sheets::border_color for the top edge. /// @remarks Setting this value can also alter the all property. void top(const xtd::drawing::color& top) noexcept; /// @} /// @name Methods /// @{ bool equals(const object& other) const noexcept override; bool equals(const border_color& other) const noexcept override; /// @} private: bool all_ = true; xtd::drawing::color left_ = xtd::drawing::color::black; xtd::drawing::color top_ = xtd::drawing::color::black; xtd::drawing::color right_ = xtd::drawing::color::black; xtd::drawing::color bottom_ = xtd::drawing::color::black; }; } } }
58.193798
290
0.66085
[ "object" ]
47519740ac3b38456e776abdc63d2dce3c09c10f
1,057
h
C
src/cbs/components/Camera.h
Nerovski/RubiksCube
a8ac27e50544a44a1790d0a6f1af07be05768454
[ "MIT" ]
6
2020-06-27T10:29:40.000Z
2021-04-13T14:19:23.000Z
src/cbs/components/Camera.h
Nerovski/RubiksCube
a8ac27e50544a44a1790d0a6f1af07be05768454
[ "MIT" ]
null
null
null
src/cbs/components/Camera.h
Nerovski/RubiksCube
a8ac27e50544a44a1790d0a6f1af07be05768454
[ "MIT" ]
3
2021-05-30T05:32:24.000Z
2022-01-18T01:53:24.000Z
#pragma once #include "Component.h" #include "../Object.h" #include "../../scenes/Scene.h" #include "../../utilities/Time.h" #include "../../utilities/Input.h" #include "../../rendering/Cubemap.h" #pragma warning(push, 0) #include <glad/glad.h> #include <glm/glm.hpp> #include <glm/gtc/matrix_transform.hpp> #include <glm/gtx/rotate_vector.hpp> #pragma warning(pop) #include <iostream> #include <string> class Camera : public Component { public: Camera(glm::mat4 perspective); Camera(float fovy, float aspect, float near, float far); Camera(float left, float right, float bottom, float top, float near, float far); void Initialize() override; glm::mat4 ViewMatrix() const; const glm::mat4& Projection() const { return m_Projection; } private: glm::mat4 Perspective(float fovy, float aspect, float near, float far); glm::mat4 Orthographic(float left, float right, float bottom, float top, float near, float far); glm::mat4 m_ViewMatrix; glm::mat4 m_Projection; Transform* m_Transform; };
25.780488
100
0.685904
[ "object", "transform" ]
47620fd5ab682874145c3daccecd4b1bb8386e21
376
h
C
test/unit-tests/spdk_wrapper/free_buffer_pool_mock.h
YongJin-Cho/poseidonos
c07a0240316d4536aa09f22d7977604f3650d752
[ "BSD-3-Clause" ]
null
null
null
test/unit-tests/spdk_wrapper/free_buffer_pool_mock.h
YongJin-Cho/poseidonos
c07a0240316d4536aa09f22d7977604f3650d752
[ "BSD-3-Clause" ]
null
null
null
test/unit-tests/spdk_wrapper/free_buffer_pool_mock.h
YongJin-Cho/poseidonos
c07a0240316d4536aa09f22d7977604f3650d752
[ "BSD-3-Clause" ]
null
null
null
#include <gmock/gmock.h> #include <list> #include <string> #include <vector> #include "src/spdk_wrapper/free_buffer_pool.h" namespace pos { class MockFreeBufferPool : public FreeBufferPool { public: using FreeBufferPool::FreeBufferPool; MOCK_METHOD(void*, GetBuffer, (), (override)); MOCK_METHOD(void, ReturnBuffer, (void*), (override)); }; } // namespace pos
18.8
57
0.720745
[ "vector" ]
476b3eb34d15f225f2bf61d0db22fb54bf660be5
13,261
h
C
Dragon/include/core/context_cuda.h
awesome-archive/Dragon
b35f9320909d07d138c2f6b345a4c24911f7c521
[ "BSD-2-Clause" ]
null
null
null
Dragon/include/core/context_cuda.h
awesome-archive/Dragon
b35f9320909d07d138c2f6b345a4c24911f7c521
[ "BSD-2-Clause" ]
null
null
null
Dragon/include/core/context_cuda.h
awesome-archive/Dragon
b35f9320909d07d138c2f6b345a4c24911f7c521
[ "BSD-2-Clause" ]
null
null
null
/*! * Copyright (c) 2017-present, SeetaTech, Co.,Ltd. * * Licensed under the BSD 2-Clause License. * You should have received a copy of the BSD 2-Clause License * along with the software. If not, See, * * <https://opensource.org/licenses/BSD-2-Clause> * * ------------------------------------------------------------ */ #ifndef DRAGON_CORE_CONTEXT_CUDA_H_ #define DRAGON_CORE_CONTEXT_CUDA_H_ /*! NVIDIA's CUDA Environment */ #include "core/common.h" #include "utils/cuda_device.h" #include "utils/cudnn_device.h" namespace dragon { #ifdef WITH_CUDA class CUDAObject { public: /*! \brief Default Constructor */ CUDAObject() { for (int i = 0; i < CUDA_MAX_DEVICES; i++) { cuda_streams[i] = vector<cudaStream_t>(); cublas_handles[i] = vector<cublasHandle_t>(); #ifdef WITH_CUDNN cudnn_handles[i] = vector<cudnnHandle_t>(); #endif } } /*! \brief Deconstructor */ ~CUDAObject() { for (int i = 0; i < CUDA_MAX_DEVICES; i++) { for (int j = 0; j < cuda_streams[i].size(); j++) { auto& stream = cuda_streams[i][j]; /*! * Do not check the stream destroying, * error code 29 (driver shutting down) is inevitable. */ if (stream) cudaStreamDestroy(stream); } for (auto& handle : cublas_handles[i]) if (handle) { CUBLAS_CHECK(cublasDestroy_v2(handle)); } #ifdef WITH_CUDNN for (auto& handle : cudnn_handles[i]) if (handle) { CUDNN_CHECK(cudnnDestroy(handle)); } #endif } } /*! * Follow the caffe2, * Each device takes a group of non-blocking streams. * * The stream 0 is reserved for default stream, * as some computations really require it, * e.g. static primitives, cublas.asum(), * and hybrid cpu/cuda operations. */ /*! \brief Return the specified cuda stream */ cudaStream_t GetStream(int device_id, int stream_id) { vector<cudaStream_t>& dev_streams = cuda_streams[device_id]; if (dev_streams.size() <= (unsigned)stream_id) dev_streams.resize(stream_id + 1, nullptr); if (!dev_streams[stream_id]) { DeviceGuard guard(device_id); unsigned int flags = !stream_id ? cudaStreamDefault : cudaStreamNonBlocking; CUDA_CHECK(cudaStreamCreateWithFlags( &dev_streams[stream_id], flags)); } return dev_streams[stream_id]; } /*! \brief Return the default cuda stream of current device */ cudaStream_t GetDefaultStream() { return GetStream(CUDA_GET_DEVICE(), 0); } /*! \brief Return the default cuda stream of given device */ cudaStream_t GetDefaultStream(int device_id) { return GetStream(device_id, 0); } /*! \brief Return the specified cublas handle */ cublasHandle_t GetCuBLASHandle(int device_id, int stream_id) { vector<cublasHandle_t>& dev_handles = cublas_handles[device_id]; if (dev_handles.size() <= (unsigned)stream_id) dev_handles.resize(stream_id + 1, nullptr); if (!dev_handles[stream_id]) { DeviceGuard guard(device_id); CUBLAS_CHECK(cublasCreate_v2(&dev_handles[stream_id])); CUBLAS_CHECK(cublasSetStream_v2(dev_handles[stream_id], GetStream(device_id, stream_id))); #if CUDA_VERSION >= 9000 if (TENSOR_CORE_AVAILABLE()) CUBLAS_CHECK(cublasSetMathMode( dev_handles[stream_id], CUBLAS_TENSOR_OP_MATH)); #endif } return dev_handles[stream_id]; } /*! \brief Return the specified cudnn handle */ #ifdef WITH_CUDNN cudnnHandle_t GetCuDNNHandle(int device_id, int stream_id) { vector<cudnnHandle_t>& dev_handles = cudnn_handles[device_id]; if (dev_handles.size() <= (unsigned)stream_id) dev_handles.resize(stream_id + 1, nullptr); if (!dev_handles[stream_id]) { DeviceGuard guard(device_id); CUDNN_CHECK(cudnnCreate(&dev_handles[stream_id])); CUDNN_CHECK(cudnnSetStream(dev_handles[stream_id], GetStream(device_id, stream_id))); } return dev_handles[stream_id]; } #endif vector<cudaStream_t> cuda_streams[CUDA_MAX_DEVICES]; vector<cublasHandle_t> cublas_handles[CUDA_MAX_DEVICES]; #ifdef WITH_CUDNN vector<cudnnHandle_t> cudnn_handles[CUDA_MAX_DEVICES]; #endif bool cudnn_enabled = true; }; class CUDAContext { public: /*! \brief Default Constructor */ CUDAContext(const DeviceOption& option) : device_id_(option.device_id()), random_seed_(option.has_random_seed() ? option.random_seed() : DEFAULT_RNG_SEED) { CHECK_EQ(option.device_type(), PROTO_CUDA); } /*! \brief Constructor with the specified device id */ CUDAContext(const int device_id = 0) : device_id_(device_id), random_seed_(DEFAULT_RNG_SEED) {} /*! \brief Switch to the device with the given stream */ void SwitchToDevice(const int stream_id) { CUDA_CHECK(cudaSetDevice(device_id_)); stream_id_ = stream_id; } /*! \brief Switch to the device of this context */ void SwitchToDevice() { SwitchToDevice(0); } /*! \brief Synchronize the dispatched operations */ void FinishDeviceCompution() { cudaError_t error = SynchronizeStream(cuda_stream()); CHECK_EQ(error, cudaSuccess) << "\nCUDA Error: " << cudaGetErrorString(error); } /*! \brief Malloc the memory */ static void* New(size_t nbytes) { void* data; cudaMalloc(&data, nbytes); CHECK(data) << "\nMalloc cuda mem: " << nbytes << " bytes failed."; return data; } /*! \brief Zero-Reset the memory */ static void Memset( size_t nbytes, void* ptr) { cudaStream_t stream = CUDAContext:: cuda_object()->GetDefaultStream(); CUDA_CHECK(cudaMemsetAsync(ptr, 0, nbytes, stream)); cudaError_t error = SynchronizeStream(stream); CHECK_EQ(error, cudaSuccess) << "\nCUDA Error: " << cudaGetErrorString(error); } /*! \brief Zero-Reset the memory asynchronously */ void MemsetAsync( size_t nbytes, void* ptr) { CUDA_CHECK(cudaMemsetAsync(ptr, 0, nbytes, cuda_stream())); } /*! \brief Copy the memory */ template<class DstContext, class SrcContext> static void Memcpy( size_t nbytes, void* dst, const void* src) { MemcpyEx<DstContext, SrcContext>( nbytes, dst, src, active_device_id()); } /*! \brief Copy the memory [Extended] */ template<class DstContext, class SrcContext> static void MemcpyEx( size_t nbytes, void* dst, const void* src, int device_id) { cudaStream_t stream = CUDAContext:: cuda_object()->GetDefaultStream(device_id); CUDA_CHECK(cudaMemcpyAsync(dst, src, nbytes, cudaMemcpyDefault, stream)); cudaError_t error = SynchronizeStream(stream); CHECK_EQ(error, cudaSuccess) << "\nCUDA Error: " << cudaGetErrorString(error); } /*! \brief Copy the memory asynchronously */ template<class DstContext, class SrcContext> void MemcpyAsync( size_t nbytes, void* dst, const void* src) { CUDA_CHECK(cudaMemcpyAsync(dst, src, nbytes, cudaMemcpyDefault, cuda_stream())); } /*! \brief Copy the memory with given type asynchronously */ template<typename T, class DstContext, class SrcContext> void Copy( int n, T* dst, const T* src) { if (dst == src) return; MemcpyAsync<SrcContext, DstContext>( n * sizeof(T), (void*)dst, (const void*)src); } /*! \brief Free the memory */ static void Delete(void* data) { cudaFree(data); } /*! \brief Synchronize the specified cuda stream */ static cudaError_t SynchronizeStream(cudaStream_t stream) { cudaStreamSynchronize(stream); return cudaGetLastError(); } /*! \brief Return the device id of this context */ int device_id() const { return device_id_; } /*! \brief Return the active device id of current thread */ static int active_device_id() { return CUDA_GET_DEVICE(); } /*! \brief Return the stream id */ int stream_id() const { return stream_id_; } /*! \brief Set the stream id */ void set_stream_id(int stream_id) { stream_id_ = stream_id; } /*! \brief Return the internal cuda stream */ cudaStream_t cuda_stream() { return cuda_stream(device_id_, stream_id_); } /*! \brief Return the specified cuda stream */ cudaStream_t cuda_stream( int device_id, int stream_id) { return cuda_object()->GetStream(device_id, stream_id); } /*! \brief Return the internal cublas handle */ cublasHandle_t cublas_handle() { return cuda_object()->GetCuBLASHandle(device_id_, stream_id_); } /*! \brief Return the internal random generator */ std::mt19937* rand_generator() { if (!rand_generator_.get()) rand_generator_.reset(new std::mt19937(random_seed_)); return rand_generator_.get(); } /*! \brief Return the internal cuda random generator */ curandGenerator_t& curand_generator() { if (!curand_generator_) { DeviceGuard guard(device_id_); CURAND_CHECK(curandCreateGenerator( &curand_generator_, CURAND_RNG_PSEUDO_DEFAULT)); CURAND_CHECK(curandSetPseudoRandomGeneratorSeed( curand_generator_, random_seed_)); } CURAND_CHECK(curandSetStream( curand_generator_, cuda_stream())); return curand_generator_; } /*! \brief Return the internal cudnn handle */ #ifdef WITH_CUDNN cudnnHandle_t cudnn_handle() { return cuda_object()->GetCuDNNHandle(device_id_, stream_id_); } #endif /*! \brief Return the global context locker */ static std::mutex& mutex() { static std::mutex m; return m; } /*! \brief Return the thread local cuda object */ static CUDAObject* cuda_object() { static TLS_OBJECT CUDAObject* cuda_object_; if (!cuda_object_) cuda_object_ = new CUDAObject(); return cuda_object_; } private: int device_id_, stream_id_ = 0, random_seed_; unique_ptr<std::mt19937> rand_generator_; curandGenerator_t curand_generator_ = nullptr; }; #else // WITH_CUDA class CUDAContext { public: /*! \brief Default Constructor */ CUDAContext(const DeviceOption& option) { CUDA_NOT_COMPILED; } /*! \brief Constructor with the specified device id */ CUDAContext(const int device_id = 0) { CUDA_NOT_COMPILED; } /*! \brief Switch to the device with the given stream */ void SwitchToDevice(int stream_id) { CUDA_NOT_COMPILED; } /*! \brief Switch to the device of this context */ void SwitchToDevice() { CUDA_NOT_COMPILED; } /*! \brief Synchronize the dispatched operations */ void FinishDeviceCompution() { CUDA_NOT_COMPILED; } /*! \brief Malloc the memory */ static void* New(size_t nbytes) { CUDA_NOT_COMPILED; } /*! \brief Zero-Reset the memory */ static void Memset( size_t nbytes, void* ptr) { CUDA_NOT_COMPILED; } /*! \brief Zero-Reset the memory asynchronously */ void MemsetAsync( size_t nbytes, void* ptr) { CUDA_NOT_COMPILED; } /*! \brief Copy the memory */ template<class DstContext, class SrcContext> static void Memcpy( size_t nbytes, void* dst, const void* src) { CUDA_NOT_COMPILED; } /*! \brief Copy the memory [Extended] */ template<class DstContext, class SrcContext> static void MemcpyEx( size_t nbytes, void* dst, const void* src, int device_id) { CUDA_NOT_COMPILED; } /*! \brief Copy the memory asynchronously */ template<class DstContext, class SrcContext> void MemcpyAsync( size_t nbytes, void* dst, const void* src) { CUDA_NOT_COMPILED; } /*! \brief Return the device id */ int device_id() const { return 0; } /*! \brief Return the active device id of current thread */ static int active_device_id() { return 0; } /*! \brief Return the stream id */ int stream_id() const { return 0; } /*! \brief Set the stream id */ void set_stream_id(int stream_id) {} }; #endif // WITH_CUDA } // namespace dragon #endif // DRAGON_CORE_CONTEXT_CUDA_H_
32.74321
72
0.60184
[ "object", "vector" ]
476e9fc0855aaba16dfd6c7d2902512f03ef1bbd
863
h
C
physicsEngine/src/collision/broadphase/BroadPhaseAlgorithm.h
petitg1987/UrchinEngine
32d4b62b1ab7e2aa781c99de11331e3738078b0c
[ "MIT" ]
24
2015-10-05T00:13:57.000Z
2020-05-06T20:14:06.000Z
physicsEngine/src/collision/broadphase/BroadPhaseAlgorithm.h
petitg1987/urchinEngine
a14a57ac49a19237d748d2eafc7c2a38a45b95d6
[ "BSL-1.0" ]
1
2019-11-01T08:00:55.000Z
2019-11-01T08:00:55.000Z
physicsEngine/src/collision/broadphase/BroadPhaseAlgorithm.h
petitg1987/UrchinEngine
32d4b62b1ab7e2aa781c99de11331e3738078b0c
[ "MIT" ]
10
2015-11-25T07:33:13.000Z
2020-03-02T08:21:10.000Z
#pragma once #include <vector> #include <UrchinCommon.h> #include <body/model/AbstractBody.h> #include <collision/OverlappingPair.h> #include <collision/broadphase/PairContainer.h> namespace urchin { class BroadPhaseAlgorithm { public: virtual ~BroadPhaseAlgorithm() = default; virtual void addBody(const std::shared_ptr<AbstractBody>&) = 0; virtual void removeBody(const AbstractBody&) = 0; virtual void updateBodies() = 0; virtual const std::vector<std::unique_ptr<OverlappingPair>>& getOverlappingPairs() const = 0; virtual std::vector<std::shared_ptr<AbstractBody>> rayTest(const Ray<float>&) const = 0; virtual std::vector<std::shared_ptr<AbstractBody>> bodyTest(const AbstractBody&, const PhysicsTransform&, const PhysicsTransform&) const = 0; }; }
31.962963
153
0.682503
[ "vector", "model" ]
47710898021e58d2c05aeb4aadda9bc06a374478
1,218
h
C
conpick/ab2d/algorithm.h
yocchi/conpick
0d6c4a6c12642b84ffda3f73e54a4c816dd26ae7
[ "MIT" ]
null
null
null
conpick/ab2d/algorithm.h
yocchi/conpick
0d6c4a6c12642b84ffda3f73e54a4c816dd26ae7
[ "MIT" ]
null
null
null
conpick/ab2d/algorithm.h
yocchi/conpick
0d6c4a6c12642b84ffda3f73e54a4c816dd26ae7
[ "MIT" ]
null
null
null
#ifndef AB2D_ALGORITHM_H #define AB2D_ALGORITHM_H #include "model.h" namespace ab2d { void fk(const Robot& robot, const Eigen::VectorXd& pos, TransArray& rLinkTransform); void fk(const Robot& robot, const Eigen::VectorXd& pos, Cache& rCache); void propagateVel(const Robot& robot, const Eigen::VectorXd& vel, Cache& rCache); void fd(const Robot& robot, const Eigen::VectorXd& vel, const Eigen::VectorXd& force, const WrenchArray& extf, Cache& rCache, Eigen::VectorXd& rAcc); void fd(const Robot& robot, const Eigen::VectorXd& force, const WrenchArray& extf, Cache& rCache, Eigen::VectorXd& rAcc); void id(const Robot& robot, const Eigen::VectorXd& vel, const Eigen::VectorXd& acc, const WrenchArray& extf, Cache& rCache, Eigen::VectorXd& rForce); void id(const Robot& robot, const Eigen::VectorXd& acc, const WrenchArray& extf, Cache& rCache, Eigen::VectorXd& rForce); void calcBiasForce(const Robot& robot, const WrenchArray& extf, Cache& rCache, Eigen::VectorXd& rForce); void calcInertia(const Robot& robot, Cache& rCache, Eigen::MatrixXd& rInertia); } #endif /* AB2D_ALGORITHM_H */
45.111111
114
0.678982
[ "model" ]
4776a553d6e37776f1707aa37f94633e7ae1ff42
4,226
h
C
src/nojs_validate_arguments.h
Flameeyes/nojs
b386fe707f651ffb2000d52560bc60bc3c0b2f1b
[ "BSD-3-Clause" ]
78
2016-05-29T09:17:00.000Z
2020-12-27T16:16:23.000Z
src/nojs_validate_arguments.h
Flameeyes/nojs
b386fe707f651ffb2000d52560bc60bc3c0b2f1b
[ "BSD-3-Clause" ]
4
2016-06-02T00:47:34.000Z
2016-06-21T15:25:09.000Z
src/nojs_validate_arguments.h
Flameeyes/nojs
b386fe707f651ffb2000d52560bc60bc3c0b2f1b
[ "BSD-3-Clause" ]
3
2016-06-16T08:17:16.000Z
2020-03-31T19:33:17.000Z
#ifndef NOJS_VALIDATE_ARGUMENTS_H #define NOJS_VALIDATE_ARGUMENTS_H #include "nojs_thread_context_inl.h" #include "v8.h" #include <string> namespace NoJS { namespace Validation { #define CreateError(isolate, Type, msg) \ v8::MaybeLocal<v8::Value>( \ Type(v8::String::NewFromUtf8( \ isolate, \ msg.c_str(), \ v8::NewStringType::kInternalized \ ).ToLocalChecked()) \ ) template <typename Head, typename Tail> class And { public: inline static v8::MaybeLocal<v8::Value> Check( ThreadContext* tc, const v8::FunctionCallbackInfo<v8::Value>& val ) { v8::MaybeLocal<v8::Value> err = Head::Check(tc, val); if (err.IsEmpty()) { return Tail::Check(tc, val); } return err; }; }; template <typename Head, typename Tail> class Or { public: inline static v8::MaybeLocal<v8::Value> Check( ThreadContext* tc, const v8::FunctionCallbackInfo<v8::Value>& val ) { v8::MaybeLocal<v8::Value> err = Head::Check(tc, val); if (err.IsEmpty()) { return err; } return Tail::Check(tc, val); }; }; template<int N> class Length { public: inline static v8::MaybeLocal<v8::Value> Check( ThreadContext* tc, const v8::FunctionCallbackInfo<v8::Value>& args ) { if (args.Length() >= N) { return v8::MaybeLocal<v8::Value>(); } std::string msg( std::string("Invalidate number of arguments. Got ") + std::to_string(args.Length()) + std::string(", expected ") + std::to_string(N) ); return CreateError(tc->GetIsolate(), v8::Exception::RangeError, msg); } }; namespace Is { #define FORWARD_TO_VALUE(V) \ V(Undefined) \ V(Null) \ V(True) \ V(False) \ V(Name) \ V(String) \ V(Symbol) \ V(Function) \ V(Array) \ V(Object) \ V(Boolean) \ V(Number) \ V(External) \ V(Int32) \ V(Uint32) \ V(Date) \ V(ArgumentsObject) \ V(BooleanObject) \ V(NumberObject) \ V(StringObject) \ V(SymbolObject) \ V(NativeError) \ V(RegExp) \ V(GeneratorFunction) \ V(GeneratorObject) \ V(Promise) \ V(Map) \ V(Set) \ V(WeakMap) \ V(WeakSet) \ V(ArrayBuffer) \ V(ArrayBufferView) \ V(TypedArray) \ V(Uint8Array) #define V(XS) \ inline static bool XS(const v8::Local<v8::Value>& val) { \ return val->Is ## XS(); \ } FORWARD_TO_VALUE(V) #undef V } template<int Pos, typename Validator> class Slot { public: inline static v8::MaybeLocal<v8::Value> Check( ThreadContext* tc, const v8::FunctionCallbackInfo<v8::Value>& args ) { return Validator::Check(tc, args[Pos], Pos); } }; template<bool (*Member)(const v8::Local<v8::Value>&), typename Name> class Type { public: inline static v8::MaybeLocal<v8::Value> Check( ThreadContext* tc, const v8::Local<v8::Value>& arg, const int Pos = 0 ) { bool check = Member(arg); if (check) { return v8::MaybeLocal<v8::Value>(); } std::string msg( std::string("Expected argument #") + std::to_string(Pos) + std::string(" to be of type ") + std::string(Name::Value) ); return CreateError(tc->GetIsolate(), v8::Exception::TypeError, msg); } }; #define V(XS) \ class _Name_ ## XS { \ public: \ static const char* Value; \ }; \ typedef Type<Is:: XS, _Name_ ## XS> Is ## XS; FORWARD_TO_VALUE(V) #undef V } } #endif
25.612121
75
0.485802
[ "object" ]
477818e7bc2397e614fc1af0a9c7f67665598296
72,254
c
C
admin/pchealth/sr/kernel/setinformation.c
npocmaka/Windows-Server-2003
5c6fe3db626b63a384230a1aa6b92ac416b0765f
[ "Unlicense" ]
17
2020-11-13T13:42:52.000Z
2021-09-16T09:13:13.000Z
admin/pchealth/sr/kernel/setinformation.c
sancho1952007/Windows-Server-2003
5c6fe3db626b63a384230a1aa6b92ac416b0765f
[ "Unlicense" ]
2
2020-10-19T08:02:06.000Z
2020-10-19T08:23:18.000Z
admin/pchealth/sr/kernel/setinformation.c
sancho1952007/Windows-Server-2003
5c6fe3db626b63a384230a1aa6b92ac416b0765f
[ "Unlicense" ]
14
2020-11-14T09:43:20.000Z
2021-08-28T08:59:57.000Z
/*++ Copyright (c) 1998-1999 Microsoft Corporation Module Name: setInformation.c Abstract: this is the major function code dispatch filter layer. Author: Neal Christiansen (nealch) 5-Feb-2001 Revision History: --*/ #include "precomp.h" // // Local prototypes // NTSTATUS SrpSetRenameInfo( IN PSR_DEVICE_EXTENSION pExtension, IN PIRP pIrp ); NTSTATUS SrpSetLinkInfo( IN PSR_DEVICE_EXTENSION pExtension, IN PIRP pIrp ); NTSTATUS SrpReplacingDestinationFile ( IN PSR_DEVICE_EXTENSION pExtension, IN PFILE_OBJECT pDestFileObject, IN PSR_STREAM_CONTEXT pDestFileContext ); VOID SrpSetRenamingState( IN PSR_DEVICE_EXTENSION pExtension, IN PSR_STREAM_CONTEXT pFileContext ); BOOLEAN SrpCheckForSameFile ( IN PFILE_OBJECT pFileObject1, IN PFILE_OBJECT pFileObject2 ); // // Linker commands // #ifdef ALLOC_PRAGMA #pragma alloc_text( PAGE, SrSetInformation ) #pragma alloc_text( PAGE, SrpSetRenameInfo ) #pragma alloc_text( PAGE, SrpSetLinkInfo ) #pragma alloc_text( PAGE, SrpReplacingDestinationFile ) #pragma alloc_text( PAGE, SrpSetRenamingState ) #pragma alloc_text( PAGE, SrpCheckForSameFile ) #endif // ALLOC_PRAGMA /***************************************************************************++ Routine Description: Handle SetInformation IRPS Arguments: Return Value: NTSTATUS - Status code. --***************************************************************************/ NTSTATUS SrSetInformation( IN PDEVICE_OBJECT DeviceObject, IN PIRP pIrp ) { PSR_DEVICE_EXTENSION pExtension; PIO_STACK_LOCATION pIrpSp; NTSTATUS eventStatus; FILE_INFORMATION_CLASS FileInformationClass; PUNICODE_STRING pRenameNewDirectoryName = NULL; PSR_STREAM_CONTEXT pOrigFileContext = NULL; // // < dispatch! // PAGED_CODE(); ASSERT(IS_VALID_DEVICE_OBJECT(DeviceObject)); ASSERT(IS_VALID_IRP(pIrp)); // // Is this a function for our device (vs an attachee). // if (DeviceObject == _globals.pControlDevice) { return SrMajorFunction(DeviceObject, pIrp); } // // else it is a device we've attached to, grab our extension // ASSERT(IS_SR_DEVICE_OBJECT(DeviceObject)); pExtension = DeviceObject->DeviceExtension; // // See if logging is enabled and we don't care about this type of IO // to the file systems' control device objects. // if (!SR_LOGGING_ENABLED(pExtension) || SR_IS_FS_CONTROL_DEVICE(pExtension)) { goto SrSetInformation_Skip; } // // Just pass through all paging IO. We catch all write's prior to // the cache manager even seeing them. // pIrpSp = IoGetCurrentIrpStackLocation(pIrp); if (FlagOn(pIrp->Flags, IRP_PAGING_IO)) { goto SrSetInformation_Skip; } // // Ignore files with no name // if (FILE_OBJECT_IS_NOT_POTENTIALLY_INTERESTING( pIrpSp->FileObject ) || FILE_OBJECT_DOES_NOT_HAVE_VPB( pIrpSp->FileObject )) { goto SrSetInformation_Skip; } // // Handle the necessary event based on the FileInformationClass. // Note that the FileLinkInformation and FileRenameInformation (when // renaming a directory in some cases) require synchronization // with a completion routine so that we can see the final status. // FileInformationClass = pIrpSp->Parameters.SetFile.FileInformationClass; switch (FileInformationClass) { case FileEndOfFileInformation: // SetEndOfFile case FileAllocationInformation: { PSR_STREAM_CONTEXT pFileContext; // // Get the context now so we can determine if this is a // directory or not // eventStatus = SrGetContext( pExtension, pIrpSp->FileObject, SrEventStreamChange, &pFileContext ); if (!NT_SUCCESS( eventStatus )) { goto SrSetInformation_Skip; } // // If this is a directory don't bother logging because the // operation will fail. // if (FlagOn(pFileContext->Flags,CTXFL_IsInteresting) && !FlagOn(pFileContext->Flags,CTXFL_IsDirectory)) { SrHandleEvent( pExtension, SrEventStreamChange, pIrpSp->FileObject, pFileContext, NULL, NULL ); } // // Release the context // SrReleaseContext( pFileContext ); break; } case FileDispositionInformation: // DeleteFile - handled in MJ_CLEANUP case FilePositionInformation: // SetFilePosition // // we can skip these // break; case FileBasicInformation: // SetFileAttributes { PFILE_BASIC_INFORMATION pBasicInformation; // // ignore time changes. for sure we need to ignore changes // to LastAccessTime updates. // // for now we only care about attrib changes (like adding hidden) // pBasicInformation = pIrp->AssociatedIrp.SystemBuffer; if ((pBasicInformation != NULL) && (pIrpSp->Parameters.SetFile.Length >= sizeof(FILE_BASIC_INFORMATION)) && (pBasicInformation->FileAttributes != 0)) { // // Handle this event // SrHandleEvent( pExtension, SrEventAttribChange, pIrpSp->FileObject, NULL, NULL, NULL ); } break; } case FileRenameInformation: // Rename { PFILE_RENAME_INFORMATION pRenameInfo; // // Handle this event, SrHandleRename will check for eligibility // pRenameInfo = (PFILE_RENAME_INFORMATION)pIrp->AssociatedIrp.SystemBuffer; if ((pRenameInfo == NULL) || (pIrpSp->Parameters.SetFile.Length < sizeof(FILE_RENAME_INFORMATION)) || (pIrpSp->Parameters.SetFile.Length < (FIELD_OFFSET(FILE_RENAME_INFORMATION, FileName) + pRenameInfo->FileNameLength)) ) { // // We don't have valid rename information, so just skip this // operation. // goto SrSetInformation_Skip; } return SrpSetRenameInfo( pExtension, pIrp ); } case FileLinkInformation: //Create HardLink { PFILE_LINK_INFORMATION pLinkInfo; // // Handle this event, SrHandleRename will check for eligibility // pLinkInfo = (PFILE_LINK_INFORMATION)pIrp->AssociatedIrp.SystemBuffer; if ((pLinkInfo == NULL) || (pIrpSp->Parameters.SetFile.Length < sizeof(FILE_LINK_INFORMATION)) || (pIrpSp->Parameters.SetFile.Length < FIELD_OFFSET(FILE_LINK_INFORMATION, FileName) + pLinkInfo->FileNameLength) ) { // // We don't have valid Link information, so just skip this // operation. // goto SrSetInformation_Skip; } return SrpSetLinkInfo( pExtension, pIrp ); } default: // // Handle all other setInformation calls // SrHandleEvent( pExtension, SrEventAttribChange, pIrpSp->FileObject, NULL, NULL, NULL ); break; } SrSetInformation_Skip: // // We don't need to wait for this operation to complete, so just // skip our stack location and pass this IO on to the next driver. // IoSkipCurrentIrpStackLocation( pIrp ); return IoCallDriver( pExtension->pTargetDevice, pIrp ); } /***************************************************************************++ Routine Description: This handles renames and is called from SrSetInformation. This bypasses the normal path of SrHandleEvent as work needs to be done even if the file is not interesting. It's possible that the new name is an interesting name, which needs to be logged as a new create. Plus it might be clobbering an interesting file, in which case we need to backup that interesting file. Arguments: pExtension - SR extension for this volume pIrp - the Irp for this operation Return Value: NTSTATUS - Completion status. --***************************************************************************/ NTSTATUS SrpSetRenameInfo( IN PSR_DEVICE_EXTENSION pExtension, IN PIRP pIrp ) { NTSTATUS eventStatus = STATUS_SUCCESS; NTSTATUS IrpStatus; PFILE_OBJECT pFileObject; PFILE_RENAME_INFORMATION pRenameInfo; PIO_STACK_LOCATION pIrpSp; PUNICODE_STRING pNewName = NULL; USHORT NewNameStreamLength = 0; UNICODE_STRING NameToOpen; PUNICODE_STRING pDestFileName = NULL; PSR_STREAM_CONTEXT pFileContext = NULL; PSR_STREAM_CONTEXT pNewFileContext = NULL; HANDLE newFileHandle = NULL; PFILE_OBJECT pNewFileObject = NULL; ULONG CreateOptions; OBJECT_ATTRIBUTES ObjectAttributes; IO_STATUS_BLOCK IoStatusBlock; BOOLEAN NewNameInteresting = FALSE; BOOLEAN newNameIsDirectory; BOOLEAN releaseLock = FALSE; BOOLEAN setRenamingStateInFileContext = FALSE; BOOLEAN doPostProcessing = FALSE; BOOLEAN renamingSelf = FALSE; KEVENT eventToWaitOn; PUNICODE_STRING pShortName = NULL; UNICODE_STRING shortName; WCHAR shortNameBuffer[SR_SHORT_NAME_CHARS+1]; BOOLEAN optimizeDelete = FALSE; BOOLEAN streamRename = FALSE; BOOLEAN fileBackedUp = FALSE; BOOLEAN exceedMaxPath = FALSE; // // The following macro must be at the end of local declarations // since it declares a variable only in DBG builds. // DECLARE_EXPECT_ERROR_FLAG(expectError); PAGED_CODE(); ASSERT(IS_VALID_SR_DEVICE_EXTENSION(pExtension)); ASSERT( IS_VALID_IRP( pIrp ) ); pIrpSp = IoGetCurrentIrpStackLocation( pIrp ); pFileObject = pIrpSp->FileObject; pRenameInfo = pIrp->AssociatedIrp.SystemBuffer; ASSERT(IS_VALID_FILE_OBJECT(pFileObject)); // // Initalize return values // try { // // does the caller have DELETE access (it's required). // if (pFileObject->DeleteAccess == 0) leave; // // should we short circuit out of here for testing mode? // if (global->DontBackup) leave; // // Get the context for the current file // eventStatus = SrGetContext( pExtension, pFileObject, SrEventFileRename, &pFileContext ); if (!NT_SUCCESS( eventStatus )) leave; // // If this is not a directory then see if the extension is // interesting. // if (!FlagOn(pFileContext->Flags,CTXFL_IsDirectory)) { UNICODE_STRING destName; destName.Buffer = pRenameInfo->FileName; destName.Length = (USHORT)pRenameInfo->FileNameLength; destName.MaximumLength = (USHORT)pRenameInfo->FileNameLength; // // First check to see if this is a stream name change. If so, // we determine the "interesting-ness" of the new name from // the "interesting-ness" of the current name. // if ((destName.Length > 0) && (destName.Buffer[0] == L':')) { // // This is a stream rename, so the "interesting-ness" of the // new name is the same as the "interesting-ness" of the old // name, since "interesting-ness" is determined by the file // name with out the stream component. // NewNameInteresting = BooleanFlagOn( pFileContext->Flags, CTXFL_IsInteresting ); streamRename = TRUE; } else { // // This is not a stream name change, so see if this new name // has an interesting extension. // eventStatus = SrIsExtInteresting( &destName, &NewNameInteresting ); if (!NT_SUCCESS( eventStatus )) leave; } } else { // // all directories are interesting unless explicitly excluded. // NewNameInteresting = TRUE; } // // If both are not interesting, ignore it. we make this check // twice in this routine. Once here to weed out any non-interesting // events, and another after checking path exclusions, because some // that was potentially interesting could have just become non // interesting. This let's us get out quicker for non interesting // renames. // if (!FlagOn(pFileContext->Flags,CTXFL_IsInteresting) && !NewNameInteresting) { // // Neither the file we are renaming or the new name are // interesting. But we still need to cleanup the context // because it may be renamed to something interesting in // the future. // SrpSetRenamingState( pExtension, pFileContext ); setRenamingStateInFileContext = TRUE; leave; } // // check the path exclusions // // // Get the full path for the target. Note that we will translate // reasonable errors to status success and return. This way we // will not log the event because we know the real operation should // fail. // { BOOLEAN reasonableErrorInDestPath = FALSE; eventStatus = SrpExpandDestPath( pExtension, pRenameInfo->RootDirectory, pRenameInfo->FileNameLength, pRenameInfo->FileName, pFileContext, pFileObject, &pNewName, &NewNameStreamLength, &reasonableErrorInDestPath ); if (!NT_SUCCESS_NO_DBGBREAK( eventStatus )) { if (reasonableErrorInDestPath) { SET_EXPECT_ERROR_FLAG( expectError ); eventStatus = STATUS_SUCCESS; } leave; } } ASSERT(pNewName != NULL); // // We now have the full destination name (whew!) // // // Check to see if the target for the rename is longer than // SR_MAX_FILENAME_LENGTH. If it is, we will treat the target name as // uninteresting. // if (!IS_FILENAME_VALID_LENGTH( pExtension, pNewName, NewNameStreamLength )) { NewNameInteresting = FALSE; exceedMaxPath = TRUE; if (!FlagOn(pFileContext->Flags,CTXFL_IsInteresting) && !NewNameInteresting) { // // Neither the file we are renaming or the new name are // interesting. But we still need to cleanup the context // because it may be renamed to something interesting in // the future. // SrpSetRenamingState( pExtension, pFileContext ); setRenamingStateInFileContext = TRUE; leave; } } // // We only need to do the following sets of checks if this is not // a stream rename. // if (!streamRename && !exceedMaxPath) { // // See if we are still on the same volume // if (!RtlPrefixUnicodeString( pExtension->pNtVolumeName, pNewName, TRUE )) { // // We are not on the same volume. This is possible if they used // some sort of symbolic link that was not understood. For the // most part these can be ignored, this is not a win32 client. // CODEWORK:paulmcd: we could expand the sym links ourselves // ASSERT(!"SR: Figure out how rename switched volumes unexpectedly!"); SrTrace( NOTIFY, ("sr!SrHandleRename: ignoring rename to %wZ, used symlink\n", pNewName )); SET_EXPECT_ERROR_FLAG( expectError ); leave; } // // Now see if the new path is interesting. // eventStatus = SrIsPathInteresting( pNewName, pExtension->pNtVolumeName, BooleanFlagOn(pFileContext->Flags,CTXFL_IsDirectory), &NewNameInteresting ); if (!NT_SUCCESS( eventStatus )) leave; // // if both are not interesting, ignore it // if (!FlagOn(pFileContext->Flags,CTXFL_IsInteresting) && !NewNameInteresting) { // // Neither the file we are renaming or the new name are // interesting. But we still need to cleanup the context // because it may be renamed to something interesting in // the future. // SrpSetRenamingState( pExtension, pFileContext ); setRenamingStateInFileContext = TRUE; leave; } } ///////////////////////////////////////////////////////////////////// // // See if destination file exists // ///////////////////////////////////////////////////////////////////// // // Always open the destination file to see if it is there, even if // it is not interesting. We do this because we need a resonable // guess if the operation is going to fail or succeed so we don't // log the wrong information. // // If we've got a stream open, we need to play some tricks to get the // stream component exposed in the file name. // if (streamRename) { NameToOpen.Length = pNewName->Length + NewNameStreamLength; } else { NameToOpen.Length = pNewName->Length; } NameToOpen.MaximumLength = pNewName->MaximumLength; NameToOpen.Buffer = pNewName->Buffer; InitializeObjectAttributes( &ObjectAttributes, &NameToOpen, (OBJ_KERNEL_HANDLE | // don't let usermode trash myhandle OBJ_FORCE_ACCESS_CHECK), // force ACL checking NULL, NULL ); // // start out assuming the dest file is a directory if the source // file is one then set the desired create options // newNameIsDirectory = BooleanFlagOn(pFileContext->Flags,CTXFL_IsDirectory); CreateOptions = (newNameIsDirectory ? FILE_DIRECTORY_FILE : 0); RetryOpenExisting: eventStatus = SrIoCreateFile( &newFileHandle, DELETE, &ObjectAttributes, &IoStatusBlock, NULL, // AllocationSize FILE_ATTRIBUTE_NORMAL, FILE_SHARE_READ| FILE_SHARE_WRITE| FILE_SHARE_DELETE, // ShareAccess FILE_OPEN, // OPEN_EXISTING FILE_SYNCHRONOUS_IO_NONALERT | CreateOptions, NULL, 0, // EaLength IO_IGNORE_SHARE_ACCESS_CHECK, pExtension->pTargetDevice ); if (eventStatus == STATUS_OBJECT_NAME_NOT_FOUND) { // // looks like there is no new file // eventStatus = STATUS_SUCCESS; } else if (eventStatus == STATUS_ACCESS_DENIED) { // // We don't have permission to open this file with the // permission necessary to replace the target file, so the // caller's request should also fail. We can stop our // processing now and exit, but we don't need to disable the // volume. // eventStatus = STATUS_SUCCESS; SET_EXPECT_ERROR_FLAG( expectError ); leave; } else if (eventStatus == STATUS_NOT_A_DIRECTORY) { // // are we renaming a directory to a file? this is ok, but we need // to open the target as a file, not a directory // if (CreateOptions == 0) { // // we already tried the reopen, it didn't work, bad. // ASSERT(!"SR: This is an unexpected error, figure out how we got it!"); leave; } CreateOptions = 0; newNameIsDirectory = FALSE; goto RetryOpenExisting; // // was there some other error ? // } else if (eventStatus == STATUS_SHARING_VIOLATION || !NT_SUCCESS( eventStatus )) { leave; } else { ASSERT(NT_SUCCESS(eventStatus)); // // SUCCESS! the dest file already exists.. are we allowed to // clobber it? // // // reference the file object // eventStatus = ObReferenceObjectByHandle( newFileHandle, 0, *IoFileObjectType, KernelMode, &pNewFileObject, NULL ); if (!NT_SUCCESS( eventStatus )) leave; // // See if we are renaming to our self. If so then don't log the // destination but do log the rename. // renamingSelf = SrpCheckForSameFile( pFileObject, pNewFileObject ); // // We know the destination exists, see if we are allowed to clobber // it. If not and we are not renaming to our self then the operation // will fail, don't bother handling it. // if (!pRenameInfo->ReplaceIfExists && !renamingSelf) { SET_EXPECT_ERROR_FLAG( expectError ); leave; } // // Note: Directories cannot be renamed over other directories, // the file system doesn't allow it (unless they are being renamed // over themselves). However, directories can // be renamed over other files. // // Quit if renaming a directory over a different directory because // we know that will fail. // if (FlagOn(pFileContext->Flags,CTXFL_IsDirectory) && (newNameIsDirectory)) { #if DBG if (!renamingSelf) { SET_EXPECT_ERROR_FLAG( expectError ); } #endif leave; } // // If the destination file is not our own file then handle // creating a deletion event. // if (!renamingSelf) { // // Get the context for the destination file. We do this now // so that we can mark that we are renaming this file. This // will cause anyone else who tries to access this file while // the rename in progress to create a temporary context. // We do this so there won't be any windows when someone // tries to access the wrong file and gets the wrong state. // NOTE: We do want to do this even for files which are NOT // interesting so the context is updated correctly. // eventStatus = SrGetContext( pExtension, pNewFileObject, SrEventFileDelete| SrEventNoOptimization| SrEventSimulatedDelete, &pNewFileContext ); if (!NT_SUCCESS( eventStatus )) leave; // // If we are renaming to a directory just leave because this // will fail. Release the context. // if (FlagOn(pNewFileContext->Flags,CTXFL_IsDirectory)) { ASSERT(!FlagOn(pFileContext->Flags,CTXFL_IsDirectory)); newNameIsDirectory = TRUE; SrReleaseContext( pNewFileContext ); pNewFileContext = NULL; //so we don't free it later leave; } // // The destination file exists and is interesting, log that we // are delting it. // if (NewNameInteresting) { // // Log that we are changing the destination file // eventStatus = SrpReplacingDestinationFile( pExtension, pNewFileObject, pNewFileContext ); if (!NT_SUCCESS( eventStatus )) leave; fileBackedUp = TRUE; // // These names can be different because one could be a // short name and one could be a long name for the same // file. // // ASSERT((NULL == pNewFileContext) || // RtlEqualUnicodeString(pNewName, // &pNewFileContext->FileName, // TRUE)); } } } // // Whether the file existed or not, handle purging our logging state // if (NewNameInteresting) { // // clear the backup history for this new file // if (newNameIsDirectory) { // // we need to clear all entries that prefix match this // dest directory, so that they now have new histories as // they are potentially new files. // HashProcessEntries( pExtension->pBackupHistory, SrResetHistory, pNewName ); } else { // // its a simple file, clear the single entry // eventStatus = SrResetBackupHistory( pExtension, pNewName, NewNameStreamLength, SrEventInvalid ); if (!NT_SUCCESS( eventStatus )) leave; } } // // When we get here we think the operation will succeed. Mark // the contexts so we won't try to use them while we are in // the middle of the rename // SrpSetRenamingState( pExtension, pFileContext ); setRenamingStateInFileContext = TRUE; // // At this point we think the rename will succeed and we care // about it. // // If this is a stream rename, see if we have already backed // up the file. If not, we need to do that backup now. // // We don't just log renames of stream renames because Win32 doesn't // support renaming streams. Therefore, it is difficult for Restore // do undo this rename. Since stream rename occur infrequently, we // just do a full backup here. This also means that we don't need // to do any work after the rename operation has completed. // if (streamRename && !fileBackedUp) { eventStatus = SrpReplacingDestinationFile( pExtension, pFileObject, pFileContext ); leave; } // // Get the sort name of the source file so we can // log it. // RtlInitEmptyUnicodeString( &shortName, shortNameBuffer, sizeof(shortNameBuffer) ); eventStatus = SrGetShortFileName( pExtension, pFileObject, &shortName ); if (STATUS_OBJECT_NAME_NOT_FOUND == eventStatus) { // // This file doesn't have a short name, so just leave // pShortName equal to NULL. // eventStatus = STATUS_SUCCESS; } else if (!NT_SUCCESS(eventStatus)) { // // We hit an unexpected error, so leave. // leave; } else { pShortName = &shortName; } // // See if this a file or directory moving OUT of monitored space. // If so we need to do some work before the file is moved. // if (FlagOn(pFileContext->Flags,CTXFL_IsInteresting) && !NewNameInteresting) { if (FlagOn(pFileContext->Flags,CTXFL_IsDirectory)) { // // This is a directory, create delete events for all // interesting files in the tree before it goes away because // of the rename. // eventStatus = SrHandleDirectoryRename( pExtension, &pFileContext->FileName, TRUE ); if (!NT_SUCCESS( eventStatus )) leave; } else { UNICODE_STRING volRestoreLoc; UNICODE_STRING destName; // // It's a file moving out of monitored space, back it up // before the rename. // // Make sure we aren't renaming it into our special store, we // want to ignore those operations. Get the store name. // RtlInitUnicodeString( &volRestoreLoc, GENERAL_RESTORE_LOCATION); // // Get the destination name with the volume name stripped off // the front (Since we know we are on the same volume). // ASSERT(pNewName->Length >= pExtension->pNtVolumeName->Length); destName.Buffer = &pNewName->Buffer[ pExtension->pNtVolumeName->Length / sizeof(WCHAR) ]; destName.Length = pNewName->Length - pExtension->pNtVolumeName->Length; destName.MaximumLength = destName.Length; if (RtlPrefixUnicodeString( &volRestoreLoc, &destName, TRUE )) { // // it is going to our store. skip it // leave; } eventStatus = SrHandleFileRenameOutOfMonitoredSpace( pExtension, pFileObject, pFileContext, &optimizeDelete, &pDestFileName ); if (!NT_SUCCESS( eventStatus )) { leave; } #if DBG if (optimizeDelete) { ASSERT( pDestFileName == NULL ); } else { ASSERT( pDestFileName != NULL ); } #endif } } // // Mark that we want to do post-operation processing // doPostProcessing = TRUE; } finally { // // If the destination file is open, close it now (so we can do the rename) // if (pNewFileObject != NULL) { ObDereferenceObject(pNewFileObject); NULLPTR(pNewFileObject); } if (newFileHandle != NULL) { ZwClose(newFileHandle); NULLPTR(newFileHandle); } } ///////////////////////////////////////////////////////////////////// // // Send the operation to the file system // ///////////////////////////////////////////////////////////////////// // // Setup to wait for the operation to complete // KeInitializeEvent( &eventToWaitOn, NotificationEvent, FALSE ); IoCopyCurrentIrpStackLocationToNext( pIrp ); IoSetCompletionRoutine( pIrp, SrStopProcessingCompletion, &eventToWaitOn, TRUE, TRUE, TRUE ); IrpStatus = IoCallDriver(pExtension->pTargetDevice, pIrp); if (STATUS_PENDING == IrpStatus) { NTSTATUS localStatus; localStatus = KeWaitForSingleObject( &eventToWaitOn, Executive, KernelMode, FALSE, NULL ); ASSERT(STATUS_SUCCESS == localStatus); } // // The operation has completed, get the final status from the Irp. // IrpStatus = pIrp->IoStatus.Status; // // We are done with the Irp, so complete it now. // IoCompleteRequest(pIrp, IO_NO_INCREMENT); try { // // In DBG builds, this will verify that the operation failed with the // file system when we expected it to. Otherwise, it will assert so // we can debug why we missed this case. // CHECK_FOR_EXPECTED_ERROR( expectError, IrpStatus ); // // leave if: // - the rename failed // - we got an error eariler in setting up for the rename // - they tolds us to not continue processing // if (!NT_SUCCESS_NO_DBGBREAK( IrpStatus ) || !NT_SUCCESS_NO_DBGBREAK( eventStatus ) || !doPostProcessing) { leave; } ASSERT(pFileContext != NULL); ///////////////////////////////////////////////////////////////////// // // LOG EVENTS FOR ORIGINAL FILE // ///////////////////////////////////////////////////////////////////// // // We are now going to log the rename, grab the activity lock // SrAcquireActivityLockShared( pExtension ); releaseLock = TRUE; // // Now that we have the shared activity lock, check that the volume // hasn't been disable before we do unnecessary work. // if (!SR_LOGGING_ENABLED(pExtension)) leave; // // is this the first interesting event on this volume? // eventStatus = SrCheckVolume( pExtension, FALSE ); if (!NT_SUCCESS( eventStatus )) leave; // // Log the correct state // if (FlagOn(pFileContext->Flags,CTXFL_IsInteresting) && NewNameInteresting) { // // Both files are interesting, log the rename // #if DBG if (pShortName != NULL ) { ASSERT(shortName.Length > 0 && shortName.Length <= (12*sizeof(WCHAR))); } #endif SrLogEvent( pExtension, ((FlagOn(pFileContext->Flags,CTXFL_IsDirectory)) ? SrEventDirectoryRename : SrEventFileRename), pFileObject, &pFileContext->FileName, pFileContext->StreamNameLength, NULL, pNewName, NewNameStreamLength, pShortName ); } else if (FlagOn(pFileContext->Flags,CTXFL_IsDirectory)) { if (!FlagOn(pFileContext->Flags,CTXFL_IsInteresting) && NewNameInteresting) { // // The rename on the directory succeeded and the directory was // renamed INTO monitored space. We need to log creates for all // the children of this directory. // eventStatus = SrHandleDirectoryRename( pExtension, pNewName, FALSE ); if (!NT_SUCCESS( eventStatus )) leave; } // // We logged all of the directory operations before it occured // for the case of moving a directory OUT of monitored space // } else if (FlagOn(pFileContext->Flags,CTXFL_IsInteresting) && !NewNameInteresting) { ASSERT(!FlagOn(pFileContext->Flags,CTXFL_IsDirectory)); // // Since the "interesting-ness" of a file is determined at the // file level, a stream rename should never get down this path. // ASSERT( pFileContext->StreamNameLength == 0); // // Log this as a delete (we backed up the file before the // rename occured). // if (optimizeDelete) { // // This file was either created during this restore point or // has already been backed up, therefore, we want to log the // a delete that has been optimized out. // eventStatus = SrLogEvent( pExtension, SrEventFileDelete, NULL, &pFileContext->FileName, 0, NULL, NULL, 0, NULL ); } else { eventStatus = SrLogEvent( pExtension, SrEventFileDelete, pFileObject, &pFileContext->FileName, 0, pDestFileName, NULL, 0, &shortName ); } if (!NT_SUCCESS( eventStatus )) leave; } else if (!FlagOn(pFileContext->Flags,CTXFL_IsInteresting) && NewNameInteresting) { ASSERT(!FlagOn(pFileContext->Flags,CTXFL_IsDirectory)); // // Since the "interesting-ness" of a file is determined at the // file level, a stream rename should never get down this path. // ASSERT( NewNameStreamLength == 0); // // it's a file being brought into monitored space, log it // eventStatus = SrLogEvent( pExtension, SrEventFileCreate, NULL, // pFileObject pNewName, 0, NULL, NULL, 0, NULL ); if (!NT_SUCCESS( eventStatus )) leave; // // ignore later mods // eventStatus = SrMarkFileBackedUp( pExtension, pNewName, 0, SrEventFileCreate, SR_IGNORABLE_EVENT_TYPES ); if (!NT_SUCCESS( eventStatus )) leave; } } finally { // // Check for any bad errors if this operation succeeded; // If the pFileContext is NULL, this error was encountered in // SrGetContext which already generated the volume error. // if (NT_SUCCESS_NO_DBGBREAK( IrpStatus ) && CHECK_FOR_VOLUME_ERROR(eventStatus) && (pFileContext != NULL)) { // // trigger the failure notification to the service // SrNotifyVolumeError( pExtension, &pFileContext->FileName, eventStatus, FlagOn(pFileContext->Flags,CTXFL_IsDirectory) ? SrEventDirectoryRename: SrEventFileRename ); } if (releaseLock) { SrReleaseActivityLock( pExtension ); } if (NULL != pNewName) { SrFreeFileNameBuffer(pNewName); NULLPTR(pNewName); } if (NULL != pDestFileName) { SrFreeFileNameBuffer(pDestFileName); NULLPTR(pDestFileName); } // // Cleanup contexts from rename state // if (pFileContext != NULL) { if (setRenamingStateInFileContext) { if (FlagOn(pFileContext->Flags,CTXFL_IsDirectory)) { ASSERT(pExtension->ContextCtrl.AllContextsTemporary > 0); InterlockedDecrement( &pExtension->ContextCtrl.AllContextsTemporary ); ASSERT(!FlagOn(pFileContext->Flags,CTXFL_DoNotUse)); } else { ASSERT(FlagOn(pFileContext->Flags,CTXFL_DoNotUse)); } SrDeleteContext( pExtension, pFileContext ); } else { ASSERT(!FlagOn(pFileContext->Flags,CTXFL_DoNotUse)); } SrReleaseContext( pFileContext ); NULLPTR(pFileContext); } if (pNewFileContext != NULL) { ASSERT(!FlagOn(pNewFileContext->Flags,CTXFL_IsDirectory)); SrReleaseContext( pNewFileContext ); NULLPTR(pNewFileContext); } } return IrpStatus; } /***************************************************************************++ Routine Description: This handles the creation of hardlinks and is called from SrSetInformation. This bypasses the normal path of SrHandleEvent to handle the following cases: - If an interesting file is going to be overwritten as the result of this hardlink being created, we must backup the original file. - If a hardlink with an interesting name is being created, we need to log this file creation. Arguments: pExtension - the SR device extension for this volume. pIrp - the Irp representing this SetLinkInformation operation. Return Value: NTSTATUS - Completion status. --***************************************************************************/ NTSTATUS SrpSetLinkInfo( IN PSR_DEVICE_EXTENSION pExtension, IN PIRP pIrp ) { NTSTATUS EventStatus = STATUS_SUCCESS; NTSTATUS IrpStatus; PFILE_OBJECT pFileObject; PFILE_LINK_INFORMATION pLinkInfo; PIO_STACK_LOCATION pIrpSp; PUNICODE_STRING pLinkName = NULL; USHORT LinkNameStreamLength = 0; PSR_STREAM_CONTEXT pFileContext = NULL; PSR_STREAM_CONTEXT pLinkFileContext = NULL; HANDLE LinkFileHandle = NULL; PFILE_OBJECT pLinkFileObject = NULL; OBJECT_ATTRIBUTES ObjectAttributes; IO_STATUS_BLOCK IoStatusBlock; BOOLEAN LinkNameInteresting = FALSE; BOOLEAN ReleaseLock = FALSE; BOOLEAN DoPostProcessing = FALSE; KEVENT EventToWaitOn; // // The following macro must be at the end of local declarations // since it declares a variable only in DBG builds. // DECLARE_EXPECT_ERROR_FLAG( ExpectError ); PAGED_CODE(); ASSERT(IS_VALID_SR_DEVICE_EXTENSION(pExtension)); ASSERT( IS_VALID_IRP( pIrp ) ); pIrpSp = IoGetCurrentIrpStackLocation( pIrp ); pFileObject = pIrpSp->FileObject; pLinkInfo = pIrp->AssociatedIrp.SystemBuffer; ASSERT(IS_VALID_FILE_OBJECT(pFileObject)); try { // // should we short circuit out of here for testing mode? // if (global->DontBackup) leave; // // Get the context for the current file // EventStatus = SrGetContext( pExtension, pFileObject, SrEventFileCreate, &pFileContext ); if (!NT_SUCCESS( EventStatus )) leave; // // If this is a directory, then we don't care about this operation // since it is not possible to create hardlinks on directories. // if (FlagOn( pFileContext->Flags, CTXFL_IsDirectory )) leave; // // We are creating a hardlink on this file. While we do the processing // mark this context as CTXFL_DoNotUse so that other users of this // stream will be guaranteed to get correct information. // RtlInterlockedSetBitsDiscardReturn(&pFileContext->Flags,CTXFL_DoNotUse); ///////////////////////////////////////////////////////////////////// // // Check to see if the hardlink name is interesting // ///////////////////////////////////////////////////////////////////// { UNICODE_STRING destName; destName.Buffer = pLinkInfo->FileName; destName.Length = (USHORT)pLinkInfo->FileNameLength; destName.MaximumLength = (USHORT)pLinkInfo->FileNameLength; EventStatus = SrIsExtInteresting( &destName, &LinkNameInteresting ); if (!NT_SUCCESS( EventStatus )) { leave; } } // // Get the full path for the hardlink name. Note that we will // translate reasonable errors to status success and return. This way // we will not log the event because we know the real operation should // fail. // { BOOLEAN reasonableErrorInDestPath = FALSE; EventStatus = SrpExpandDestPath( pExtension, pLinkInfo->RootDirectory, pLinkInfo->FileNameLength, pLinkInfo->FileName, pFileContext, pFileObject, &pLinkName, &LinkNameStreamLength, &reasonableErrorInDestPath ); if (!NT_SUCCESS_NO_DBGBREAK( EventStatus )) { if (reasonableErrorInDestPath) { SET_EXPECT_ERROR_FLAG( ExpectError ); EventStatus = STATUS_SUCCESS; } leave; } // // We can't have a stream component in this name, so if we do have // one, this is also a malformed link name. // if (LinkNameStreamLength > 0) { SET_EXPECT_ERROR_FLAG( ExpectError ); EventStatus = STATUS_SUCCESS; leave; } } ASSERT(pLinkName != NULL); // // We now have the full destination name (whew!) // See if we are still on the same volume // if (!RtlPrefixUnicodeString( pExtension->pNtVolumeName, pLinkName, TRUE )) { // // Hardlinks must be on the same volume so this operation will // fail. // SET_EXPECT_ERROR_FLAG( ExpectError ); leave; } // // Make sure that the link name is not too long for us to monitor. // if (!IS_FILENAME_VALID_LENGTH( pExtension, pLinkName, 0 )) { // // Link name is too long for us, so just leave now. // LinkNameInteresting = FALSE; leave; } // // Now see if the new path is interesting. // EventStatus = SrIsPathInteresting( pLinkName, pExtension->pNtVolumeName, FALSE, &LinkNameInteresting ); if (!NT_SUCCESS( EventStatus )) { leave; } if (!LinkNameInteresting) { // // The link name is not interesting so just cut out now. // leave; } ///////////////////////////////////////////////////////////////////// // // See if hardlink file exists // ///////////////////////////////////////////////////////////////////// // // If the hardlink name exists, we may need to back it up before this // operation gets down to the file system. // InitializeObjectAttributes( &ObjectAttributes, pLinkName, (OBJ_KERNEL_HANDLE | OBJ_FORCE_ACCESS_CHECK), // force ACL checking NULL, NULL ); EventStatus = SrIoCreateFile( &LinkFileHandle, SYNCHRONIZE, &ObjectAttributes, &IoStatusBlock, NULL, // AllocationSize FILE_ATTRIBUTE_NORMAL, FILE_SHARE_READ| FILE_SHARE_WRITE| FILE_SHARE_DELETE, // ShareAccess FILE_OPEN, // OPEN_EXISTING FILE_SYNCHRONOUS_IO_NONALERT | FILE_NON_DIRECTORY_FILE, NULL, 0, // EaLength IO_IGNORE_SHARE_ACCESS_CHECK, pExtension->pTargetDevice ); if (EventStatus == STATUS_OBJECT_NAME_NOT_FOUND) { // // looks like there is no new file // EventStatus = STATUS_SUCCESS; } else if (EventStatus == STATUS_ACCESS_DENIED) { // // We don't have permission to open this file with the // permission necessary to replace the target file, so the // caller's request should also fail. We can stop our // processing now and exit, but we don't need to disable the // volume. // SET_EXPECT_ERROR_FLAG( ExpectError ); EventStatus = STATUS_SUCCESS; leave; } else if (EventStatus == STATUS_FILE_IS_A_DIRECTORY) { // // Does the hardlink name currently name a directory? This is not // allowed, so just ignore the operation since it will fail. // SET_EXPECT_ERROR_FLAG( ExpectError ); EventStatus = STATUS_SUCCESS; leave; } else if (!NT_SUCCESS( EventStatus )) { // // We hit an unexpected error and we will handle this error // below. // leave; } else { BOOLEAN linkingToSelf; ASSERT(NT_SUCCESS(EventStatus)); // // SUCCESS! the dest file already exists.. are we allowed to // clobber it? // if (!pLinkInfo->ReplaceIfExists) leave; // // We are allowed to overwrite the existing file, so now check // to make sure that we aren't just recreating a hardlink that // already exists. // EventStatus = ObReferenceObjectByHandle( LinkFileHandle, 0, *IoFileObjectType, KernelMode, &pLinkFileObject, NULL ); if (!NT_SUCCESS( EventStatus )) leave; linkingToSelf = SrpCheckForSameFile( pFileObject, pLinkFileObject ); // // We only need to backup the hardlink file if we are not // recreating a link to ourself. // if (!linkingToSelf) { // // Get the context for the destination file. // EventStatus = SrGetContext( pExtension, pLinkFileObject, SrEventFileDelete| SrEventNoOptimization| SrEventSimulatedDelete, &pLinkFileContext ); if (!NT_SUCCESS( EventStatus )) leave; ASSERT(!FlagOn(pLinkFileContext->Flags,CTXFL_IsDirectory)); ASSERT(FlagOn(pLinkFileContext->Flags,CTXFL_IsInteresting)); // // Log that we are changing the destination file // EventStatus = SrpReplacingDestinationFile( pExtension, pLinkFileObject, pLinkFileContext ); if (!NT_SUCCESS( EventStatus )) leave; } else { // // We are just recreating an existing link to ourself. There // is no need to log this. // leave; } } // // We have successfully gotten to this point, so we want to do // post-operation processing to log the link creation. // DoPostProcessing = TRUE; } finally { // // If the destination file is open, close it now (so we can do the rename) // if (NULL != pLinkFileObject) { ObDereferenceObject(pLinkFileObject); NULLPTR(pLinkFileObject); } if (NULL != LinkFileHandle) { ZwClose(LinkFileHandle); NULLPTR(LinkFileHandle); } if (NULL != pLinkFileContext) { SrReleaseContext( pLinkFileContext ); NULLPTR(pLinkFileContext); } } ///////////////////////////////////////////////////////////////////// // // Send the operation to the file system // ///////////////////////////////////////////////////////////////////// // // Setup to wait for the operation to complete. // KeInitializeEvent( &EventToWaitOn, NotificationEvent, FALSE ); IoCopyCurrentIrpStackLocationToNext( pIrp ); IoSetCompletionRoutine( pIrp, SrStopProcessingCompletion, &EventToWaitOn, TRUE, TRUE, TRUE ); IrpStatus = IoCallDriver(pExtension->pTargetDevice, pIrp); if (STATUS_PENDING == IrpStatus) { NTSTATUS localStatus; localStatus = KeWaitForSingleObject( &EventToWaitOn, Executive, KernelMode, FALSE, NULL ); ASSERT(STATUS_SUCCESS == localStatus); } // // The operation has completed, get the final status from the Irp. // IrpStatus = pIrp->IoStatus.Status; // // We are done with the Irp, so complete it now. // IoCompleteRequest(pIrp, IO_NO_INCREMENT); try { // // In DBG builds, this will verify that the operation failed with the // file system when we expected it to. Otherwise, it will assert so // we can debug why we missed this case. // CHECK_FOR_EXPECTED_ERROR( ExpectError, IrpStatus ); // // leave if: // - the link failed // - we got an error eariler in setting up for the link // - they tolds us to not continue processing // if (!NT_SUCCESS_NO_DBGBREAK( IrpStatus ) || !NT_SUCCESS_NO_DBGBREAK( EventStatus ) || !DoPostProcessing) { leave; } ASSERT(pLinkName != NULL); ///////////////////////////////////////////////////////////////////// // // Log the file creation for the hardlink file. // ///////////////////////////////////////////////////////////////////// // // Before we do the logging work, we need to grab the activity lock // SrAcquireActivityLockShared( pExtension ); ReleaseLock = TRUE; // // Now that we have the shared activity lock, check that the volume // hasn't been disable before we do unnecessary work. // if (!SR_LOGGING_ENABLED(pExtension)) leave; // // Is this the first interesting event on this volume? // EventStatus = SrCheckVolume( pExtension, FALSE ); if (!NT_SUCCESS( EventStatus )) leave; // // Log the file creation // EventStatus = SrLogEvent( pExtension, SrEventFileCreate, NULL, // pFileObject pLinkName, 0, NULL, NULL, 0, NULL ); if (!NT_SUCCESS( EventStatus )) leave; // // ignore later modifications // EventStatus = SrMarkFileBackedUp( pExtension, pLinkName, 0, SrEventFileCreate, SR_IGNORABLE_EVENT_TYPES ); } finally { // // Check for any bad errors if this operation was successful. // if (NT_SUCCESS_NO_DBGBREAK( IrpStatus ) && CHECK_FOR_VOLUME_ERROR( EventStatus )) { // // trigger the failure notification to the service // SrNotifyVolumeError( pExtension, pLinkName, EventStatus, SrEventFileCreate ); } if (ReleaseLock) { SrReleaseActivityLock( pExtension ); } if (NULL != pLinkName) { SrFreeFileNameBuffer(pLinkName); NULLPTR(pLinkName); } if (NULL != pFileContext) { if (FlagOn(pFileContext->Flags,CTXFL_DoNotUse)) { // // We marked this context as DoNotUse, so we need to delete it from // the lists now that we are done with it. // SrDeleteContext( pExtension, pFileContext ); } SrReleaseContext( pFileContext ); NULLPTR(pFileContext); } } return IrpStatus; } /***************************************************************************++ Routine Description: The destination file exists, log that it is being replaced. Arguments: Return Value: NTSTATUS - Completion status. --***************************************************************************/ NTSTATUS SrpReplacingDestinationFile ( IN PSR_DEVICE_EXTENSION pExtension, IN PFILE_OBJECT pDestFileObject, IN PSR_STREAM_CONTEXT pDestFileContext ) { NTSTATUS status; try { // // We are now going to log the destination file getting clobbered, // grab the volume's activity lock now. // SrAcquireActivityLockShared( pExtension ); // // Now that we have the shared activity lock, check that the volume // hasn't been disable before we do unnecessary work. // if (!SR_LOGGING_ENABLED(pExtension)) { status = SR_STATUS_VOLUME_DISABLED; leave; } // // setup volume if we need to // status = SrCheckVolume( pExtension, FALSE ); if (!NT_SUCCESS( status )) leave; // // now simulate a delete on the destination file // ASSERT(!FlagOn(pDestFileContext->Flags,CTXFL_IsDirectory)); status = SrHandleEvent( pExtension, SrEventFileDelete| SrEventNoOptimization| SrEventSimulatedDelete, pDestFileObject, pDestFileContext, NULL, NULL ); if (!NT_SUCCESS( status )) leave; } finally { // // Release the activity lock // SrReleaseActivityLock( pExtension ); } return status; } /***************************************************************************++ Routine Description: Set correct state if we are renaming. This would be: - If renaming a directory mark that ALL contexts become temporary. We do this because we don't track all the names for all of the contexts Arguments: Return Value: NTSTATUS - Status code. --***************************************************************************/ VOID SrpSetRenamingState ( IN PSR_DEVICE_EXTENSION pExtension, IN PSR_STREAM_CONTEXT pFileContext ) { // // Neither the file we are renaming or the new name are // interesting. But we still need to cleanup the context // because it may be renamed to something interesting in // the future. // if (FlagOn(pFileContext->Flags,CTXFL_IsDirectory)) { // // Since we don't save names for contexts that are not // interesting, on directory renames we mark the device // extension so that all contexts will become temporary // and then we flush all existing contexts. We clear this // state during the post-setInformation to guarentee there // is no window when we will get the wrong state. // InterlockedIncrement( &pExtension->ContextCtrl.AllContextsTemporary ); SrDeleteAllContexts( pExtension ); } else { // // Mark that this context should not be used (because we are // renaming it). We will delete this context in the post- // rename handling. // RtlInterlockedSetBitsDiscardReturn(&pFileContext->Flags,CTXFL_DoNotUse); } } /***************************************************************************++ Routine Description: This will determine if the two files represent the same stream of a file by comparing the FsContext of the file objects. Arguments: pExtension - SR's device extension for this volume. pFileObject1 - The first file in the comparison pFileObject2 - The second file in the comparison retAreSame - Is set to TRUE if the two files are the same, FALSE otherwise. Return Value: NTSTATUS - Completion status. --***************************************************************************/ BOOLEAN SrpCheckForSameFile ( IN PFILE_OBJECT pFileObject1, IN PFILE_OBJECT pFileObject2 ) { if (pFileObject1->FsContext == pFileObject2->FsContext) { return TRUE; } else { return FALSE; } }
32.561514
105
0.446577
[ "object" ]
4791141ebc55662e60ba6876df0b14e2c133a010
18,086
c
C
libvips-8.11/libvips/foreign/heifsave.c
MFerrol/Create_Web
76c8590ffffc6834a13f8efaf5ca7a5829cb1c32
[ "MIT" ]
null
null
null
libvips-8.11/libvips/foreign/heifsave.c
MFerrol/Create_Web
76c8590ffffc6834a13f8efaf5ca7a5829cb1c32
[ "MIT" ]
null
null
null
libvips-8.11/libvips/foreign/heifsave.c
MFerrol/Create_Web
76c8590ffffc6834a13f8efaf5ca7a5829cb1c32
[ "MIT" ]
null
null
null
/* save to heif * * 5/7/18 * - from niftisave.c * 3/7/19 [lovell] * - add "compression" option * 1/9/19 [meyermarcel] * - save alpha when necessary * 15/3/20 * - revise for new VipsTarget API * 14/2/21 kleisauke * - move GObject part to vips2heif.c */ /* This file is part of VIPS. VIPS 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; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ /* These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk */ /* #define DEBUG_VERBOSE #define DEBUG */ #ifdef HAVE_CONFIG_H #include <config.h> #endif /*HAVE_CONFIG_H*/ #include <vips/intl.h> #ifdef HAVE_HEIF_ENCODER #include <stdio.h> #include <stdlib.h> #include <string.h> #include <vips/vips.h> #include <vips/internal.h> #include "pforeign.h" #include <libheif/heif.h> typedef struct _VipsForeignSaveHeif { VipsForeignSave parent_object; /* Where to write (set by subclasses). */ VipsTarget *target; /* Coding quality factor (1-100). */ int Q; /* Lossless compression. */ gboolean lossless; /* Compression format */ VipsForeignHeifCompression compression; /* CPU effort (0-8). */ int speed; /* Chroma subsampling. */ VipsForeignSubsample subsample_mode; /* The image we save. This is a copy of save->ready since we need to * be able to update the metadata. */ VipsImage *image; int page_width; int page_height; int n_pages; struct heif_context *ctx; struct heif_encoder *encoder; /* The current page we are writing. */ struct heif_image_handle *handle; /* The current page in memory which we build as we scan down the * image. */ struct heif_image *img; /* The libheif memory area we fill with pixels from the libvips * pipe. */ uint8_t *data; int stride; } VipsForeignSaveHeif; typedef VipsForeignSaveClass VipsForeignSaveHeifClass; /* Defined in heif2vips.c */ void vips__heif_error( struct heif_error *error ); void vips__heif_image_print( struct heif_image *img ); G_DEFINE_ABSTRACT_TYPE( VipsForeignSaveHeif, vips_foreign_save_heif, VIPS_TYPE_FOREIGN_SAVE ); static void vips_foreign_save_heif_dispose( GObject *gobject ) { VipsForeignSaveHeif *heif = (VipsForeignSaveHeif *) gobject; VIPS_UNREF( heif->target ); VIPS_UNREF( heif->image ); VIPS_FREEF( heif_image_release, heif->img ); VIPS_FREEF( heif_image_handle_release, heif->handle ); VIPS_FREEF( heif_encoder_release, heif->encoder ); VIPS_FREEF( heif_context_free, heif->ctx ); G_OBJECT_CLASS( vips_foreign_save_heif_parent_class )-> dispose( gobject ); } typedef struct heif_error (*libheif_metadata_fn)( struct heif_context *, const struct heif_image_handle *, const void *, int ); struct _VipsForeignSaveHeifMetadata { const char *name; libheif_metadata_fn saver; } libheif_metadata[] = { { VIPS_META_EXIF_NAME, heif_context_add_exif_metadata }, { VIPS_META_XMP_NAME, heif_context_add_XMP_metadata } }; static int vips_foreign_save_heif_write_metadata( VipsForeignSaveHeif *heif ) { int i; struct heif_error error; /* Rebuild exif from tags, if we'll be saving it. */ if( vips_image_get_typeof( heif->image, VIPS_META_EXIF_NAME ) ) if( vips__exif_update( heif->image ) ) return( -1 ); for( i = 0; i < VIPS_NUMBER( libheif_metadata ); i++ ) if( vips_image_get_typeof( heif->image, libheif_metadata[i].name ) ) { const void *data; size_t length; #ifdef DEBUG printf( "attaching %s ..\n", libheif_metadata[i].name ); #endif /*DEBUG*/ if( vips_image_get_blob( heif->image, libheif_metadata[i].name, &data, &length ) ) return( -1 ); error = libheif_metadata[i].saver( heif->ctx, heif->handle, data, length ); if( error.code ) { vips__heif_error( &error ); return( -1 ); } } return( 0 ); } static int vips_foreign_save_heif_write_page( VipsForeignSaveHeif *heif, int page ) { VipsForeignSave *save = (VipsForeignSave *) heif; struct heif_error error; struct heif_encoding_options *options; #ifdef HAVE_HEIF_COLOR_PROFILE if( !save->strip && vips_image_get_typeof( heif->image, VIPS_META_ICC_NAME ) ) { const void *data; size_t length; #ifdef DEBUG printf( "attaching profile ..\n" ); #endif /*DEBUG*/ if( vips_image_get_blob( heif->image, VIPS_META_ICC_NAME, &data, &length ) ) return( -1 ); /* FIXME .. also see heif_image_set_nclx_color_profile() */ error = heif_image_set_raw_color_profile( heif->img, "rICC", data, length ); if( error.code ) { vips__heif_error( &error ); return( -1 ); } } #endif /*HAVE_HEIF_COLOR_PROFILE*/ options = heif_encoding_options_alloc(); if( vips_image_hasalpha( heif->image ) ) options->save_alpha_channel = 1; #ifdef DEBUG printf( "encoding ..\n" ); #endif /*DEBUG*/ error = heif_context_encode_image( heif->ctx, heif->img, heif->encoder, options, &heif->handle ); heif_encoding_options_free( options ); if( error.code ) { vips__heif_error( &error ); return( -1 ); } if( vips_image_get_typeof( heif->image, "heif-primary" ) ) { int primary; if( vips_image_get_int( heif->image, "heif-primary", &primary ) ) return( -1 ); if( page == primary ) { error = heif_context_set_primary_image( heif->ctx, heif->handle ); if( error.code ) { vips__heif_error( &error ); return( -1 ); } } } if( !save->strip && vips_foreign_save_heif_write_metadata( heif ) ) return( -1 ); VIPS_FREEF( heif_image_handle_release, heif->handle ); return( 0 ); } static int vips_foreign_save_heif_write_block( VipsRegion *region, VipsRect *area, void *a ) { VipsForeignSaveHeif *heif = (VipsForeignSaveHeif *) a; int y; #ifdef DEBUG printf( "vips_foreign_save_heif_write_block: y = %d\n", area->top ); #endif /*DEBUG*/ /* Copy a line at a time into our output image, write each time the * image fills. */ for( y = 0; y < area->height; y++ ) { /* Y in page. */ int page = (area->top + y) / heif->page_height; int line = (area->top + y) % heif->page_height; VipsPel *p = VIPS_REGION_ADDR( region, 0, area->top + y ); VipsPel *q = heif->data + line * heif->stride; memcpy( q, p, VIPS_IMAGE_SIZEOF_LINE( region->im ) ); /* Did we just write the final line? Write as a new page * into the output. */ if( line == heif->page_height - 1 ) if( vips_foreign_save_heif_write_page( heif, page ) ) return( -1 ); } return( 0 ); } struct heif_error vips_foreign_save_heif_write( struct heif_context *ctx, const void *data, size_t length, void *userdata ) { VipsForeignSaveHeif *heif = (VipsForeignSaveHeif *) userdata; struct heif_error error; error.code = 0; if( vips_target_write( heif->target, data, length ) ) error.code = -1; return( error ); } static int vips_foreign_save_heif_build( VipsObject *object ) { VipsForeignSave *save = (VipsForeignSave *) object; VipsForeignSaveHeif *heif = (VipsForeignSaveHeif *) object; const char *filename; struct heif_error error; struct heif_writer writer; char *chroma; if( VIPS_OBJECT_CLASS( vips_foreign_save_heif_parent_class )-> build( object ) ) return( -1 ); /* Make a copy of the image in case we modify the metadata eg. for * exif_update. */ if( vips_copy( save->ready, &heif->image, NULL ) ) return( -1 ); /* Compression defaults to VIPS_FOREIGN_HEIF_COMPRESSION_AV1 for .avif * suffix. */ filename = vips_connection_filename( VIPS_CONNECTION( heif->target ) ); if( !vips_object_argument_isset( object, "compression" ) && filename && vips_iscasepostfix( filename, ".avif" ) ) heif->compression = VIPS_FOREIGN_HEIF_COMPRESSION_AV1; error = heif_context_get_encoder_for_format( heif->ctx, (enum heif_compression_format) heif->compression, &heif->encoder ); if( error.code ) { if( error.code == heif_error_Unsupported_filetype ) vips_error( "heifsave", "%s", _( "Unsupported compression" ) ); else vips__heif_error( &error ); return( -1 ); } error = heif_encoder_set_lossy_quality( heif->encoder, heif->Q ); if( error.code ) { vips__heif_error( &error ); return( -1 ); } error = heif_encoder_set_lossless( heif->encoder, heif->lossless ); if( error.code ) { vips__heif_error( &error ); return( -1 ); } error = heif_encoder_set_parameter_integer( heif->encoder, "speed", heif->speed ); if( error.code && error.subcode != heif_suberror_Unsupported_parameter ) { vips__heif_error( &error ); return( -1 ); } chroma = heif->subsample_mode == VIPS_FOREIGN_SUBSAMPLE_OFF || ( heif->subsample_mode == VIPS_FOREIGN_SUBSAMPLE_AUTO && heif->Q >= 90 ) ? "444" : "420"; error = heif_encoder_set_parameter_string( heif->encoder, "chroma", chroma ); if( error.code && error.subcode != heif_suberror_Unsupported_parameter ) { vips__heif_error( &error ); return( -1 ); } /* TODO .. support extra per-encoder params with * heif_encoder_list_parameters(). */ heif->page_width = heif->image->Xsize; heif->page_height = vips_image_get_page_height( heif->image ); heif->n_pages = heif->image->Ysize / heif->page_height; /* Make a heif image the size of a page. We send sink_disc() output * here and write a frame each time it fills. */ #ifdef DEBUG printf( "vips_foreign_save_heif_build:\n" ); printf( "\twidth = %d\n", heif->page_width ); printf( "\theight = %d\n", heif->page_height ); printf( "\talpha = %d\n", vips_image_hasalpha( heif->image ) ); #endif /*DEBUG*/ error = heif_image_create( heif->page_width, heif->page_height, heif_colorspace_RGB, vips_image_hasalpha( heif->image ) ? heif_chroma_interleaved_RGBA : heif_chroma_interleaved_RGB, &heif->img ); if( error.code ) { vips__heif_error( &error ); return( -1 ); } error = heif_image_add_plane( heif->img, heif_channel_interleaved, heif->page_width, heif->page_height, vips_image_hasalpha( heif->image ) ? 32 : 24 ); if( error.code ) { vips__heif_error( &error ); return( -1 ); } #ifdef DEBUG vips__heif_image_print( heif->img ); #endif /*DEBUG*/ heif->data = heif_image_get_plane( heif->img, heif_channel_interleaved, &heif->stride ); /* Write data. */ if( vips_sink_disc( heif->image, vips_foreign_save_heif_write_block, heif ) ) return( -1 ); /* This has to come right at the end :-( so there's no support for * incremental writes. */ writer.writer_api_version = 1; writer.write = vips_foreign_save_heif_write; error = heif_context_write( heif->ctx, &writer, heif ); if( error.code ) { vips__heif_error( &error ); return( -1 ); } vips_target_finish( heif->target ); return( 0 ); } /* Save a bit of typing. */ #define UC VIPS_FORMAT_UCHAR static int vips_heif_bandfmt[10] = { /* UC C US S UI I F X D DX */ UC, UC, UC, UC, UC, UC, UC, UC, UC, UC }; static void vips_foreign_save_heif_class_init( VipsForeignSaveHeifClass *class ) { GObjectClass *gobject_class = G_OBJECT_CLASS( class ); VipsObjectClass *object_class = (VipsObjectClass *) class; VipsForeignClass *foreign_class = (VipsForeignClass *) class; VipsForeignSaveClass *save_class = (VipsForeignSaveClass *) class; gobject_class->dispose = vips_foreign_save_heif_dispose; gobject_class->set_property = vips_object_set_property; gobject_class->get_property = vips_object_get_property; object_class->nickname = "heifsave_base"; object_class->description = _( "save image in HEIF format" ); object_class->build = vips_foreign_save_heif_build; foreign_class->suffs = vips__heif_suffs; save_class->saveable = VIPS_SAVEABLE_RGBA_ONLY; save_class->format_table = vips_heif_bandfmt; VIPS_ARG_INT( class, "Q", 10, _( "Q" ), _( "Q factor" ), VIPS_ARGUMENT_OPTIONAL_INPUT, G_STRUCT_OFFSET( VipsForeignSaveHeif, Q ), 1, 100, 50 ); VIPS_ARG_BOOL( class, "lossless", 13, _( "Lossless" ), _( "Enable lossless compression" ), VIPS_ARGUMENT_OPTIONAL_INPUT, G_STRUCT_OFFSET( VipsForeignSaveHeif, lossless ), FALSE ); VIPS_ARG_ENUM( class, "compression", 14, _( "compression" ), _( "Compression format" ), VIPS_ARGUMENT_OPTIONAL_INPUT, G_STRUCT_OFFSET( VipsForeignSaveHeif, compression ), VIPS_TYPE_FOREIGN_HEIF_COMPRESSION, VIPS_FOREIGN_HEIF_COMPRESSION_HEVC ); VIPS_ARG_INT( class, "speed", 15, _( "speed" ), _( "CPU effort" ), VIPS_ARGUMENT_OPTIONAL_INPUT, G_STRUCT_OFFSET( VipsForeignSaveHeif, speed ), 0, 9, 5 ); VIPS_ARG_ENUM( class, "subsample_mode", 16, _( "Subsample mode" ), _( "Select chroma subsample operation mode" ), VIPS_ARGUMENT_OPTIONAL_INPUT, G_STRUCT_OFFSET( VipsForeignSaveHeif, subsample_mode ), VIPS_TYPE_FOREIGN_SUBSAMPLE, VIPS_FOREIGN_SUBSAMPLE_AUTO ); } static void vips_foreign_save_heif_init( VipsForeignSaveHeif *heif ) { heif->ctx = heif_context_alloc(); heif->Q = 50; heif->compression = VIPS_FOREIGN_HEIF_COMPRESSION_HEVC; heif->speed = 5; heif->subsample_mode = VIPS_FOREIGN_SUBSAMPLE_AUTO; } typedef struct _VipsForeignSaveHeifFile { VipsForeignSaveHeif parent_object; /* Filename for save. */ char *filename; } VipsForeignSaveHeifFile; typedef VipsForeignSaveHeifClass VipsForeignSaveHeifFileClass; G_DEFINE_TYPE( VipsForeignSaveHeifFile, vips_foreign_save_heif_file, vips_foreign_save_heif_get_type() ); static int vips_foreign_save_heif_file_build( VipsObject *object ) { VipsForeignSaveHeif *heif = (VipsForeignSaveHeif *) object; VipsForeignSaveHeifFile *file = (VipsForeignSaveHeifFile *) object; if( !(heif->target = vips_target_new_to_file( file->filename )) ) return( -1 ); if( VIPS_OBJECT_CLASS( vips_foreign_save_heif_file_parent_class )-> build( object ) ) return( -1 ); return( 0 ); } static void vips_foreign_save_heif_file_class_init( VipsForeignSaveHeifFileClass *class ) { GObjectClass *gobject_class = G_OBJECT_CLASS( class ); VipsObjectClass *object_class = (VipsObjectClass *) class; gobject_class->set_property = vips_object_set_property; gobject_class->get_property = vips_object_get_property; object_class->nickname = "heifsave"; object_class->build = vips_foreign_save_heif_file_build; VIPS_ARG_STRING( class, "filename", 1, _( "Filename" ), _( "Filename to save to" ), VIPS_ARGUMENT_REQUIRED_INPUT, G_STRUCT_OFFSET( VipsForeignSaveHeifFile, filename ), NULL ); } static void vips_foreign_save_heif_file_init( VipsForeignSaveHeifFile *file ) { } typedef struct _VipsForeignSaveHeifBuffer { VipsForeignSaveHeif parent_object; /* Save to a buffer. */ VipsArea *buf; } VipsForeignSaveHeifBuffer; typedef VipsForeignSaveHeifClass VipsForeignSaveHeifBufferClass; G_DEFINE_TYPE( VipsForeignSaveHeifBuffer, vips_foreign_save_heif_buffer, vips_foreign_save_heif_get_type() ); static int vips_foreign_save_heif_buffer_build( VipsObject *object ) { VipsForeignSaveHeif *heif = (VipsForeignSaveHeif *) object; VipsForeignSaveHeifBuffer *buffer = (VipsForeignSaveHeifBuffer *) object; VipsBlob *blob; if( !(heif->target = vips_target_new_to_memory()) ) return( -1 ); if( VIPS_OBJECT_CLASS( vips_foreign_save_heif_buffer_parent_class )-> build( object ) ) return( -1 ); g_object_get( heif->target, "blob", &blob, NULL ); g_object_set( buffer, "buffer", blob, NULL ); vips_area_unref( VIPS_AREA( blob ) ); return( 0 ); } static void vips_foreign_save_heif_buffer_class_init( VipsForeignSaveHeifBufferClass *class ) { GObjectClass *gobject_class = G_OBJECT_CLASS( class ); VipsObjectClass *object_class = (VipsObjectClass *) class; gobject_class->set_property = vips_object_set_property; gobject_class->get_property = vips_object_get_property; object_class->nickname = "heifsave_buffer"; object_class->build = vips_foreign_save_heif_buffer_build; VIPS_ARG_BOXED( class, "buffer", 1, _( "Buffer" ), _( "Buffer to save to" ), VIPS_ARGUMENT_REQUIRED_OUTPUT, G_STRUCT_OFFSET( VipsForeignSaveHeifBuffer, buf ), VIPS_TYPE_BLOB ); } static void vips_foreign_save_heif_buffer_init( VipsForeignSaveHeifBuffer *buffer ) { } typedef struct _VipsForeignSaveHeifTarget { VipsForeignSaveHeif parent_object; VipsTarget *target; } VipsForeignSaveHeifTarget; typedef VipsForeignSaveHeifClass VipsForeignSaveHeifTargetClass; G_DEFINE_TYPE( VipsForeignSaveHeifTarget, vips_foreign_save_heif_target, vips_foreign_save_heif_get_type() ); static int vips_foreign_save_heif_target_build( VipsObject *object ) { VipsForeignSaveHeif *heif = (VipsForeignSaveHeif *) object; VipsForeignSaveHeifTarget *target = (VipsForeignSaveHeifTarget *) object; if( target->target ) { heif->target = target->target; g_object_ref( heif->target ); } if( VIPS_OBJECT_CLASS( vips_foreign_save_heif_target_parent_class )-> build( object ) ) return( -1 ); return( 0 ); } static void vips_foreign_save_heif_target_class_init( VipsForeignSaveHeifTargetClass *class ) { GObjectClass *gobject_class = G_OBJECT_CLASS( class ); VipsObjectClass *object_class = (VipsObjectClass *) class; gobject_class->set_property = vips_object_set_property; gobject_class->get_property = vips_object_get_property; object_class->nickname = "heifsave_target"; object_class->build = vips_foreign_save_heif_target_build; VIPS_ARG_OBJECT( class, "target", 1, _( "Target" ), _( "Target to save to" ), VIPS_ARGUMENT_REQUIRED_INPUT, G_STRUCT_OFFSET( VipsForeignSaveHeifTarget, target ), VIPS_TYPE_TARGET ); } static void vips_foreign_save_heif_target_init( VipsForeignSaveHeifTarget *target ) { } #endif /*HAVE_HEIF_ENCODER*/ /* The C API wrappers are defined in foreign.c. */
25.015214
79
0.723377
[ "object" ]
47a1a60d73ff5269f8480d4ffad2c1cce9078935
1,566
h
C
shaders_inc/GLTF_PBR_VertexProcessing.fxh.h
saphiresouldier/DiligentFX
36a432225c60b1b9c2f6914c7741ded2f3c3feba
[ "Apache-2.0" ]
127
2019-02-20T03:48:02.000Z
2022-03-30T17:51:54.000Z
shaders_inc/GLTF_PBR_VertexProcessing.fxh.h
MikhailGorobets/DiligentFX
39a2c0f7a7a53694c93590ed21c581ae742d6997
[ "Apache-2.0" ]
7
2019-02-11T19:41:49.000Z
2022-03-31T23:53:21.000Z
shaders_inc/GLTF_PBR_VertexProcessing.fxh.h
MikhailGorobets/DiligentFX
39a2c0f7a7a53694c93590ed21c581ae742d6997
[ "Apache-2.0" ]
38
2019-07-23T16:26:18.000Z
2022-03-15T14:53:24.000Z
"#ifndef _GLTF_PBR_VERTEX_PROCESSING_FXH_\n" "#define _GLTF_PBR_VERTEX_PROCESSING_FXH_\n" "\n" "#include \"GLTF_PBR_Structures.fxh\"\n" "\n" "struct GLTF_TransformedVertex\n" "{\n" " float3 WorldPos;\n" " float3 Normal;\n" "};\n" "\n" "\n" "float3x3 InverseTranspose3x3(float3x3 M)\n" "{\n" " // Note that in HLSL, M_t[0] is the first row, while in GLSL, it is the \n" " // first column. Luckily, determinant and inverse matrix can be equally \n" " // defined through both rows and columns.\n" " float det = dot(cross(M[0], M[1]), M[2]);\n" " float3x3 adjugate = float3x3(cross(M[1], M[2]),\n" " cross(M[2], M[0]),\n" " cross(M[0], M[1]));\n" " return adjugate / det;\n" "}\n" "\n" "GLTF_TransformedVertex GLTF_TransformVertex(in float3 Pos,\n" " in float3 Normal,\n" " in float4x4 Transform)\n" "{\n" " GLTF_TransformedVertex TransformedVert;\n" " \n" " float4 locPos = mul(Transform, float4(Pos, 1.0));\n" " float3x3 NormalTransform = float3x3(Transform[0].xyz, Transform[1].xyz, Transform[2].xyz);\n" " NormalTransform = InverseTranspose3x3(NormalTransform);\n" " Normal = mul(NormalTransform, Normal);\n" " float NormalLen = length(Normal);\n" " TransformedVert.Normal = Normal / max(NormalLen, 1e-5);\n" "\n" " TransformedVert.WorldPos = locPos.xyz / locPos.w;\n" "\n" " return TransformedVert;\n" "}\n" "\n" "#endif // _GLTF_PBR_VERTEX_PROCESSING_FXH_\n"
35.590909
98
0.598978
[ "transform" ]