Comments (5)
Thanks for quick reply. I've stumbled across it randomly as I was trying to avoid copy constructors.
Just to confirm:
#include <conduit.hpp>
int main (int argc, char *argv[]) {
conduit::Node root;
double* ptr = new double[3]{1, 2, 3};
conduit::Node subtree;
subtree["to/data"].set_external(ptr, 3);
root["path"].move(subtree);
root["empty"];
root.print();
std::cout << "Node name: " << root["path"].name() << std::endl;
std::cout << "Node name: " << root["empty"].name() << std::endl;
conduit::Node copy = root;
std::cout << "Node name after copy: " << copy["path"].name() << std::endl;
return 0;
}
Gives on Conduit 0.8.8:
path:
to:
data: [1.0, 2.0, 3.0]
empty:
Node name:
Node name: empty
Node name after copy: path
from conduit.
Thanks for the question, executing:
root["path"]
Will create an empty node named "path"` as a child for root node - before the move is executed.
The move destination is the node it is called on, so in this case it is root["path"]
instead of root
I would expect:
std::cout << "Node name: " << root["path"].name() << std::endl;
To show path
, since this did not work- sounds like a bug & we need to fix the move implementation.
We will look into this more.
from conduit.
thanks for the output -- we will work to fix this case.
from conduit.
Here is a simpler reproducer - it has to do with Node::swap()
:
Node root, subtree;
subtree["to/data"] = 5;
root["path"]["to"]["data"] = 6;
std::cout << "Node name: " << root["path"].name() << std::endl;
if (root["path"].schema().parent() != NULL)
std::cout << "path schema parent exists" << std::endl;
else
std::cout << "path schema parent does not exist" << std::endl;
// swap gets rid of the schema parent, which breaks name()
root["path"].swap(subtree);
std::cout << "Node name: " << root["path"].name() << std::endl;
if (root["path"].schema().parent() != NULL)
std::cout << "path schema parent exists" << std::endl;
else
std::cout << "path schema parent does not exist" << std::endl;
yields:
Node name: path
path schema parent exists
Node name:
path schema parent does not exist
swap
is used internally by move
.
from conduit.
here is a fix: #1179
from conduit.
Related Issues (20)
- conduit::blueprint::mesh::topology::unstructured::verify passes on polygonal mesh with no sizes.
- Add VTK File outputs for Blueprint HOT 1
- The simple multi-buffer material set example in the docs is ambiguous
- building docs are missing details about a few cmake params HOT 1
- Use O2M index for matset converters
- O2M and ND Relation Map Interface for Python
- add species I/O support for Silo meshes HOT 1
- Refactor Generate Sides code to take advantage of `data_accessor` set
- Strided structure topo crashes topology::length function. HOT 1
- Add Gyre as example dataset
- python cmake logic needs to be udpated b/c distutils will fully disappear HOT 1
- generate_sides needs w/ fields output needs to be robust to no fields input
- Merging a partitioned ascent blueprint extract to single partition HOT 4
- is conduit robust to drive letters like `E:/blah` on windows?
- Tests should blow away old result files to avoid errors
- distutils is removed in Python 3.12 HOT 3
- `generate_sides` for matsets
- Mesh blueprint element windings polyhedral topologies HOT 2
- error building with numpy 2.0
- remove use of MPI_COMM_WORLD HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from conduit.