Search NASA⌕ Search

SEARCH · Search NASA

Results for “C++, templates, classes”

Search indexed NASA NTRS and DOE OSTI research on propulsion, heat transfer, battery materials and energy systems. Follow report and document links to the original sources.

Quote a phrase for an exact phrase match. Source license links do not imply unrestricted reuse.

At least 19 records

The Design of a Templated C++ Small Vector Class for Numerical Computing

We describe the design and implementation of a templated C++ class for vectors. The vector class is templated both for vector length and vector component type; the vector length is fixed at template instantiation time. The vector implementation is such that for a vector of N components of type T, the total number of bytes required by the vector is equal to N * size of (T), where size of is the built-in C operator. The property of having a size no bigger than that required by the components themselves is key in many numerical computing applications, where one may allocate very large arrays of small, fixed-length vectors. In addition to the design trade-offs motivating our fixed-length vector design choice, we review some of the C++ template features essential to an efficient, succinct implementation. In particular, we highlight some of the standard C++ features, such as partial template specialization, that are not supported by all compilers currently. This report provides an inventory listing the relevant support currently provided by some key compilers, as well as test code one can use to verify compiler capabilities.

Moran, Patrick J.↗

CLIPS++: Embedding CLIPS into C++

This paper describes a set of C++ extensions to the CLIPS language and their embodiment in CLIPS++. These extensions and the implementation approach of CLIPS++ provide a new level of embeddability with C and C++. These extensions are a C++ include statement and a defcontainer construct; (include (c++-header-file.h)) and (defcontainer (c++-type)). The include construct allows C++ functions to be embedded in both the LHS and RHS of CLIPS rules. The header file in an include construct is the same header file the programmer uses for his/her own C++ code, independent of CLIPS. The defcontainer construct allows the inference engine to treat C++ class instances as CLIPS deftemplate facts. Consequently existing C++ class libraries may be transparently imported into CLIPS. These C++ types may use advanced features like inheritance, virtual functions, and templates. The implementation has been tested with several class libraries, including Rogue Wave Software's Tools.h++, GNU's libg++, and USL's C++ Standard Components. The execution speed of CLIPS++ has been determined to be 5 to 700 times the execution speed of CLIPS 6.0 (10 to 20X typical).

Obermeyer, Lance↗

ROSE Castor

ROSE Castor is a tool enabling automated verification of C++, built off of the ROSE compiler framework and the Why3 framework. Castor defines a verification language for providing specifications of C++ code, letting users perform automated functional formal verification of their C++ code. Castor is designed to target C++17, and supports a subset of the language, including classes, functions, templates, integers and booleans, pointers and references, and single inheritance. Castor currently does not support multiple or virtual inheritance, virtual functions, floating-point, threading, lambda functions, or the C++ STL, though some of these are planned in future updates. Castor ships with an in-house parser for parsing verification conditions.

Lane, PhillipA [Lawrence Livermore National Labora↗

An object-oriented approach to nested data parallelism

This paper describes an implementation technique for integrating nested data parallelism into an object-oriented language. Data-parallel programming employs sets of data called 'collections' and expresses parallelism as operations performed over the elements of a collection. When the elements of a collection are also collections, then there is the possibility for 'nested data parallelism.' Few current programming languages support nested data parallelism however. In an object-oriented framework, a collection is a single object. Its type defines the parallel operations that may be applied to it. Our goal is to design and build an object-oriented data-parallel programming environment supporting nested data parallelism. Our initial approach is built upon three fundamental additions to C++. We add new parallel base types by implementing them as classes, and add a new parallel collection type called a 'vector' that is implemented as a template. Only one new language feature is introduced: the 'foreach' construct, which is the basis for exploiting elementwise parallelism over collections. The strength of the method lies in the compilation strategy, which translates nested data-parallel C++ into ordinary C++. Extracting the potential parallelism in nested 'foreach' constructs is called 'flattening' nested parallelism. We show how to flatten 'foreach' constructs using a simple program transformation. Our prototype system produces vector code which has been successfully run on workstations, a CM-2, and a CM-5.

Sheffler, Thomas J.↗

A portable MPI-based parallel vector template library

This paper discusses the design and implementation of a polymorphic collection library for distributed address-space parallel computers. The library provides a data-parallel programming model for C++ by providing three main components: a single generic collection class, generic algorithms over collections, and generic algebraic combining functions. Collection elements are the fourth component of a program written using the library and may be either of the built-in types of C or of user-defined types. Many ideas are borrowed from the Standard Template Library (STL) of C++, although a restricted programming model is proposed because of the distributed address-space memory model assumed. Whereas the STL provides standard collections and implementations of algorithms for uniprocessors, this paper advocates standardizing interfaces that may be customized for different parallel computers. Just as the STL attempts to increase programmer productivity through code reuse, a similar standard for parallel computers could provide programmers with a standard set of algorithms portable across many different architectures. The efficacy of this approach is verified by examining performance data collected from an initial implementation of the library running on an IBM SP-2 and an Intel Paragon.

Sheffler, Thomas J.↗

A Portable MPI-Based Parallel Vector Template Library

This paper discusses the design and implementation of a polymorphic collection library for distributed address-space parallel computers. The library provides a data-parallel programming model for C + + by providing three main components: a single generic collection class, generic algorithms over collections, and generic algebraic combining functions. Collection elements are the fourth component of a program written using the library and may be either of the built-in types of c or of user-defined types. Many ideas are borrowed from the Standard Template Library (STL) of C++, although a restricted programming model is proposed because of the distributed address-space memory model assumed. Whereas the STL provides standard collections and implementations of algorithms for uniprocessors, this paper advocates standardizing interfaces that may be customized for different parallel computers. Just as the STL attempts to increase programmer productivity through code reuse, a similar standard for parallel computers could provide programmers with a standard set of algorithms portable across many different architectures. The efficacy of this approach is verified by examining performance data collected from an initial implementation of the library running on an IBM SP-2 and an Intel Paragon.

Sheffler, Thomas J.↗

A new template for developing C++ applications in NASA's Core Flight System

In this presentation, we will demonstrate an example Core Flight System (cFS) application written in C++, compatible with the Draco releases of the Core Flight Executive (cFE) and NASA Operating System Abstraction Layer (OSAL). The application boilerplate, supporting library, and associated generation script were recently developed and licensed under the permissive Apache License 2.0 with the goal of easing the cFS app development with C++. The design and features of this application will be presented, including a higher-level interface for interactions with the cFE software bus pipes, tables, and event services. Data structures are provided for centralized telecommand and telemetry parsing which isolates bookkeeping of message components from the calling code in an application's core logic. Specific advantages of writing a cFS application in C++ will be shown, including easier avoidance of symbol collisions via namespaces, expanded compile-time checks via constant expressions, default initialization for data structures, null safety via references, improved syntax for operating on multi-dimensional arrays, and reliable serialization of enumerations via enumeration classes. Special considerations needed for integrating a C++ application will be identified, including function linkage, exceptions, and stack unwinding. Evidence for the usefulness of this template will be discussed in the context of development of a flight software application used for interfacing with a solid-state data recorder.

Dominick Allen↗

Discovery of an Interlocked and Interwoven Molecular Topology in Nanocarbons via Dynamic C–C Bond Formation

Topologically complex carbon nanostructures are an exciting but largely unexplored class of materials due to their challenging synthesis. Previous methods are low yielding because they rely on irreversible C sp 2 −C sp 2 bond formation, which necessitates complex templating strategies to enforce entanglement. Here, reversible zirconocene coupling of alkynes is developed as a new method to access complex molecular topologies, where dynamic C−C bond formation facilitates entanglement under thermodynamic control, allowing the use of simple precursors without the need for preassembly. This strategy enables the scalable, high-yield synthesis of three topologically distinct nanocarbons, including the serendipitous discovery of a structure containing a new topological motif that was not previously identified or realized synthetically. This motif, consisting of an unusual combination of interlocking and interweaving, was recognized to be generalizable to a new topological class of molecules, introduced here as perplexanes.

37 INORGANIC, ORGANIC, PHYSICAL, AND ANALYTICAL CH↗

CRISPR-GRIT: Guide RNAs with Integrated Repair Templates Enable Precise Multiplexed Genome Editing in the Diploid Fungal Pathogen Candida albicans

Candida albicans, an opportunistic fungal pathogen, causes severe infections in immunocompromised individuals. Limited classes and overuse of current antifungals have led to the rapid emergence of antifungal resistance. Thus, there is an urgent need to understand fungal pathogen genetics to develop new antifungal strategies. Genetic manipulation of C. albicans is encumbered by its diploid chromosomes requiring editing both alleles to elucidate gene function. Although the recent development of CRISPR-Cas systems has facilitated genome editing in C. albicans, large-scale and multiplexed functional genomic studies are still hindered by the necessity of cotransforming repair templates for homozygous knockouts. Here, we present CRISPR-GRIT (Guide RNAs with Integrated Repair Templates), a repair template-integrated guide RNA design for expedited gene knockouts and multiplexed gene editing in C. albicans. Here, we envision that this method can be used for high-throughput library screens and identification of synthetic lethal pairs in both C. albicans and other diploid organisms with strong homologous recombination machinery.

60 APPLIED LIFE SCIENCES↗

Interfacing with Legacy using Remote Method Invocation

The assignment described was enough to make a neophyte Java developer bolt for the door: provide a remote method for use by an applet which invokes a native method that wraps a function in an existing legacy library. The purpose of the remote method is to return an instance of a class object whose contents reflect the data structure returned by the legacy function. While embroiled in implementation, I would have spent the time wading through their JNI use group archive as well, but I couldn't seem to locate one. Subsequently, I made the decision to try to document my findings in order to assist others. Before we start on the class design, let's look at what the existing legacy code does. The C function to be called, Get-Legacy-Data, consists of two steps: an ASII file is read from the local disk and its contents are parsed into a Legacy_Type structure whose address is passed as an argument by the caller. The legacy code was compiled into a shared object library, legacy. so, using the IRIX 6.2 compiler and then loaded onto the Web server, a Silicon Graphics Indy station loaded with the IRIX 6.4 operating system. As far as the class design is concerned, the first thing required is a class to act as a template for the data structure returned by the legacy function. This class, JLegacy, declares a series of public instance variables which correspond to the members of Legacy_Type and provides a parameterless constructor. This constructor is never called, not even by the native method which allocates the object for return to the remote method. Next, the remote interface declaration for the remote object must be defined. In order for JLegacyRO to implement getJLegacy, JLegacyRO must interface with the existing legacy code through a native method, getn. getn is declared in the JLegacyRO class but implemented in C, just like the legacy code. getn returns a JLegacy instance and is declared static since its implementation is the same for all instances of the JLegacyRO class.

Howard, Scott M.↗

Field Encapsulation Library The FEL 2.2 User Guide

This document describes version 2.2 of the Field Encapsulation Library (FEL), a library of mesh and field classes. FEL is a library for programmers - it is a "building block" enabling the rapid development of applications by a user. Since FEL is a library intended for code development, it is essential that enough technical detail be provided so that one can make full use of the code. Providing such detail requires some assumptions with respect to the reader's familiarity with the library implementation language, C++, particularly C++ with templates. We have done our best to make the explanations accessible to those who may not be completely C++ literate. Nevertheless, familiarity with the language will certainly help one's understanding of how and why things work the way they do. One consolation is that the level of understanding essential for using the library is significantly less than the level that one should have in order to modify or extend the library. One more remark on C++ templates: Templates have been a source of both joy and frustration for us. The frustration stems from the lack of mature or complete implementations that one has to work with. Template problems rear their ugly head particularly when porting. When porting C code, successfully compiling to a set of object files typically means that one is almost done. With templated C++ and the current state of the compilers and linkers, generating the object files is often only the beginning of the fun. On the other hand, templates are quite powerful. Used judiciously, templates enable more succinct designs and more efficient code. Templates also help with code maintenance. Designers can avoid creating objects that are the same in many respects, but not exactly the same. For example, FEL fields are templated by node type, thus the code for scalar fields and vector fields is shared. Furthermore, node type templating allows the library user to instantiate fields with data types not provided by the FEL authors. This type of flexibility would be difficult to offer without the support of the language. For users who may be having template-related problems, we offer the consolation that support for C++ templates is destined to improve with time. Efforts such as the Standard Template Library (STL) will inevitably drive vendors to provide more thorough, optimized tools for template code development. Furthermore, the benefits will become harder to resist for those who currently subscribe to the least-common-denominator "code it all in C" strategy. May FEL bring you both increased productivity and aesthetic satisfaction.

Moran, Patrick J.↗

A Tool for Automatic Data Distribution for CFD Applications on Structured Grids

Development of HPF versions of NPB and ARC3D has shown that HPF provides an efficient, concise way to express parallelism and to organize data traffic. The use of HPF, as noted in the papers, requires an intimate knowledge of the applications and a detailed analysis of data affinity, data movement, and data granularity. To simplify and accelerate the task of developing HPF versions of existing CFD applications we have designed and implemented ADAPT (Automatic Data Alignment and Placement Tool). ADAPT analyzes a CFD application working on a single structured grid and generates HPF TEMPLATE, (RE)DISTRIBUTION, ALIGNMENT, and INDEPENDENT directives. The directives can be generated on the nest level, subroutine level, application level, or on the application interface level. ADAPT annotates an existing CFD FORTRAN application, performing computations on single or multiple grids. On each grid the application is considered as a sequence of operators, each applied to a set of variables defined in a particular grid domain. ADAPT automatically detects implicit operators (i.e., having data dependences) and explicit operators (without data dependences). For parallelization of an explicit operator ADAPT creates a template for the operator domain, aligns arrays used in the operator with the template, distributes the template, and declares the loops over the distributed dimensions as INDEPENDENT. For parallelization of an implicit operator, the distribution of the operator's domain should be consistent with the operator's dependences. Any dependence between sections distributed on different processors would preclude parallelization if the compiler does not have an ability to pipeline computations. If a data distribution is "orthogonal" to the dependences of an implicit operator, then the loop which implements the operator can be declared as INDEPENDENT. ADAPT starts with an analysis of array index expressions of the loop nests. For each pair of arrays referenced in an assignment statement, it generates an arc in the alignment graph and annotates it with an affinity relation. The template, alignment, and distribution directives for a particular loop nest are then derived from a transitive closure of the affinity relation. A compromise of data distributions in different nests and subroutines is achieved by merging annotated alignment graphs for adjacent nests/stibroutine calls in the nest/call graph of the application in the process called distribution lifting. ADAPT has been implemented as a C++ program running in conjunction with a parallelization tool called CAPTools. ADAPT uses the parse tree, interprocedural analysis and application database generated by CAPTools. It also uses the Directed Graph class, initially implemented in p2d2 (parallel debugger oi distributed programs), and some other classes supporting symbolic computations. ADAPT uses data distribution techniques described. ADAPT was tested with ARC3D and the FT benchmark and has demonstrated a code performance within a factor of 1.5 of handwritten versions.

Frumkin, Michael↗

Antibody-directed evolution reveals a mechanism for enhanced neutralization at the HIV-1 fusion peptide site

The HIV-1 fusion peptide (FP) represents a promising vaccine target, but global FP sequence diversity among circulating strains has limited anti-FP antibodies to ~60% neutralization breadth. Here we evolve the FP-targeting antibody VRC34.01 in vitro to enhance FP-neutralization using site saturation mutagenesis and yeast display. Successive rounds of directed evolution by iterative selection of antibodies for binding to resistant HIV-1 strains establish a variant, VRC34.01_mm28, as a best-in-class antibody with 10-fold enhanced potency compared to the template antibody and ~80% breadth on a cross-clade 208-strain neutralization panel. Structural analyses demonstrate that the improved paratope expands the FP binding groove to accommodate diverse FP sequences of different lengths while also recognizing the HIV-1 Env backbone. These data reveal critical antibody features for enhanced neutralization breadth and potency against the FP site of vulnerability and accelerate clinical development of broad HIV-1 FP-targeting vaccines and therapeutics.

60 APPLIED LIFE SCIENCES↗

Strong, Lightweight, Porous Materials

A new class of strong, lightweight, porous materials has been invented as an outgrowth of an effort to develop reinforced silica aerogels. The new material, called X-Aerogel is less hygroscopic, but no less porous and of similar density to the corresponding unmodified aerogels. However, the property that sets X-Aerogels apart is their mechanical strength, which can be as much as two and a half orders of magnitude stronger that the unmodified aerogels. X-Aerogels are envisioned to be useful for making extremely lightweight, thermally insulating, structural components, but they may also have applications as electrical insulators, components of laminates, catalyst supports, templates for electrode materials, fuel-cell components, and filter membranes.

Leventis, Nicholas↗

Continuous In Vitro Evolution of a Ribozyme that Catalyzes Three Successive Nucleotidyl Addition Reactions

Variants of the class I ligase ribozyme, which catalyzes joining of the 3' end of a template bound oligonucleotide to its own 5' end, have been made to evolve in a continuous manner by a simple serial transfer procedure that can be carried out indefinitely. This process was expanded to allow the evolution of ribozymes that catalyze three successive nucleotidyl addition reactions, two template-directed mononucleotide additions followed by RNA ligation. During the development of this behavior, a population of ribozymes was maintained against an overall dilution of more than 10(exp 406). The resulting ribozymes were capable of catalyzing the three-step reaction pathway, with nucleotide addition occurring in either a 5' yieldig 3' or a 3' yielding 5' direction. This purely chemical system provides a functional model of a multi-step reaction pathway that is undergoing Darwinian evolution.

McGinness, Kathleen E.↗

The primordial black holes that disappeared: connections to dark matter and MHz-GHz gravitational Waves

In the post-LIGO era, there has been a lot of focus on primordial black holes (PBHs) heavier than ~10 15 g as potential dark matter (DM) candidates. We point out that the branch of the PBH family that disappeared — PBHs lighter than ~10 9 g that ostensibly Hawking evaporated away in the early Universe — also constitute an interesting frontier for DM physics. Hawking evaporation itself serves as a portal through which such PBHs can illuminate new physics, for example by emitting dark sector particles. Here, taking a simple DM scalar singlet model as a template, we compute the abundance and mass of PBHs that could have provided, by Hawking evaporation, the correct DM relic density. We consider two classes of such PBHs: those originating from curvature perturbations generated by inflation, and those originating from false vacuum collapse during a first-order phase transition. For PBHs of both origins we compute the gravitational wave (GW) signals emanating from their formation stage: from second-order effects in the case of curvature perturbations, and from sound waves in the case of phase transitions. The GW signals have peak frequencies in the MHz-GHz range typical of such light PBHs. We compute the strength of such GWs compatible with the observed DM relic density, and find that the GW signal morphology can in principle allow one to distinguish between the two PBH formation histories.

79 ASTRONOMY AND ASTROPHYSICS↗

A Physics-Informed Reinforcement Learning Framework for Economic-Thermal Co-Optimization of Crypto Mining Data Centers: Preprint

The rapid expansion of cryptocurrency mining has created a new class of high-density data centers characterized by extreme thermal flux and high sensitivity to volatile economic markets. Traditional thermal management strategies, typically reliant on rule-based control, maintain static setpoints that fail to account for fluctuating electricity prices and cryptocurrency values - factors critical to mining profitability. To address this, we present a physics-informed reinforcement learning (PIRL) framework for economic-thermal co-optimization in crypto mining data centers. This framework consists of a proximal policy optimization (PPO) agent, a virtual testbed powered by high-fidelity physics-based models, and an interactive frontend dashboard. The PPO agent is trained using the virtual testbed and strict hardware safety limits. This physics-informed approach allows the agent to learn a stochastic policy that dynamically balances mining revenue against operational costs by co-optimizing HVAC cooling setpoints and IT computational hashrate. The simulation results demonstrate that the integrated framework achieved an 8.62% increase in net operational profit compared to traditional baseline strategies while strictly adhering to safety-critical temperature constraints (coolant supply temperature < 32 degrees C). This work provides a scalable template for the deployment of reinforcement learning in mission critical facilities where economic volatility and physical safety must be managed simultaneously.

32 ENERGY CONSERVATION, CONSUMPTION, AND UTILIZATI↗